JCL Utility Programs

Purpose

JCL Utility Programs are system-provided applications designed to perform common data management and file manipulation tasks. These utilities enable standardized operations without requiring custom programming, ensuring consistent, reliable execution of routine functions.

Key Benefit:

JCL Utility Programs significantly reduce development time by providing pre-tested functionality for common operations such as dataset manipulation, data transformation, backup/restore, and catalog management.

Common IBM Utility Programs

UtilityPrimary FunctionCommon Uses
IEFBR14Dummy program for dataset allocation/deallocationCreating, deleting, or cataloging datasets without processing data
IEBGENERSequential dataset copying/manipulationCopying files, converting data, generating test data
IEBCOPYPartitioned dataset (PDS) manipulationCopying, merging, or compressing partitioned datasets
IDCAMSAccess method services for VSAM and catalogsCreating/deleting VSAM datasets, printing catalogs, AMS commands
SORT (DFSORT)Sorting, merging, copying dataData ordering, selection, transformation, and reporting
ADRDSSU (DFDSS)Dataset management and storage administrationBackup, restore, copy, move datasets at physical level
IEHPROGMDataset and catalog maintenanceScratching datasets, renaming, cataloging/uncataloging
ICEGENERDFSORT replacement for IEBGENERMore efficient sequential dataset copying

Detailed Program Overviews

IEFBR14 (Dummy Program)

IEFBR14 is a minimal program that does nothing but return control to the system with a return code of zero. Its primary purpose is to leverage JCL DD statement functions (allocation, deletion, catalog management) without actually processing data.

Key Characteristics:

  • Contains only a single assembler instruction: BR 14 (Branch to Register 14)
  • Takes no input, produces no output
  • Used exclusively for dataset operations through DD statement DISP parameters

Common Usage Examples:

jcl
1
2
3
4
5
6
7
//STEP1 EXEC PGM=IEFBR14 //CREATE DD DSN=USER.NEW.DATASET, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,2)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920) //DELETE DD DSN=USER.OLD.DATASET, // DISP=(MOD,DELETE,DELETE)

This example creates a new dataset and deletes an old dataset without processing any data. The IEFBR14 program itself does nothing; all actions occur through JCL DD statement disposition processing.

IEBGENER (Sequential Copy Utility)

IEBGENER copies sequential datasets with optional modifications such as record selection, field manipulation, or format conversion.

Key DD Statements:

  • SYSUT1 - Input dataset (required)
  • SYSUT2 - Output dataset (required)
  • SYSIN - Control statements (optional, DUMMY if not needed)
  • SYSPRINT - Message output (required)

Common Usage Example:

jcl
1
2
3
4
5
6
7
8
//STEP2 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=USER.INPUT.DATASET,DISP=SHR //SYSUT2 DD DSN=USER.OUTPUT.DATASET, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(5,2)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920) //SYSIN DD DUMMY

This example copies USER.INPUT.DATASET to a new dataset called USER.OUTPUT.DATASET without making any changes to the data.

IDCAMS (Access Method Services)

IDCAMS is a versatile utility for managing VSAM datasets, catalogs, and performing various data management functions through powerful command statements.

Key DD Statements:

  • SYSPRINT - Message output (required)
  • SYSIN - Control statements (required)
  • Additional DD statements as required by specific commands

Common Commands:

  • DEFINE - Create VSAM datasets and catalogs
  • DELETE - Remove VSAM datasets and catalogs
  • PRINT - Display dataset contents
  • REPRO - Copy or convert datasets
  • LISTCAT - Display catalog information
  • ALTER - Change dataset attributes

Common Usage Example:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//STEP3 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE USER.VSAM.KSDS CLUSTER PURGE DEFINE CLUSTER - (NAME(USER.VSAM.KSDS) - INDEXED - RECORDSIZE(100 200) - KEYS(10 0) - VOLUMES(VOLSER) - CYLINDERS(2 1)) - DATA (NAME(USER.VSAM.KSDS.DATA)) - INDEX (NAME(USER.VSAM.KSDS.INDEX)) LISTCAT ENTRIES(USER.VSAM.KSDS) ALL /*

This example deletes an existing VSAM Key-Sequenced Data Set (KSDS), defines a new one, and then lists the catalog entry for verification.

DFSORT (Sort, Merge, Copy Utility)

DFSORT is a high-performance data processing utility used for sorting, merging, copying, and transforming data.

Key DD Statements:

  • SORTIN - Input dataset for SORT (required for SORT)
  • SORTINnn - Input datasets for MERGE (required for MERGE)
  • SORTOUT - Output dataset (required)
  • SYSIN - Control statements (required)
  • SYSOUT - Message output (required)

Common Usage Example:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
//STEP4 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=USER.UNSORTED.DATA,DISP=SHR //SORTOUT DD DSN=USER.SORTED.DATA, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(5,2)), // DCB=(RECFM=FB,LRECL=100,BLKSIZE=32700) //SYSIN DD * SORT FIELDS=(10,5,CH,A,25,3,BI,D) INCLUDE COND=(5,2,CH,EQ,C'NY') OUTREC FIELDS=(1,20,35,15,21,10) /*

This example sorts a dataset based on a character field at position 10 (ascending) and a binary field at position 25 (descending), includes only records with 'NY' in positions 5-6, and restructures the output records.

Utility Selection Guidelines

Choosing the right utility for a specific task improves efficiency and reduces complexity:

TaskRecommended UtilityAlternative
Dataset allocation onlyIEFBR14IDCAMS
Simple sequential file copyICEGENERIEBGENER
PDS member managementIEBCOPYNone comparable
VSAM dataset operationsIDCAMSNone comparable
Data transformation and sortingDFSORTICEMAN, SYNCSORT (vendor)
Full volume and dataset backupADRDSSUFDR (vendor)
Dataset rename, catalog managementIEHPROGMIDCAMS

Performance Considerations

  • IEBGENER vs. ICEGENER: ICEGENER automatically invokes DFSORT for better performance when possible; use it instead of IEBGENER
  • Block sizes: Use system-determined block sizes (SDB) or optimal block sizes for improved I/O performance
  • DFSORT options: Adjust SORT parameters for memory usage based on dataset size (DYNALLOC, FILSZ)
  • IDCAMS SPEED vs. RECOVERY: Use SPEED option for faster VSAM definition when recovery is not critical
  • VIO vs. physical datasets: For small temporary files, VIO (Virtual I/O) can improve performance

Common Issues and Troubleshooting

IssuePossible CausesSolutions
IEFBR14 not deleting a datasetDataset doesn't exist or is in use
  • Verify dataset exists with LISTCAT
  • Check for dataset enqueues with D GRS command
  • Use DISP=(OLD,DELETE) for existing datasets
IDCAMS command failuresSyntax errors or insufficient permissions
  • Check SYSPRINT for detailed error messages
  • Review command syntax in documentation
  • Use SET MAXCC=0 to continue processing after errors
DFSORT insufficient spaceOutput allocation too small or input size underestimated
  • Use FILSZ parameter to declare input size
  • Increase SORTOUT space allocation
  • Use dynamic allocation (DYNALLOC) for work files
IEBCOPY "member not found"Member name misspelled or doesn't exist
  • Use IEHLIST to verify member names
  • Check for case sensitivity issues
  • Consider using wildcards for member selection

Advanced Techniques

IDCAMS Parameter Files

For complex operations, store IDCAMS commands in a separate dataset:

jcl
1
2
3
//STEP5 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD DSN=USER.IDCAMS.COMMANDS,DISP=SHR

Conditional Execution Based on Utility Return Codes

jcl
1
2
3
4
5
6
7
8
9
//STEP6 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE USER.TEST.FILE /* //STEP7 EXEC PGM=IEFBR14,COND=(4,LT,STEP6) //NEWDD DD DSN=USER.TEST.FILE, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(1,1))

This example creates a new dataset only if the DELETE command in the previous step returned a code less than 4 (successful deletion or file did not exist).

Using DFSORT for Complex Data Transformation

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//STEP8 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=USER.INPUT.DATA,DISP=SHR //SORTOUT DD DSN=USER.REPORT.DATA, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(1,1)), // DCB=(RECFM=FB,LRECL=132,BLKSIZE=27984) //SYSIN DD * SORT FIELDS=COPY OUTREC IFTHEN=(WHEN=(5,2,CH,EQ,C'NY'), BUILD=(1,4, C'NEW YORK', 15,20, 35X)), IFTHEN=(WHEN=(5,2,CH,EQ,C'CA'), BUILD=(1,4, C'CALIFORNIA', 15,20, 35X)), IFTHEN=(WHEN=NONE, BUILD=(1,4, C'OTHER STATE', 15,20, 35X)) /*

This example uses DFSORT's IFTHEN clauses to perform data transformation based on conditional logic, similar to a CASE statement in programming languages.

Best Practices

  1. Use ICEGENER instead of IEBGENER for better performance with simple copying operations
  2. Include appropriate REGION parameters for memory-intensive utilities like SORT and ADRDSSU
  3. Handle return codes to manage conditional execution based on utility results
  4. Document utility usage with JCL comments to explain the purpose of each step
  5. Check utility-specific documentation for version-specific features and optimizations
  6. Consider specialized vendor utilities for performance-critical operations
  7. Standardize utility usage across applications for consistency and maintainability
  8. Review utility output messages even for successful executions to identify potential issues
  9. Use system symbolic parameters to make utility JCL more flexible and environment-independent

JES2 vs JES3 Considerations

Most utility programs work identically in JES2 and JES3 environments, but there are some considerations:

  • JES3 provides additional dataset management capabilities through its catalog and setup phase
  • JES3 has stronger dataset integrity controls which may affect utility behavior with shared datasets
  • Utilities that use spool files may have performance differences between JES2 and JES3

Note:

With z/OS 2.5, JES3 is being phased out in favor of JES2, making JES2-specific behaviors the standard moving forward.

Related Concepts