Consultor Eletrônico



Kbase P12846: Error 62 opening a dynamic query.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

FACT(s) (Environment):

Progress 9.1D

SYMPTOM(s):

Error 62 opening a dynamic query.

SYSTEM ERROR: fmprnt - invalid data type. (62)

A browse is using the dynamic query.

Dynamic query references a static TEMP-TABLE.

TEMP-TABLE is defined as NEW SHARED.

Error 62 occurs after a program was called that defines the TEMP-TABLE as SHARED.

CAUSE:

Bug# 20021101-001

CAUSE:

This is a known issue.

After the call to the program that defines the TEMP-TABLE as SHARED, all the TEMP-TABLE's buffer handles change. The following example shows this:

/* mainProc.p */
DEF NEW SHARED TEMP-TABLE tta NO-UNDO
FIELD fldb AS CHAR.

DEF BUFFER bftt FOR tta.

MESSAGE "tta:" INTEGER(TEMP-TABLE tta:DEFAULT-BUFFER-HANDLE) SKIP
"bftt:" INTEGER(BUFFER bftt:HANDLE)
VIEW-AS ALERT-BOX.
RUN outProc.p.
MESSAGE "tta:" INTEGER(TEMP-TABLE tta:DEFAULT-BUFFER-HANDLE) SKIP
"bftt:" INTEGER(BUFFER bftt:HANDLE)
VIEW-AS ALERT-BOX.

/* outProc. */
DEF SHARED TEMP-TABLE tta NO-UNDO
FIELD fldb AS CHAR.
The second ALERT-BOX will show different handles from the first one.

Because of this, some internal structures in the dynamic browse end up pointing to stale handles, and this generates error 62 when the query is re-opened.

FIX:

Upgrade to version 9.1D06 or later.

Alternatively, you can fix your code as follows.
Upon return from the program that defines the TEMP-TABLE as SHARED the query must be unprepared and prepared from scratch, as in the following example:

...

RUN outProc.p.

/* tta's buffer handles have changed.
Reprepare the query and the browse. */

IF hQry:IS-OPEN THEN
hQry:QUERY-CLOSE().
hBr:QUERY = ?.

ASSIGN hBuffer = BUFFER tta:HANDLE.

CREATE QUERY hQry.
hQry:SET-BUFFERS(hBuffer).
hQry:QUERY-PREPARE('FOR EACH tta').

hBr:QUERY = hQry.
hField = hBuffer:BUFFER-FIELD('fldb').
hBr:ADD-LIKE-COLUMN(hField).

hQry:QUERY-OPEN().