1

Monthly, I need to run a set of JCLs. These JCLs has some hardcoded parameters that I need to be changed every month (eg: the year/month of the source file). On the other hand, these JCL need to be run for many source files:

LEA.D.1804.L03
LEA.D.1804.L04
LEA.D.1804.L05

and so on..

Here is an excerpt of a JCL:

//*---------------------------------------------------------------------
//STEP01   EXEC PGM=OSGENER 
//*---------------------------------------------------------------------
//SYSPRINT DD  SYSOUT=T 
//* 
//SYSUT1   DD  DSN=LEA.D.1804.L03,DISP=SHR 
//* 
//SYSUT2   DD  DSN=LEA.L03.DAT,UNIT=SYSDA,DISP=(,PASS), 
//        DCB=(RECFM=FB,LRECL=135,BLKSIZE=0),SPACE=(CYL,16,RLSE) 
//SYSIN    DD  * 
RCOUT 4,,'016011' 
RCOUT 4,,'016012' 
RCOUT 4,,'016021' 
COPY 

I believe (and hope) that there must be some way to use params instead of these harcoded values. I think that I could use rexx to call these JCLs programmatically, looping the source files.

First, is this possible?

How do I do to use vars/params in my JCLs instead of harcoded values?

(I also know that there is something called file tailoring but I can't understand how I should use it)

I come from PHP, Java, Javascript and those kind of langs stacks. Please be as clear and explicit as possible.

Thanks!

cschneid
  • 9,037
  • 1
  • 28
  • 34
leamasuero
  • 321
  • 1
  • 3
  • 17

2 Answers2

2

I'm going to presume that file tailoring isn't a requirement because it isn't necessary in order to solve your problem.

My recommendation would be to code a procedure, cataloged or in-stream, and then execute it with your different parameters.

//MYPROC01 YY=SUPPLYTWODIGITYEAR,
//        MM=SUPPLYTWODIGITMONTH,
//        LLQ=SUPPLYLOWLEVELQUALIFIER
//*
//*---------------------------------------------------------------------
//STEP01   EXEC PGM=OSGENER 
//*---------------------------------------------------------------------
//SYSPRINT DD  SYSOUT=T 
//* 
//SYSUT1   DD  DSN=LEA.D.&YY.&MM..&LLQ,DISP=SHR 
//* 
//SYSUT2   DD  DSN=LEA.&LLQ..DAT,UNIT=SYSDA,DISP=(,PASS), 
//        DCB=(RECFM=FB,LRECL=135,BLKSIZE=0),SPACE=(CYL,16,RLSE) 
//SYSIN    DD  * 
RCOUT 4,,'016011' 
RCOUT 4,,'016012' 
RCOUT 4,,'016021' 
COPY
//*
//         PEND
//*
//LLQ3     EXEC PROC=MYPROC01,YY=&LYR2,MM=&MON,LLQ=L03
//LLQ4     EXEC PROC=MYPROC01,YY=&LYR2,MM=&MON,LLQ=L04
//LLQ5     EXEC PROC=MYPROC01,YY=&LYR2,MM=&MON,LLQ=L05
//*

this is just freehand, no guarantees I haven't introduced a typo

The &LYR2 and &MON dynamic system symbols are new with z/OS 2.3, and procedures gained the capability of housing in-stream data a couple of releases prior to that.

Absent the ability to use system symbolics, I suggest talking to whomever is responsible for scheduling jobs in your shop. Most mainframe shops have a job scheduling package and these tend to have powerful date manipulation capabilities.

cschneid
  • 9,037
  • 1
  • 28
  • 34
0

In our site, we do have some jobs which run in Monthly basis and the only parameter which keeps changing is the Month & year (in MMMYY format ex: APR18). The jobs are scheduled in Control-M. The MMM & YY variables to be used in the JCL symbolic overrides are set by Control-M based on current month/year.

%%IF  %%OMONTH EQ 01
%%SET %%MON = JAN 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 02
%%SET %%MON = FEB 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 03
%%SET %%MON = MAR 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 04
%%SET %%MON = APR 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 05
%%SET %%MON = MAY 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 06
%%SET %%MON = JUN 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 07
%%SET %%MON = JUL 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 08
%%SET %%MON = AUG 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 09
%%SET %%MON = SEP 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 10
%%SET %%MON = OCT 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 11
%%SET %%MON = NOV 
%%GOTO ENDIT      
%%ENDIF           

%%IF  %%OMONTH EQ 12
%%SET %%MON = DEC 
%%GOTO ENDIT      
%%ENDIF           

%%LABEL ENDIT       

The above lines are usually commented out in the JCL and they are meant to be valid only on the Control-M system. In the JCL, we assign the following Control-M variable names (%%MON & %%OYEAR) to MMMYY symbolic override.

MMMYY=%%MON.%%OYEAR

During runtime of the JCL, the values are substituted. These jobs are scheduled in Control-M to run in a particular time of the month and they don't need manual intervention. Hope this helps.

As cschneid said, I strongly suggest you to get in touch with the schedulers in your site.

Srinivasan JV
  • 685
  • 5
  • 12