Change the month qualifier for a dataset every month.

All sort of Mainframes Interview Questions.
Post Reply
User avatar
Vivek Nayak
Registered Member
Posts: 10
Joined: Sun Jan 18, 2015 5:16 pm

Change the month qualifier for a dataset every month.

Post 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.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

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

Post by enrico-sorichetti »

use the token substitution facilities of YOUR job scheduler
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post 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...
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Vivek Nayak
Registered Member
Posts: 10
Joined: Sun Jan 18, 2015 5:16 pm

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

Post by Vivek Nayak »

Thanks for the answers. Interviewwer talked about some parameterization but I did not understand what he meant! :unknown:
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

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

Post 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...
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
User avatar
Vivek Nayak
Registered Member
Posts: 10
Joined: Sun Jan 18, 2015 5:16 pm

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

Post 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.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

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

Post by nicc »

Suggest you read about SET and symbolic parameters (symbolic parms) and experiment.
Regards
Nic
User avatar
Vivek Nayak
Registered Member
Posts: 10
Joined: Sun Jan 18, 2015 5:16 pm

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

Post 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 .
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post by Robert Sample »

The interviewer probably wanted to see if you could add a symbolic in the right spot.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”