How do I put today’s date in JCL?

I have a backup job which I run to take current copy of the file and save it with today’s date. For months I’ve been editing it to change today’s date. 10 minutes of browsing the internet showed me how easy it was!

For example

//MYLIBS1 JCLLIB ORDER=USER.Z24C.PROCLIB
// SET TODAY=D&YYMMDD
//S1 EXEC PROC=BACKUP,P=USER.Z24C.PARMLIB,DD=&TODAY.

The procedure has

//BACKUP PROC P='USER.Z24C.PROCLIB',DD='UNKNOWN'
//S1 EXEC PGM=IKJEFT01,REGION=0M,
// PARM='XMIT A.A DSN(''&P'') OUTDSN(''BACKUP.&DD..&P'')'
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
// PEND

which gave me

IEFC653I SUBSTITUTION JCL – PGM=IKJEFT01,REGION=0M,PARM=’XMIT A.A DSN(”USER.Z24C.PARMLIB”) OUTDSN(”BACKUP.D210906.USER.Z24C.PARMLIB”)’

I could have used (see here for a complete list)

  • &LYYMMDD for local date
  • &HHMMSS for time
  • &LHHMMSS for local time

Easy – I should have done this years ago!

2 thoughts on “How do I put today’s date in JCL?

  1. Thank you Colin for sharing this Tip. I am also looking for this solution. I do need to create a JCL to copy bunch of files and write to an output dataset with current date as one of the node.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s