Kbase 11744: Which application table does a given RECID reside in
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  07/03/2002 |
|
SUMMARY:
This solution provides procedures to determine which application table contains a record with a given RECID.
SOLUTION:
The procedures below allows you to take a RECID and determine which
application table it came from. If you receive an error message from
PROGRESS that contains a RECID, this procedure will allow you to know
what kind of record is associated with a problem.
For version 6, 7 and 8 databases, see Procedures A and B. For version 9, see procedure C.
PROCEDURE A
-----------
DEF VAR i AS INTEGER FORMAT ">>>>>>>>>9".
REPEAT:
SET i LABEL "Enter the RECID number reported in the log file.".
OUTPUT TO recid.p.
FOR EACH _file WHERE _file-number > 0:
DO:
PUT "FOR EACH " + _file-name + " WHERE RECID(" + _file-name + ") = " + STRING(i) + " NO-LOCK:" FORMAT "x(100)" SKIP.
PUT " DISPLAY " + _file-name + " WITH TITLE '" + _file-name + "'. " FORMAT "x(100)" SKIP.
PUT "END." SKIP.
END.
END.
OUTPUT CLOSE.
OUTPUT TO TERMINAL.
DISPLAY "Looking for record with RECID of " + STRING(i) FORMAT "X(75)" WITH FRAME x.
RUN recid.p.
END.
/* END OF PROCEDURE A */
PROCEDURE B
-----------
This second approach uses the following an include file called check.i with the following text:
/* check.i */
FIND {1} WHERE RECID({1}) = {2} NO-LOCK NO-ERROR.
IF AVAILABLE {1} THEN
DISPLAY "Record with recid {2} found in table:" SKIP "{1}".
The actual procedure is the following code:
/* procedureb.p */
DEF VAR i AS INTEGER FORMAT ">>>>>>>>>9".
REPEAT:
SET i LABEL "Enter the RECID number reported in the log file.".
FOR EACH _file WHERE _file-number > 0:
RUN check.i _file-name VALUE(i).
END.
END.
/*END OF PROCEDURE B */
For Version 9:
PROCEDURE C
-----------
DEFINE VAR qry-handle AS WIDGET NO-UNDO.
DEFINE VAR buf-handle AS WIDGET NO-UNDO.
DEFINE VAR qry-string AS CHAR NO-UNDO.
DEFINE VAR v-recid AS INTEGER NO-UNDO.
PAUSE 0 BEFORE-HIDE.
CREATE QUERY qry-handle.
qry-handle:SET-BUFFERS (buffer _File:HANDLE).
UPDATE "Enter the RECID:" v-recid NO-LABELS.
FOR EACH _File WHERE _file._Owner = "PUB" AND _file-number > 0
AND _file-num < 32767 NO-LOCK:
ASSIGN qry-string = 'FOR EACH ' + _file-name + ' WHERE RECID(' +
_file-name + ') = ' + string(v-recid) + ' NO-LOCK'.
CREATE BUFFER buf-handle FOR TABLE _file-name.
qry-handle:SET-BUFFERS(buf-handle).
MESSAGE "Searching in table " _file-name.
qry-handle:QUERY-PREPARE(qry-string) .
qry-handle:QUERY-OPEN.
qry-handle:GET-NEXT() NO-ERROR.
IF NOT qry-handle:QUERY-OFF-END THEN DO:
DISPLAY "Found in table " _File._File-name NO-LABEL.
END.
qry-handle:QUERY-CLOSE.
HIDE MESSAGE NO-PAUSE.
END.
DELETE WIDGET qry-handle.
DELETE WIDGET buf-handle.
/*END OF PROCEDURE C */