Consultor Eletrônico



Kbase P58614: Session hangs if Progress fails to open a busy file.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   20/01/2004
Status: Unverified

SYMPTOM(s):

Progress 4GL session hangs executing the 4GL OUTPUT TO statement.

Running code similar to the following hangs the session.

DO ON ERROR UNDO, RETRY:
IF RETRY THEN DO:
/* Error logging + evasive action*/
LEAVE.
END.
OUTPUT TO myfile.txt.
END.

CAUSE:

The file "myfile.txt" is busy or otherwise unavailable to the session.

FIX:

Since the syntax of the Progress 4GL OUTPUT TO statement does not allow the NO-ERROR option, a possible solution here is to redirect the generated errors to an an error message log file for subsequent processing:

DEFINE VARIABLE cVariable AS CHARACTER NO-UNDO.
DEFINE STREAM ErrorStream.
DEFINE STREAM OutputStream.

OUTPUT STREAM ErrorStream TO "ErrorMessage.log" KEEP-MESSAGES.

MainBlock:
DO ON ERROR UNDO, RETRY:
IF RETRY THEN DO:
OUTPUT STREAM OutputStream CLOSE.
OUTPUT STREAM ErrorStream CLOSE.
LEAVE MainBlock.
END.
OUTPUT STREAM OutputStream TO myfile.txt.
END.

INPUT FROM VALUE("ErrorMessage.log") NO-ECHO.
IMPORT UNFORMATTED cVariable.
/* Replace following message statement with code */
/* for corrective action based on error message */
MESSAGE cVariable
VIEW-AS ALERT-BOX INFO BUTTONS OK.
INPUT CLOSE.