View previous topic :: View next topic
Author
Message
msagar New User Joined: 10 Jul 2009Posts: 3 Location: Bangalore
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
expat Global Moderator Joined: 14 Mar 2007Posts: 8796 Location: Welsh Wales
Probably
Back to top
msagar New User Joined: 10 Jul 2009Posts: 3 Location: Bangalore
can I know how we can do that in jcl ?
Back to top
superk Global Moderator Joined: 26 Apr 2004Posts: 4652 Location: Raleigh, NC, USA
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
msagar New User Joined: 10 Jul 2009Posts: 3 Location: Bangalore
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
superk Global Moderator Joined: 26 Apr 2004Posts: 4652 Location: Raleigh, NC, USA
I'd be really curious to know how you were originally planning to approach this task.
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
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
Anuj Dhawan Superior Member Joined: 22 Apr 2006Posts: 6248 Location: Mumbai, India
Just out of curiosity -- is it a practical Production Problem?
Back to top
superk Global Moderator Joined: 26 Apr 2004Posts: 4652 Location: Raleigh, NC, USA
I've needed to do something similar in the past ...
Back to top
Douglas Wilder Active User Joined: 28 Nov 2006Posts: 305 Location: Deerfield IL
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
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Thanks Douglas for simplifying it.
Gerry
Back to top
MBabu Active User Joined: 03 Aug 2008Posts: 400 Location: Mumbai
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
Please enable JavaScript!