Consultor Eletrônico



Kbase P13802: How to return the ERROR condition raised in a called procedure to the the caller?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/22/2006
Status: Unverified

GOAL:

How to return the ERROR condition raised in a called procedure to the the caller?

GOAL:

How to raise the ERROR condition on the RUN statement of the calling procedure when an error occurs in the called procedure?

FIX:

/* 1. The calling procedure, a.p */
RUN b.p NO-ERROR.
MESSAGE "Error status error in the calling procedure: " "~t" ERROR-STATUS:ERROR
VIEW-AS ALERT-BOX INFO BUTTONS OK.

/* 1. The called procedure, b.p */
DEFINE VARIABLE cDateString AS CHARACTER NO-UNDO.
/* FORMAT should be similar to: STRING(TODAY, "99999999"). */
ASSIGN
cDateString = STRING(TODAY, "YYYY/MM/DD") NO-ERROR.
IF ERROR-STATUS:ERROR THEN
RETURN ERROR.
MESSAGE "Error status error in the called procedure: " "~t" ERROR-STATUS:ERROR
VIEW-AS ALERT-BOX INFO BUTTONS OK.