Execute a Step based on Date compared

JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Execute a Step based on Date compared

Postby senthamizh » Sun Aug 28, 2016 2:06 pm


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.
Posts: 5
Joined: Tue Sep 14, 2010 2:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Execute a Step based on Date compared

Postby NicC » Sun Aug 28, 2016 3:41 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Execute a Step based on Date compared

Postby willy jensen » Mon Aug 29, 2016 3:29 pm

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.

//SYSTSPRT DD SYSOUT=*                      
//SYSTSIN  DD DUMMY                        
willy jensen
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Return to JCL


  • Related topics
    Last post