How to modifying the Ideal $RC value. The first example will show you how to modify the $RC in the Ideal default error procedure within a program, and the second example will show you how to modify the $RC within the SYSIN of a batch job.
Modifying Ideal's $RC in the default error procedure
To add the default error procedure to your program, enter the characters ER (Error Procedure) on the margin command line while in "edit program" mode. Below is a display of the default error procedure template:
<<ERROR>> PROCEDURE ==================================================== : : : =================================================== IF $RC LT 12 SET $RC EQ 12 ENDIF :statements LIST ERROR BACKOUT QUIT RUN ENDPROC
You can modify the $RC to any value higher or lower than 12. Then, recompile the program and rerun the job. For example:
<<ERROR>> PROCEDURE IF $RC LT 12 SET $RC EQ 40 <- any number higher or lower than 12 ENDIF LIST ERROR BACKOUT QUIT RUN ENDPROC
In the above example, the return code will be set to 40 (instead of 12) if the error procedure is invoked.
//SYSIN DD * SEL SYS $ID DELETE MODULE FOR PGM TEST1 SET $RC EQ 0 ALTER PGM TEST1 VERSION PROD DBID 001 DBID 200 IF $RC EQ 0 CREATE MODULE TEST1 FROM PROGRAM TEST1 ELSE SET $RC EQ 16 ENDIF
Further information can be found in the Ideal Working in the Environment Reference Guide and in the and in the Ideal Creating Programs Guide.