Kbase P33030: Programmatic means to pull recid information from log file t
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/8/2005 |
|
Status: Unverified
SYMPTOM(s):
Sample Code to extract RECID messages from log and create a proutil idxfix script to remove individual recids.
Fix RECID <recid>, <file-name> already exists with <field value>. (1127)
FIX:
The following is a sample piece of code which can be modified to your tastes.
When it is run it will prompt you for the name and location of the database log file which contains errors (the sample is currently programmed to search for 1127 errors).
It will prompt you for the name of an output file (defaults to output.txt).
It will ask you for the area which contains the recids you wish removed (if you aren't sure what area the recids exist in please review solution P29346).
It will create an output file which can be used by proutil -C idxfix to remove duplicate records from a table.
/* start of sample code */
DEFINE VARIABLE logfile AS CHARACTER NO-UNDO FORMAT "x(60)"
LABEL "Log File Name"
INITIAL "c:\base.lg".
DEFINE VARIABLE outfile AS CHARACTER NO-UNDO FORMAT "x(60)"
LABEL "Output File Name"
INITIAL "c:\outfile.txt".
DEFINE VARIABLE areanum AS CHARACTER NO-UNDO FORMAT "x(4)"
LABEL "Area Number"
INITIAL "6".
DEFINE VARIABLE logline AS CHARACTER NO-UNDO FORMAT "x(76)".
DEFINE VARIABLE holder AS CHARACTER NO-UNDO FORMAT "x(18)".
DEFINE VARIABLE startpos AS INTEGER NO-UNDO.
DEFINE VARIABLE endpos AS INTEGER NO-UNDO.
DEFINE VARIABLE idxfix-opt AS CHAR INIT "6" NO-UNDO.
DEFINE VARIABLE answer AS CHAR INIT "y" NO-UNDO.
DEFINE STREAM instream.
define stream outstream.
UPDATE logfile with side-labels.
update outfile with side-labels.
update areanum with with side-labels.
INPUT STREAM instream FROM value(logfile).
output stream outstream to value(outfile).
PAUSE 0 BEFORE-HIDE.
REPEAT:
IMPORT STREAM instream UNFORMATTED logline.
if (index(logline,"RECID") > 0) AND (index(logline,"(1127)") > 0) then
do:
startpos=index(logline,"RECID").
endpos=index(logline,",").
holder=substring(logline,startpos + 6,(endpos - (startpos + 6))).
display stream outstream idxfix-opt SKIP with no-labels.
display STREAM outstream holder SKIP with no-labels.
display STREAM outstream areanum SKIP with no-labels.
display STREAM outstream answer SKIP with no-labels.
end.
END.
INPUT CLOSE.
output close.
/* end of sample code */
Example output.txt file:
6
186820
6
y
6
186825
6
y
Example command to use the output.txt file generated by the above code:
proutil <dbname> -C idxfix < output.txt
Proutil idxfix would receive it's direction of steps from the information in output.txt.