You can use the REXX EXIT instruction to exit a procedure with logic. QMF always issues a message when it finishes running a procedure with logic. If you use the EXIT instruction, the message you see depends on these factors:
Table 11 shows which message you see based on the given
conditions.
Table 11. Messages returned from QMF commands in procedures
Nonzero return code from the last QMF command | Procedure return code | Message at completion of procedure |
---|---|---|
No | 0 | OK, your procedure was run. |
No | nonzero | The return code from your procedure was 8. |
Yes | 0 | The error message provided by QMF. |
Yes | nonzero | The error message provided by QMF. |
An error message takes precedence over the return code message if you have an incorrect QMF command and a nonzero return code.
If you want to show the error message from the last command and exit with a nonzero return code, use the MESSAGE command as in Figure 157.
Figure 157. Specify MESSAGE to see the error message from the last command.
"MESSAGE (TEXT='"dsq_message_text"'" exit rc |
The variable dsq_message_text is a QMF-provided REXX variable. You can use the MESSAGE command and the dsq_message_text variable to store and display a message after further processing has occurred, as shown in Figure 158.
Figure 158. The MESSAGE command displays the original error message.
/* Monthly report */ Signal on error "DISPLAY TABLE JUNE_INFO" "PRINT REPORT" Exit(0); Error: Original_msg = dsq_message_text /* Saves error message. */ "RUN PROC GENERAL_RECOVERY" /* This proc generates */ /* new dsq_message_text. */ "MESSAGE (TEXT='" Original_msg "'" /* Display original error msg. */ Exit(8); |
For more information on the MESSAGE command, see the QMF Reference, SC26-4716-05 .