Page 1 of 1

Execute a Step based on Date compared

PostPosted: Sun Aug 28, 2016 2:06 pm
by senthamizh
Hi,

In my JCL thru Parm date(16238) is passed and i want to compare the PARM date with hardcoded date and if the PARM date is less than harcoded date then the particular step should execute. Is this possible in JCL.

For example thru parm date is passed as 16238 and harcoded date is 16250 then the step should execute.

Re: Execute a Step based on Date compared

PostPosted: Sun Aug 28, 2016 3:41 pm
by NicC
No - JCL only compares codition codes so you will have to provide a means of comparing the dates and setting the condition code so that the next step executes or does not execute depending on the condition code. The alternative - and much better way is to amend the program that is/is not meant to execute so that the first thing it does is read the parm date, compare with the "hard-coded" date an then by-pass the rest of the program if the date comparison is not right.

Re: Execute a Step based on Date compared

PostPosted: Mon Aug 29, 2016 3:29 pm
by willy jensen
I have this one-liner in a REXX lib member SETCC:

Interpret "Exit (" arg(1) ")"  /* rexx */    
 

It can be executed like shown hereafter. If the test matches then the return code is set to 1 (true), else 0 (false). Any valid REXX comparison can be done this way, not just date check. Or you can set a specific code.

//SETCC    EXEC PGM=IRXJCL,PARM='SETCC DATE(S)=20160829'    
//SYSTSPRT DD SYSOUT=*                      
//SYSEXEC  DD DISP=SHR,DSN=your.LIB.EXEC
//SYSTSIN  DD DUMMY