Previous Topic: Detecting the Severity of the Error Using $RCNext Topic: Coding for Multiple Errors


Using $RC in Batch

During online execution, the value of $RC should be initialized to 0 when an application is invoked. Batch execution is different. Frequently, the execution of one program is based on the successful execution of another. In that case, the value of $RC should be retained from one run to the next. The SET command controls whether the value of $RC is retained. This command must execute before invoking the application.

SET RUN $RC ZERO   return code reset to 0 at start of a run
SET RUN $RC KEEP   return code retained

When executing batch programs, you can test the return code in the job stream using CA Ideal IF, ELSE, and ENDIF commands.