How to add the date in the file name in JCL

5 pts.
Tags:
JCL
need to create a JCL which runs every month end and create a file with name which has the current date in it
ASKED: May 12, 2009  9:35 AM
UPDATED: January 27, 2010  4:04 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

The only way that comes to mind is to alloc the dataset via a CLIST or REXX, then use that dataset in a following step.

Here is a snippet from a CLIST that appends .Dyyyymm (where yyyymm is current year and month e.g. 200912 for Dec ’09) to a DSN.

<pre>
SET LOGFIL=&STR(‘your dsn that will be suffixed with the date’)
SET CDATE = &SUBSTR(1:4,&SYS4SDATE)&SUBSTR(6:7,&SYS4SDATE)
SET LOGFIL = &LOGFIL..&STR(D)&CDATE&STR(‘)

ALLOC FI(LOG) DA(&LOGFIL) NEW +
LRECL(150) BLOCK(5000) +
SPACE(1,1) CYLINDERS RECFM(V,B) DSORG(PS) CATALOG
</pre>

// JOB…
// EXEC PGM=IKJEFT0
run the CLIST from above
// EXEC this is your step using the DSN allocated

Now, having said that, I suggest you might consider GDGs. Who cares what the current date is?

Another approach, IF you have a JCL set up crew – might called production control or JCL staff or I/O control or whatever.

You can always use PROCs in your job streams and have the JCL staff modify a parm before each run of the job. This only works if you have a JCL staff that does job set up before execution. Some places do, and many do not.

IF you do have these folks, try something like this:

// PROC procname
// EXEC your job step
// DD DSN=some.name.D&date, …
// …
// PEND
//*
// EXEC PROC=procname,date=200912
//

Where your JCL setup folks would actually change the value in the EXEC PROC= statement every time.

Almost forgot to mention the SET command for JCL
Again, this requires manual intervention each time it runs, so this is only valid if you have the afore mentioned JCL set up crew.
<pre>
// SET PARM1=’xxx.yyy.DEC09′
//*
// EXEC PGM=abcdef
//JCLIN DD DSN=&PARM1,DISP=NEW
//*
//STEP02 EXEC PGM=defghi
//DDIN DD DSN=&PARM1,DISP=OLD
//</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following