Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how the change the value of return code 1

Status
Not open for further replies.

deveshjogal

Programmer
Dec 30, 2002
61
Hi everybody

I have a requirement. I dont know how to change the value of Return Code parameter (RC) in JCL. My requirement is that if previous step's RC < 13 then dont execute the next step but the final RC should be zero. I am able to skip the step using the COND parameter. Also I know the syntax IF RC < 13 THEN to check return code but dont know how to set it to value zero. Appreciate any help.

Thanks
Devesh
 
Ok Devesh,

I think I've go a solution for you. You may not want to use it, but it IS a solution:


1) Take your FTP step (MR100020) and make a job out of it (i.e., slap a JOBCARD on it) and make it a member of your shop's JOBLIB or any PDS, for that matter.

2) Modify your JCL as shown below:
Code:
//********************************************************
//*    CHECK IF THE FILE IS EMPTY OR NOT                  
//********************************************************
//MR100010 EXEC PGM=IDCAMS                                
//DD1      DD DSN=xyz.MR100010.abcTRAN,DISP=SHR       
//DD2      DD SYSOUT=* 
//FTPDD    DD DSN=xyz.your.shops.joblib(ftpjob),DISP=SHR 
//RDRDD    DD SYSOUT=(,INTRDR)  
                     
//SYSPRINT DD SYSOUT=*                                    
//SYSIN   DD *                                            
 REPRO -                                                  
 INFILE(DD1) -                                            
 OUTFILE(DD2) SKIP(1) COUNT(0)                            
 IF MAXCC GT 0 THEN -
    REPRO -                                                 
    INFILE(FTPDD) -                                         
    OUTFILE(RDRDD)                            
    SET MAXCC  = 0  -
    SET LASTCC = 0      
/*
This puts everthing in the IDCAMS step, which allows you to change the RC before the step ends.

BTW, the INTRDR is an internal reader used by JES. When you write JCL to it via a utility or a user written pgm, the JOB or JOBs are automatically submitted to the JES input Q for processing.
 
I followed Devesh's style assuming he knew that the file would always exist, but sometimes be empty. This is a pretty good assumption, since he's the guy who creats the file. But it might be a good idea to plan for your situation, to be on the safe side.

You can change:

INFILE(DD1) -

to:

INDS(xyz.MR100010.abcTRAN) -

in both places. Don't know if you can mix and match INDS/OUTFILE. If not change OUTFILE too. Don't forget to get rid of the associated DD cards in the step. This prevents a JCL error if the I/P dataset doesn't exist.

As I recall, empty (no data w/EOF marker) = RC4, not there or empty w/o EOF marker = RC12. You can run a test to verify.

Regards, Jack.
 
Hi WMK,

The reference you cited in your post documennts the use of the SET cmd to set (or reset) the value of a symbolic parameter. These start with an ampersand (&), for example &MYACCT and are used to provide variable values to JCL parameters or parts of JCL parameters.

The SET command is also used in IDCAMS cntl cards to set (or reset) a return code issued by IDCAMS as a result of processing one of its many commands. But the MAXCC and LASTCC that it manipulates are confined to the executing step that contains the //SYSIN DD card in which the SET command resides.

Regards, Jack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top