TIRRETCX - not returning zero return code.

Document ID : KB000123460
Last Modified Date : 21/12/2018
Show Technical Document Details
Introduction:
After making a change to TIRRETCX  which is used in a batch job, installed using MKEXITS to compile and link as TIRRETCZ. The only change made was to set value of 0 as indicated below in bold.

01 TIRRETCD-CMCB.
    05 TIRRETCD-RETURN-CODE PIC S9(9) COMP.
        88 TIRRETCD-BEGIN-JOB VALUE +110.
        88 TIRRETCD-TRANSFER VALUE +120 THRU +990.
        88 TIRRETCD-END-OF-JOB VALUE ZERO.

The result of the linkedit was named TIRRETCZ in the application load library and ran the batch JCL.  The batch job still gets a return code 1000. 
Environment:
z/OS
Host Runtime
Instructions:
See dataset member <your.hlq>.CEHBSAMP(TIRRECTCX) for explanation of this user exit.  A description is also in the doc at this location:  https://docops.ca.com/ca-gen/8-6/en/reference/user-exits/z-os-user-exits/z-os-batch-user-exits/tirretcx-batch-return-code-override-exit


THIS IS THE RETURN CODE OVERRIDE EXIT FOR BATCH. IT IS      
CALLED BY THE BATCH MANAGER AT THE END OF JOB STEP          
EXECUTION, AND BY PROGRAM TIRIOVFI.                         
                                                            
THE RETURN CODE IS USED TO IMPLEMENT TRANSFER  DIALOG FLOWS.
FOR EXAMPLE, CONSIDER A THREE-STEP PROCEDURE.               
IF STEP ONE TRANSFERS TO STEP TWO, A RETURN CODE OF 120     
IS SET.  IF STEP ONE TRANSFERS TO STEP THREE, BYPASSING     
STEP TWO, A CONDITION CODE OF 130 IS SET.  THE JCL EXEC     
STATEMENTS FOR THESE TWO STEPS CHECK THE CONDITION CODE     
FOR 120 AND 130, RESPECTIVELY.  WHEN A PROCEDURE STEP       
ENDS WITHOUT A TRANSFER, A RETURN CODE OF 1000 IS SET       
TO INDICATE THE END OF THE JOB.                             
                                                            
THIS EXIT WAS CREATED TO ALLOW USERS TO OVERRIDE THESE      
RETURN CODES.  SOME USERS HAVE SITE STANDARDS OR JOB        
SCHEDULING SYSTEMS WHICH DO NOT TOLERATE NON-ZERO RETURN    
CODES. 

DUE TO THE IMPLICATIONS OF THE RETURN CODE ON JOB STEP       
EXECUTION, CARE SHOULD BE TAKEN WHEN MODIFYING THIS EXIT.    
IF THE JOB CONTAINS ONLY ONE PROCEDURE STEP, OR ALL          
PROCEDURE STEPS IN THE JOB ARE ALWAYS EXECUTED SEQUENTIALLY, 
THEN CHANGING THE RETURN CODE SHOULD HAVE NO EFFECT ON       
JOB EXECUTION.  IF THE PROCEDURE STEPS CONDITIONALLY         
TRANSFER TO OTHER PROCEDURE STEPS AS DESCRIBED ABOVE,        
BE SURE YOU UNDERSTAND THE USE OF CONDITION CODES BEFORE     
MODIFYING THIS EXIT.                                         
                                                             
NOTE: RETURN CODES ARE NOT USED IN THE TSO TESTING OF        
BATCH APPLICATIONS.  OVERRIDING THE RETURN CODE WILL HAVE    
NO EFFECT ON TSO TESTING OF BATCH PROCEDURES.                
             
More description of the parameters are in the exit for the programmer that will make changes.                                      
Additional Information:
If your JCL is not generated by Gen, make sure the job step for program TIRIOVFI is the first step.

A simple example ONLY of a change to have zero return code:

PROCEDURE DIVISION USING TIRRETCD-CMCB. 

IF TIRRETCD-BEGIN-JOB 
MOVE ZERO TO TIRRETCD-RETURN-CODE 
END-IF. 
IF TIRRETCD-END-OF-JOB 
MOVE ZERO TO TIRRETCD-RETURN-CODE 
END-IF.