error / warning messages

tamhas

ProgressTalk.com Sponsor
There are descriptive knowledgebase entries on many. Why would you want just a list of promsgs? I'm sure one could make one with awk, but yuck.
 

Stefan

Well-Known Member
Anyone know if there is a readable text document of promsgs with carriage returns.

Just roll your own.

Code:
DEF VAR mptr   AS MEMPTR NO-UNDO.
DEF VAR ilen   AS INT NO-UNDO.
DEF VAR ii     AS INT NO-UNDO.
DEF VAR cc     AS CHAR.
DEF VAR ibyte  AS INT.
DEF VAR lbusy  AS LOGICAL INIT ?.


DEFINE TEMP-TABLE tt NO-UNDO
   FIELD msg# AS INT
   FIELD msg AS CHAR
   .


COPY-LOB FROM FILE SEARCH( "promsgs" ) TO mptr.


ilen = GET-SIZE ( mptr ).


DO WHILE ii < ilen:


   ii = ii + 1.
   ibyte = GET-BYTE( mptr, ii ).


   IF ibyte = 0 THEN DO:
      IF lbusy THEN DO:
         IF cc MATCHES "*(*)" THEN DO:
            CREATE tt.
            ASSIGN
               tt.msg#  =  INTEGER( ENTRY( 1, ENTRY( NUM-ENTRIES( cc, "(" ), cc, "(" ), ")" ) )
               tt.msg   =  cc
            NO-ERROR.
            IF ERROR-STATUS:ERROR THEN
               DELETE tt.
         END.
         cc = "".
         lbusy = FALSE.
      END.
   END.
   ELSE IF ibyte = 10 THEN
      lbusy = FALSE.
   ELSE DO:
      cc = cc + CHR( ibyte ).
      lbusy = TRUE.
   END.


END.
SET-SIZE( mptr ) = 0.


OUTPUT TO "promgs.txt".
FOR EACH tt:
   PUT UNFORMATTED tt.msg SKIP.
END.
OUTPUT CLOSE.

I'm not sure how the promsgs file is indexed internally so I'm assuming the first message starts at the linefeed marker and that nulls separate messages. This does result in some rubbish data, but it's a start.
 
Top