Need to Execute JCL step based on date range



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

Need to Execute JCL step based on date range

Postby claywilly » Wed Jun 18, 2008 11:49 pm

Hello,

I have a job that runs twice a month. It runs on (or near) the 15th and 30th of the month.

I need to execute one step in the jcl if the date is near the 15th else run the other step.

Can it be done?

Thanks..
User avatar
claywilly
 
Posts: 26
Joined: Sat Jun 14, 2008 12:01 am
Has thanked: 0 time
Been thanked: 0 time

Re: Need to Execute JCL step based on date range

 

Re: Need to Execute JCL step based on date range

Postby dick scherrer » Thu Jun 19, 2008 1:21 am

Hello,

Sure. Add a new first step to check the current date and set a return-code depending on the date - you may need to code to make sure the job only runs once each half-month. . . .

The existing steps would execute or be bypassed depending on the return code set.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Need to Execute JCL step based on date range

Postby MrSpock » Thu Jun 19, 2008 1:26 am

I was actually thinking that there are so many different ways this could be approached that it's impossible to even start to mention them all.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: Need to Execute JCL step based on date range

Postby claywilly » Thu Jun 19, 2008 4:37 am

Can one you guys give some examples?

I was thinking of parsing the &sysdate to get the 'day'...

// if (&sysdate(dd) <= '15')
// exec step 1
// else
// exec step2
// endif

??
User avatar
claywilly
 
Posts: 26
Joined: Sat Jun 14, 2008 12:01 am
Has thanked: 0 time
Been thanked: 0 time

Re: Need to Execute JCL step based on date range

Postby dick scherrer » Thu Jun 19, 2008 6:56 am

Hello,

Have you tried this?

I do not recall &sysdate being available in jcl.

You could write a tiny cobol program to get the current date or some other control info and set the return code accordingly. This would give you more flexibility and allow for any needed business rules to be incorporated.

Which sort product is used on your system? If you are not sure, run any sort and post the sysout info.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Need to Execute JCL step based on date range

Postby claywilly » Thu Jun 19, 2008 9:49 pm

I found out that the IF statement doesn't like the &sysdate parameter. I looked up the IF/THEN/ELSE etc... it doesn't say anything about using system symbols for the parameters.

I doubt that it would work.
User avatar
claywilly
 
Posts: 26
Joined: Sat Jun 14, 2008 12:01 am
Has thanked: 0 time
Been thanked: 0 time

Re: Need to Execute JCL step based on date range

Postby Bill Dennis » Fri Jun 20, 2008 12:43 am

claywilly,

have you tossed out dick's idea of a program?

if so, here's the system I created. You could too.
1. create JOB1 with a step for each date STEP01 to STEP31 (you decide which steps process what)
2. set up JOB2 with an IEBEDIT step and a control card to copy JOB1 to INTRDR including only a single step, STEPnn.
3. set up JOB3 running pgm=EZACFSM1 to read JOB2 and replace 'nn' in the control card with &LDAY and submit to INTRDR (see MVS Init and Tuning Reference for a list of symbols EZACFSM1 will resolve while copying JCL or data files).
4. submit JOB3 which tailors and submits JOB2 which tailors and submits JOB1 containing STEPnn for today's date.

A simple pgm would be less complicated and reusable elsewhere!
Regards,

Bill Dennis

Disclaimer: My comments on this forum are my own and do not represent the opinions or suggestions of any other person or business entity.
Bill Dennis
 
Posts: 278
Joined: Thu May 15, 2008 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need to Execute JCL step based on date range

Postby MrSpock » Fri Jun 20, 2008 12:50 am

This is an easy, non-programming method:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
NOTHING
/*
//T1 DD UNIT=VIO
//T2 DD SYSOUT=*
//TOOLIN  DD    *
COPY FROM(IN) USING(CTL1)
COUNT FROM(T1) EMPTY RC4
/*
//CTL1CNTL DD *
  INREC FIELDS=(DATE)
  OUTFIL FNAMES=T1,INCLUDE=(4,2,CH,LE,C'15')
  OUTFIL FNAMES=T2,SAVE
/*
//*
// IF (S1.RC = 0) THEN
// ** DO DAY <= 15 LOGIC
// ELSE
// ** DO DAY > 15 LOGIC
// ENDIF
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: Need to Execute JCL step based on date range

Postby claywilly » Fri Jun 20, 2008 3:40 am

MrSpock wins.

We definitly don't want to write a little program or have 2 or 3 other jobs to execute a simple sort step that just happens once a month.

Thanks MrSpock.

Also, if there is a more 'simpler' way, I am open to that too. But I will give this a try.

claywilly
User avatar
claywilly
 
Posts: 26
Joined: Sat Jun 14, 2008 12:01 am
Has thanked: 0 time
Been thanked: 0 time

Re: Need to Execute JCL step based on date range

Postby MrSpock » Fri Jun 20, 2008 10:05 pm

Sure, but honestly, why would you want to?
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post