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!
//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 *
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!
4 thoughts on “How do I put today’s date in JCL?”
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.
I do not understand your question. The JCL I give puts today’s date as part of the JCL. Can you give an example of what you want to do
//STEP010 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=
//SORTOUT DD DSN=xxxxx.yyyy.zzzz.D,
//SYSOUT DD SYSOUT=*
//SYSIN DD *
I want the current date to be as mmddyy or yymmdd
I need to add ‘D’ at the beginning of the 4th qualifier because my system won’t allow to start the qualifier name with numeric.
//COLINJ JOB 1,MSGCLASS=H
// SET TODAY=D&YYMMDD
// EXEC PGM=IEFBR14
//DD1 DD DSN=COLIN.DELETE.&TODAY,DISP=(OLD,DELETE),