Page 1 of 1

Change the month qualifier for a dataset every month.

Posted: Thu Nov 19, 2015 2:06 pm
by Vivek Nayak
Hi,

Assume we have a JCL like this:

Code: Select all

//STEPMNTH EXEC PGM=SORT/PGM
//INDATA DD DSN=some.data.NOV15,DISP=SHR 
//OUTDATA DD DSN=out.put,DISP=SHR 
//*
Now every month, every month Iwant to change the NOV15 according to the current month, how can I do this? I do not want to do it manually. :twisted:

I did not know the answer.

Re: Change the month qualifier for a dataset every month.

Posted: Thu Nov 19, 2015 2:38 pm
by enrico-sorichetti
use the token substitution facilities of YOUR job scheduler

Re: Change the month qualifier for a dataset every month.

Posted: Mon Nov 23, 2015 11:53 am
by Anuj Dhawan
I dobut that this can be done by some simple trick unless of course you use a Job scheduler or possibly a symbloic parameter to replace the month qualifier. Just trying to find a rational behind the interview question and a way to do it...

Re: Change the month qualifier for a dataset every month.

Posted: Mon Nov 23, 2015 2:03 pm
by Vivek Nayak
Thanks for the answers. Interviewwer talked about some parameterization but I did not understand what he meant! :unknown:

Re: Change the month qualifier for a dataset every month.

Posted: Mon Nov 23, 2015 2:54 pm
by enrico-sorichetti
Interviewwer talked about some parameterization
the interviewer is an idiot ...
how can I do this? I do not want to do it manually
how would he/she change the parameter ...

1) manually
2) using the scheduler facilities

so we are back to step 0

unless there is something that You forgot to tell...

Re: Change the month qualifier for a dataset every month.

Posted: Wed Dec 30, 2015 3:29 pm
by Vivek Nayak
That was all about it. I read about parameterization but for this scenario I don't understand if a SET command can work. As the NOV15 is in between of the dataset name.

Re: Change the month qualifier for a dataset every month.

Posted: Wed Dec 30, 2015 8:08 pm
by nicc
Suggest you read about SET and symbolic parameters (symbolic parms) and experiment.

Re: Change the month qualifier for a dataset every month.

Posted: Tue Jan 12, 2016 11:25 am
by Vivek Nayak
I read the below examples on SET and symblics in JCL

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Examples of the SET statement

z/OS MVS JCL Reference
SA23-1385-00


Example 1: The symbolic parameter DSP is defined and initialized to the value NEW.
//SET1 SET DSP=NEW
DSP is referenced by coding &DSP in the JCL, for example:
.
.
//DD1 DD DSNAME=ALPHA.PGM1,DISP=(&DSP,KEEP)
In the example, &DSP is assigned the value NEW for execution:
//DD1 DD DSNAME=ALPHA.PGM1,DISP=(NEW,KEEP)
Example 2: The symbolic parameter DSP is defined and initialized to the value (NEW,DELETE,KEEP).
//SETA SET DSP=(NEW,DELETE,KEEP)
DSP is referenced by coding &DSP in the JCL, for example:
//PR2 PROC DSP=(NEW,KEEP)
.
.
//DD6 DD DSNAME=ALPHA.PGM2,DISP=&DSP
&DSP is assigned the value (NEW,KEEP) from PROC statement PR2 for execution:
//DD6 DD DSNAME=ALPHA.PGM2,DISP=(NEW,KEEP)
In the example, the definition of DSP on SET statement SETA does not override the default definition of DSP on PROC statement PR2.

Example 3: This example shows the SET statement spanning two records. The symbolic parameters are defined and initialized to the values shown on SET statement SETB. They are referenced by coding &AA, &BB, and &CC in the JCL, for example:
//SETB SET AA=BETA.PGM.RATE,BB=DCLAS03,
// CC=(NEW,KEEP)
.
.
//PR3 PROC ...
//S3 EXEC PGM=...
//DD7 DD DSNAME=&AA,DATACLAS=&BB,DISP=&CC
.
// PEND
.
//S1 EXEC PROC=PR3,BB=DCLAS0X
.
In the example, the values assigned on DD statement DD7 for execution are:
//DD7 DD DSNAME=BETA.PGM.RATE,DATACLAS=DCLAS0X,DISP=(NEW,KEEP)
The values defined for the symbolic parameters on SET statement SETB are assigned to the AA and CC symbolic parameters in procedure PR3 for execution. However, the value defined for symbolic parameter BB on EXEC statement S1 overrides the value defined on SET statement SETB.

Example 4: The following example shows the use of the SET statement assigning values to symbolic parameters in an INCLUDE group.
//* THIS INCLUDE GROUP IS CATALOGED AS...
//* PUCHKOFF.SYSOUT.JCL(SYSOUT2)
//SYSOUT2 DD SYSOUT=A
//OUT1 OUTPUT DEST=POK,COPIES=3
//OUT2 OUTPUT DEST=&AA,COPIES=&NC
//OUT3 OUTPUT DEST=&BB,COPIES=10
//* END OF INCLUDE GROUP...
//* PUCHKOFF.SYSOUT.JCL(SYSOUT2)
The following program is executed.
//TESTJOB JOB ...
//LIBSRCH JCLLIB ORDER=PUCHKOFF.SYSOUT.JCL
//SET1 SET AA=KINGSTON,BB=STL,NC=10
//STEP1 EXEC PGM=OUTRTN
//OUTPUT1 INCLUDE MEMBER=SYSOUT2
//STEP2 EXEC PGM=IEFBR14
The SET statement, which can be easily changed for different jobs, assigns values to the symbolic parameters in INCLUDE group SYSOUT2.

After the INCLUDE statement is processed, the JCL stream would be executed as:
//TESTJOB JOB ...
//LIBSRCH JCLLIB ORDER=PUCHKOFF.SYSOUT.JCL
//STEP1 EXEC PGM=OUTRTN
//* THIS INCLUDE GROUP IS CATALOGED AS...
//* PUCHKOFF.SYSOUT.JCL(SYSOUT2)
//SYSOUT2 DD SYSOUT=A
//OUT1 OUTPUT DEST=POK,COPIES=3
//OUT2 OUTPUT DEST=KINGSTON,COPIES=10
//OUT3 OUTPUT DEST=STL,COPIES=10
//* END OF INCLUDE GROUP...
//* PUCHKOFF.SYSOUT.JCL(SYSOUT2)
//STEP2 EXEC PGM=IEFBR14
The INCLUDE group has been imbedded in the JCL stream (replacing the INCLUDE statement) and values assigned to the symbolic parameters in the INCLUDE group.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I have a fair understanding of the SET and symbolic now. But I still believe that the original interview question can still not be answered as in the interview JCL I don't have a symbolic parameter. I think interviewer wanted to know about symbolic which i did not understnad .

Re: Change the month qualifier for a dataset every month.

Posted: Tue Jan 12, 2016 6:19 pm
by Robert Sample
The interviewer probably wanted to see if you could add a symbolic in the right spot.