IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

run the jcl step depending on the date


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
msagar

New User


Joined: 10 Jul 2009
Posts: 3
Location: Bangalore

PostPosted: Mon Jul 27, 2009 3:31 pm
Reply with quote

Hi,

I have a job with 12 steps and each step should run on first day of every month.

//JOBname Job ...
//Step1 .. this has to execute on 1st of jan
//step2 .. this has to execute on 1st of feb
//step3 .. this has to execute on 1st of mar
..
..
//step12 .... this has to execute on 1st of Dec

Can this be done with out using Scheduler..



Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Jul 27, 2009 3:32 pm
Reply with quote

Probably
Back to top
View user's profile Send private message
msagar

New User


Joined: 10 Jul 2009
Posts: 3
Location: Bangalore

PostPosted: Mon Jul 27, 2009 3:36 pm
Reply with quote

can I know how we can do that in jcl ?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Jul 27, 2009 3:38 pm
Reply with quote

The job will have to run everyday.

The first step will have to be a program to determine if the current date is the first day of the month, and to set the return-code value appropriately.

I'd go with RC=0 for normal processing, and RC=1 through 12 for each of the first days for the 12 months.
Back to top
View user's profile Send private message
msagar

New User


Joined: 10 Jul 2009
Posts: 3
Location: Bangalore

PostPosted: Mon Jul 27, 2009 3:47 pm
Reply with quote

Lovely !! Thanks for your Prompt response.
This was my first question in this forum. I felt delighted after seeing your prompt responses.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Jul 27, 2009 5:56 pm
Reply with quote

I'd be really curious to know how you were originally planning to approach this task.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Jul 28, 2009 6:36 pm
Reply with quote

Hi,

following Kevin's suggestion, here is a way to achieve this
Code:
//STEP0000 EXEC PGM=ICEMAN                     
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                                 
RECORD                                         
/*                                             
//SORTOUT  DD DSN=&&DATE,                       
//            DISP=(,PASS,DELETE),             
//            UNIT=SYSDA,                       
//            SPACE=(TRK,(1)),                 
//            DCB=(RECFM=FB,LRECL=80)           
//SYSIN    DD *                                 
  OPTION COPY                                   
*                   YYYYMMDD                   
  INREC OVERLAY=(01:DATE1)                     
  OUTREC IFTHEN=(WHEN=(5,4,CH,EQ,C'0101',OR,   
                       5,4,CH,EQ,C'0201',OR,   
                       5,4,CH,EQ,C'0301',OR,   
                       5,4,CH,EQ,C'0401',OR,   
                       5,4,CH,EQ,C'0501',OR,                           
                       5,4,CH,EQ,C'0601',OR,                           
                       5,4,CH,EQ,C'0701',OR,                           
                       5,4,CH,EQ,C'0801',OR,                           
                       5,4,CH,EQ,C'0901',OR,                           
                       5,4,CH,EQ,C'1001',OR,                           
                       5,4,CH,EQ,C'1101',OR,                           
                       5,4,CH,EQ,C'1201'),                             
             BUILD=(01:C' SET MAXCC=',5,2,80:X)),                       
         IFTHEN=(WHEN=NONE,                                             
             BUILD=(01:C' SET MAXCC=00',80:X)) 
/*                       
//*********************************************************************
/*
//SETMAXCC EXEC PGM=IDCAMS                                             
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN    DD DSN=&&DATE,DISP=SHR                                       
//*                                                                     
//*********************************************************************
//*                                                                     
//JAN      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)                       
//*                                                           
//FEB      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)             
//*                                                           
//MAR      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)             
//*                                                           
//APR      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)             
//*                                                           
//MAY      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)             
//*                                                           
//JUN      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)             
//*                                                           
//JUL      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)             
//*                                                           
//AUG      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)             
//*                                                           
//SEP      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)             
//*                                                           
//OCT      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)             
//*                                                           
//NOV      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)                       
//*                                                                   
//DEC      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)                       
//*                                                                   
//NOT1ST   EXEC PGM=IEFBR14,COND=(0,NE,SETMAXCC)                       
//*                                                                   
//*********************************************************************



Gerry
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Jul 28, 2009 7:18 pm
Reply with quote

Just out of curiosity -- is it a practical Production Problem?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Jul 28, 2009 7:36 pm
Reply with quote

I've needed to do something similar in the past ...
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Wed Jul 29, 2009 1:56 am
Reply with quote

Building on Gerry's solution; here is a little simpler way with a bug fixed:
Code:
//STEP0000 EXEC PGM=ICEMAN                     
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                                 
RECORD                                         
/*                                             
//SORTOUT  DD DSN=&&DATE,                       
//            DISP=(,PASS,DELETE),             
//            UNIT=SYSDA,                       
//            SPACE=(TRK,(1)),                 
//            DCB=(RECFM=FB,LRECL=80)           
//SYSIN    DD *                                 
  OPTION COPY                                   
*                   YYYYMMDD                   
  INREC OVERLAY=(01:DATE1)                     
  OUTREC IFTHEN=(WHEN=(7,2,CH,EQ,C'01'),                             
             BUILD=(01:C' SET MAXCC=',5,2,80:X)),                       
         IFTHEN=(WHEN=NONE,                                             
             BUILD=(01:C' SET MAXCC=00',80:X)) 
/*                       
//*********************************************************************
/*
//SETMAXCC EXEC PGM=IDCAMS                                             
//SYSPRINT DD SYSOUT=*                                                 
//SYSIN    DD DSN=&&DATE,DISP=SHR                                       
//*                                                                     
//*********************************************************************
//*                                                                     
//JAN      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)                       
//*                                                           
//FEB      EXEC PGM=IEFBR14,COND=(2,NE,SETMAXCC)             
//*                                                           
//MAR      EXEC PGM=IEFBR14,COND=(3,NE,SETMAXCC)             
//*                                                           
//APR      EXEC PGM=IEFBR14,COND=(4,NE,SETMAXCC)             
//*                                                           
//MAY      EXEC PGM=IEFBR14,COND=(5,NE,SETMAXCC)             
//*                                                           
//JUN      EXEC PGM=IEFBR14,COND=(6,NE,SETMAXCC)             
//*                                                           
//JUL      EXEC PGM=IEFBR14,COND=(7,NE,SETMAXCC)             
//*                                                           
//AUG      EXEC PGM=IEFBR14,COND=(8,NE,SETMAXCC)             
//*                                                           
//SEP      EXEC PGM=IEFBR14,COND=(9,NE,SETMAXCC)             
//*                                                           
//OCT      EXEC PGM=IEFBR14,COND=(10,NE,SETMAXCC)             
//*                                                           
//NOV      EXEC PGM=IEFBR14,COND=(11,NE,SETMAXCC)                       
//*                                                                   
//DEC      EXEC PGM=IEFBR14,COND=(12,NE,SETMAXCC)                       
//*                                                                   
//NOT1ST   EXEC PGM=IEFBR14,COND=(0,NE,SETMAXCC)                       
//*                                                                   
//*********************************************************************
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Jul 29, 2009 3:59 am
Reply with quote

Thanks Douglas for simplifying it.


Gerry
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Wed Jul 29, 2009 4:29 am
Reply with quote

Or simpler (to me)...
Code:
//* Use a tiny Rexx exec to check both month and year           
//* If 1st of month, return number of month, else return 99         
//MAKEREXX EXEC PGM=IEBUPDTE,PARM=NEW                               
//SYSIN    DD  DATA                                                 
./        ADD   NAME=CHKDATE                                         
 if substr(date(u),4,2)=1 then return substr(date(u),1,2); return 99
/*                                                                   
//SYSUT2   DD  DISP=(,PASS),SPACE=(TRK,(1,1,2),RLSE),UNIT=VIO,       
//             DCB=(LRECL=80,BLKSIZE=80,DSORG=PS,RECFM=F)           
//SYSPRINT DD  DUMMY                                                 
//*  Now run the exec to get a return code                           
//SETMAXCC EXEC PGM=IRXJCL,PARM='CHKDATE'                           
//SYSEXEC  DD  DSNAME=*.MAKEREXX.SYSUT2,DISP=(OLD,DELETE)           
//SYSTSIN  DD  DUMMY                                                 
//SYSTSPRT DD  DUMMY                                                 
/*  Proceed as in other solutions                                   
//JAN      EXEC PGM=IEFBR14,COND=(1,NE,SETMAXCC)                     
//*                                                                 
//FEB      EXEC PGM=IEFBR14,COND=(2,NE,SETMAXCC)                     
//*           
// ...                                                       
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top