Consultor Eletrônico



Kbase P112895: 4GL: How to access the contents of the promsgs file using 4GL?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/09/2009
Status: Verified

GOAL:

How to access the contents of the promsgs file using 4GL?

GOAL:

4GL: How to access the text of an error message using its number?

GOAL:

How to get the description of an error message using its number?

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

The following code dumps the first 13000 error messages into a temp table and outputs the first 10 error message records to a text file:
{src/prohelp/msgs.i}
DEFINE VARIABLE iMessageCounter AS INTEGER NO-UNDO.
DEFINE VARIABLE cDescription AS CHARACTER NO-UNDO.
DEFINE TEMP-TABLE ttErrorMessages
FIELD MessageNumber AS INTEGER
FIELD ShortDescription AS CHARACTER
FIELD LongDescription AS CHARACTER
INDEX IndexMessageNumber IS UNIQUE PRIMARY MessageNumber ASCENDING.
DO iMessageCounter = 1 TO 13000:
RUN GetMessageDescription (INPUT iMessageCounter, OUTPUT cDescription).
CREATE ttErrorMessages.
ASSIGN
MessageNumber = iMessageCounter
ShortDescription = ENTRY(1,cDescription, CHR(10))
LongDescription = cDescription NO-ERROR.
END.
OUTPUT TO myerrorfile.txt.
FOR EACH ttErrorMessages NO-LOCK WHERE MessageNumber < 10:
PUT UNFORMATTED MessageNumber AT 1.
PUT UNFORMATTED ShortDescription AT 10 SKIP(2).
PUT UNFORMATTED LongDescription AT 10 SKIP.
PUT UNFORMATTED SKIP(3).
END.
OUTPUT CLOSE.