EXIT
This command sets the return code IMFRC when an EXEC is called using IMFEXEC SELECT EXEC WAIT(YES). This command sets the return code IMFEXRC when an EXEC is called using AOEXEC SELECT EXEC WAIT(YES)
Command | Parameters |
---|---|
EXIT | [CODE(0|n)] [MSG(localStemVariable)] |
The exit code must be a numeric value, up to four characters in length and can range from 0 to 9999.
The following table describes the parameters:
Parameter | Function | Notes |
---|---|---|
CODE | return code to be passed back to the invoker | This return code will be passed on to one of the following when WAIT(YES) is specified:
|
MSG | causes AOSUBX to write a multi-line WTO in the joblog of the AOSUBX job | optional Specify MSG(localStemVariable), where localStemVariable is the root portion of a stem variable in the LOCAL pool; for example: MSG(MYWTOS) After the EXEC completes, AOSUBX writes the messages specified by IMFEXEC EXIT MSG to the job log for the AOSUBX job. Use the MSG parameter only when the EXEC is scheduled by using AOSUBX with WAIT(YES). The MSG parameter is ignored if the EXEC is scheduled with the IMFSUBEX command or if you use other methods to schedule the EXEC. For messages that the LOCAL pool stem variables specify, AOSUBX issues them as a multi-line WTO (hardcopy only, without any route or descriptor codes). The multi-line WTO can include a maximum of 10 lines. Each message line is limited to 70 characters. You can set LOCAL pool variables with IMFEXEC VPUT LOCAL commands. Each EXEC thread has only one LOCAL pool, which all nested EXECs in the thread share. |
Condition codes are listed in the following table:
Value | Description |
---|---|
0 | The command completed successfully. |
20 | INVALID MSG().0 VALUE The specified localStemVariable.0 is not a valid numeric value. |
21 | MISSING MSG() VARIABLE One of the message variables could not be located in the LOCAL pool. |
23 | MORE THAN 10 MESSAGES A maximum of 10 lines can be included in the multi-line WTO. |
25 | UNABLE TO SAVE MSG VARS The MSG() option was unable to save the special internal variables used to pass messages to AOSUBX. |
26 | MSG() VAR.0 IS MISSING The specified localStemVariable.0 could not be found in the LOCAL variable pool. |
Example 1
PARSE ARG P1 P2 P3
If P2 = 'MONDAY' then do
'IMFEXEC MSG ''imfename imfeid ' terminated with a return code of 0''
'IMFEXEC EXIT CODE(0)'
end
else If P2 = 'TUESDAY' then do
'IMFEXEC MSG ''imfename imfeid ' terminated with a return code of 4''
'IMFEXEC EXIT CODE(4)'
end
else do
'IMFEXEC MSG ''imfename imfeid ' terminated with a return code of 8''
'IMFEXEC EXIT CODE(8)'
end
EXIT
Example 2
/* REXX exec1 */
Msg.0=2
Msg.1='display line 1 on the batch joblog'
Msg.2='display line 2 on the batch joblog'
'IMFEXEC VPUT (msg.0 msg.1 msg.2) LOCAL'
'IMFEXEC EXIT CODE(0) MSG(msg)'
IF IMFCC /= 0 THEN
'IMFEXEC MSG '.IMFEXEC EXIT MSG() IMFCC='IMFCC'''
Example 3
WAIT(YES)'
/* REXX exec2 */
Msg.0=3
Msg.1='issue line 1 as a WTO in the AOSUBX job'
Msg.2='issue line 2 as a WTO in the AOSUBX joblog'
Msg.3='issue line 3 as a WTO in the AOSUBX joblog'
'IMFEXEC VPUT (msg.0 msg.1 msg.2 msg.3) LOCAL'
'IMFEXEC EXIT MSG(msg)'
IF IMFCC /= 0 THEN
'IMFEXEC MSG '.IMFEXEC EXIT MSG() IMFCC='IMFCC'''