read invalid command in log file

maizura

New Member
Below is the log file created by using os-command in progress.
This ftp process is unsuccessful.Is it possible we can decide process status by status code to check log file contents by Progress command. If specific word find in the log file, then progress can return abnormal status by using e-mail. From this example log file, the word 'invalid' is shown that this ftp process is failed. How to read the word 'invalid from this log file.

ftp> ftp> open 22.39.23.144
?Invalid command
ftp> ftpnsds
?Invalid command
ftp> @ftpnsds
Not connected.
ftp> ascii
Not connected.
ftp> append
?Invalid command
ftp> j:\nsdsdta\tgcz001o.dat
?Invalid command
ftp> tgcz001o_00029784.dat
quit:D :D :D
 

jongpau

Member
Hi,

How about:
Code:
DEF VAR lvString AS CHAR NO-UNDO.
DEF VAR lvError  AS LOG  NO-UNDO.

DEF STREAM sLog.

INPUT STREAM sLog FROM test.log NO-ECHO.
ReadLog:
REPEAT:
  IMPORT STREAM sLog UNFORMATTED lvString.
  IF lvString BEGINS "?Invalid ":U
  THEN DO:
    lvError = TRUE.
    LEAVE ReadLog.
  END. /* if lvstring begins ?Invalid */
END. /* repeat readlog */
INPUT STREAM sLog CLOSE.
IF lvError 
THEN DO:
  MESSAGE "Error":L VIEW-AS ALERT-BOX ERROR.
END. /* if lverror */
Replace "test.log" with the name of your logfile or VALUE(logfile) when you have a changing file name.

Of course, the above only works when you have a unique log file for each process or when your processes overwrite existing logfiles. If you append to a logfile the example will read errors that occurred during previous processes.

HTH.
 
Top