In mainframe environments, it’s often necessary to create datasets with names that reflect the current system date and time. This is especially useful for logging, backups, and versioning. In this guide, we’ll explore how to use the EZACFSM1 utility to dynamically generate dataset names using date and time parameters.


Step-by-Step Example: Creating a Dataset with Date and Time

Here’s a tested JCL snippet that demonstrates how to use EZACFSM1 to create a dataset with today’s date and time:

//@TESTAB JOB (T18500),'TEST ',CLASS=A,
// MSGCLASS=S,MSGLEVEL=(2,0),NOTIFY=&SYSUID
//STEP1 EXEC PGM=EZACFSM1
//SYSOUT DD SYSOUT=(,INTRDR)
//SYSIN DD DATA,DLM='..'
//@TESTEB JOB 1,'EZACSFM1',CLASS=A,NOTIFY=&SYSUID
//STEP2 EXEC PGM=IEFBR14
//            MYDATA DD DSN=TEST.DATA.D&DAY.M&LMON,
//            DISP=(,CATLG,DELETE),
//            SPACE=(CYL,(10,10),RLSE),
//            DCB=(RECFM=FB,LRECL=10,BLKSIZE=10)
..

Explanation:

  • The first job uses EZACSFM1 to submit a second job.
  • The second job creates a dataset using IEFBR14.
  • The dataset name includes dynamic date components: D&DAY and M&LMON.
  • EZACFSM1 replaces these with the current day and month.

Displaying Date and Time in SYSOUT

To print the current date and time in various formats, use the following code:

EZACSFM1 Parameters You Can Use

EZACSFM1 supports a wide range of dynamic system variables:

ParameterDescription
&DAYDay of the month
&LMONMonth (2-digit)
&YRYear (4-digit)
&HHMMSSTime in HHMMSS format
&HRHour
&SECSeconds
&SEQSequence number
&YYMMDDDate in YYMMDD format
&JOBNAMECurrent job name

Conclusion

Using EZACSFM1 in JCL is a powerful way to automate dataset creation with dynamic naming based on system date and time. Whether you’re organizing logs, backups, or scheduled jobs, this utility simplifies your workflow and enhances job management.

Leave a comment

Discover more from DBzTech-Technology Dossier

Subscribe now to keep reading and get access to the full archive.

Continue reading