Page 1 of 2

Day check

PostPosted: Mon Jun 13, 2011 9:11 pm
by Kitz
Hello there,

An application(AD) is scheduled to run everyday from Monday to Friday in the scheduler(OPC/TWS). I need to run a step in a job if its Monday else I need to just dummy out the complete step using IEFBR14.

So, is it possible to check for the day in the week?

Thanks & Regards,
Kitz

Re: Day check

PostPosted: Mon Jun 13, 2011 11:07 pm
by Akatsukami
Kitz wrote:An application(AD) is scheduled to run everyday from Monday to Friday in the scheduler(OPC/TWS). I need to run a step in a job if its Monday else I need to just dummy out the complete step using IEFBR14.

Although the item is not related to DFSORT, you are aware that merely changing (through some mechanism) the program to IEFBR14 will not affect data set disposition, yes?

Re: Day check

PostPosted: Mon Jun 13, 2011 11:16 pm
by NicC
Stop trying to complicate things - split the job into 3 parts. Parts 1 and 3 run daily, part 2 runs on monday after part1 and before part3.

Re: Day check

PostPosted: Mon Jun 13, 2011 11:50 pm
by Kitz
Thanks Akatsukami, Nic for your quick response.

My Application(AD) in the TWS/OPC schedular has got nearly 200 jobs inter-dependent on each other which produce reports, updates database, vsam files, daily MIS reports etc in a single application. Its a critical application and runs from a quite long years(more than 10-15 years now). To separete out a single step to another application(AD) is something not part of the standard we have here.
Is there any option in DFSORT or OPC (SETVAR or SETFORM) or any other easy approach to identify the DAY of the week.
If its monday then I want to execute that step else not.

I am more interested to use the some sort of check to find if its monday or not in the week. Help on this is much appreciated.

Thanks & Regards,
Kitz

Re: Day check

PostPosted: Tue Jun 14, 2011 12:24 am
by dick scherrer
Hello,

What you want to do is not a JCL task. . .

One easy to do what you want is to add a new step that determines "if this is Monday" and sets the Return Code accordingly.
The step that should be skipped, can be skipped by checking the return code (COND. . .).

I would not be surprised if the day could be gotten from the scheduler. Have you looked in the documentation or talked with the scheduling people?

Re: Day check

PostPosted: Tue Jun 14, 2011 12:31 am
by enrico-sorichetti
see here on how to use OPC variables to include / exclude pieces of jcl
http://publibz.boulder.ibm.com/cgi-bin/ ... 0125170123

along the lines of
//*%OPC  BEGIN ACTION=INCLUDE
//*%OPC       COMP=(expression to check for monday )
... jcl statements for monday
//*%OPC  END ACTION=INCLUDE
//*%OPC  BEGIN ACTION=EXCLUDE
//*%OPC       COMP=(expression to check for monday )
... jcl statements for NON Monday
//*%OPC  END ACTION=EXCLUDE

Re: Day check

PostPosted: Tue Jun 14, 2011 1:33 am
by skolusu
Kitz,

You can use the following DFSORT JCL which will set the return code of 4 when the day of the week is NOT monday.
//STEP0100 EXEC PGM=SORT                       
//SYMNAMES DD *                                 
WKDAY,S'&LWDAY'                                 
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                                 
A                                               
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                                 
  SORT FIELDS=COPY                             
  INREC BUILD=(WKDAY)                           
  OUTFIL NULLOFL=RC4,INCLUDE=(1,3,CH,EQ,C'MON')
//*                                             
//STEP0200 EXEC PGM=????,COND=(4,EQ,STEP0100)   

Re: Day check

PostPosted: Tue Jun 14, 2011 1:55 am
by Kitz
Thanks Dick, Enrico

Sorry for the confusion. I am interested to know how can we identify the current DAY (Mon, Tue etc) of the current date.

For instance, I can directly use OPC date variables like '&CDD.&&CMM.&CYY' in my JCL and it gives current date.
//*%OPC SCAN
.
.
//SYSIN DD *
&CDD.&&CMM.&CYY'
/*

Probasbly, similarly we can get the current date using system date etc in the JCL (though I didn't work on this).

However, to my knowledge, there is no such variable available which directly gives current DAY(Mon, Tue etc). I am interested to know how can we know the current DAY.

I believe there are some SYMNAMES DD statment of SORT can be used to determine the DAY. But, I am not so sure how to use it.

Any sort of help how to determine the DAY in a JCL is more appreciated.

Thanks & Regards,
Kitz

Re: Day check

PostPosted: Tue Jun 14, 2011 1:58 am
by Kitz
Thanks a lot Skolusu. I am looking for this kind of SYMNAMES DD statement approach. I will try this tomorrow and let you know.

Thanks again.

Thanks & Regards,
Kitz

Re: Day check

PostPosted: Tue Jun 14, 2011 2:42 am
by Frank Yaeger
Are you looking for something like this?

//S1 EXEC PGM=SORT           
//SYSOUT DD SYSOUT=*         
//SYMNAMES DD *               
CURDAY,S'&LWDAY'             
//SORTIN DD *                 
RECORD                       
//SORTOUT DD SYSOUT=*         
//SYSIN DD *                 
  OPTION COPY                 
  INREC BUILD=(CURDAY)       


SORTOUT would have the following today:

MON