In IBM mainframe environments, automation is key to managing system logs, daily backups, and batch processing. It is often necessary to create datasets with unique names that reflect the exact execution timestamp.In this guide, you will learn how to use the EZACFSM1 utility to dynamically generate dataset names using real-time system date and time parameters.
EZACFSM1 JCL: Creating a Dataset with Date and Time
Using the EZACFSM1 utility (originally part of IBM’s TCP/IP suite) is one of the most efficient ways to pass system variables into your jobs. This utility allows you to write a “launcher” JCL that dynamically substitutes variables before submitting the target payload to the Internal Reader (INTRDR).
Here is a tested, production-ready JCL snippet that demonstrates how to use the EZACFSM1 utility to create a dataset containing 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 EZACFSM1 to submit a second job.
- The second job creates a dataset using IEFBR14.
- The dataset name includes dynamic date components:
D&DAYandM&LMON. - EZACFSM1 replaces these with the current day and month.
Supported EZACFSM1 Utility JCL Parameters
Beyond days and months, the EZACFSM1 utility supports a wide variety of system variables. You can mix and match these parameters to fit your enterprise naming standards.
Use the reference table below to choose the right variables for your mainframe JCL workflow:
| Parameter | Description |
|---|---|
&DAY | Day of the month |
&LMON | Month (2-digit) |
&YR | Year (4-digit) |
&HHMMSS | Time in HHMMSS format |
&HR | Hour |
&SEC | Seconds |
&SEQ | Sequence number |
&YYMMDD | Date in YYMMDD format |
&JOBNAME | Current job name |
Conclusion
Using EZACFSM1 in JCL is a highly reliable way to automate your mainframe dataset creation. By leveraging dynamic naming based on the system date and time, you eliminate dataset name conflicts (duplicate errors) and make your production logs and backups significantly easier to audit.
Try implementing this snippet into your next batch cycle to streamline your operations workflow!