Modifying the Ideal Return Code ($RC)
search cancel

Modifying the Ideal Return Code ($RC)

book

Article ID: 28010

calendar_today

Updated On:

Products

Datacom DATACOM - AD Ideal

Issue/Introduction

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.

Resolution

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.

Modifying Ideal's $RC in the SYSIN of a batch job 

You can also change the severity of a returned error from Ideal in a batch input statement. For example, executing the sample SYSIN below will set a return code of 0 after the DELETE MODULE command (even if a "module not found" error is returned). Execution will continue with the ALTER PGM. If the ALTER PGM fails, the CREATE MODULE will not be executed, and a return code of 16 will be returned. If the CREATE MODULE fails, the default return code of 8 will be issued.

//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

Additional Information

Further information can be found in the Ideal Working in the Environment Reference Guide and in the and in the Ideal Creating Programs Guide.