MainframeMaster

JCL Tutorial

JCL Performance Considerations

Strategies and techniques to optimize JCL for maximum efficiency and throughput

Progress0 of 0 lessons

Introduction to JCL Performance

Performance optimization is a critical aspect of JCL development, especially in enterprise environments where jobs process large volumes of data and operate under tight processing windows. Well-optimized JCL can significantly reduce resource consumption, improve throughput, and decrease costs.

Resource Efficiency

Optimized JCL minimizes CPU, memory, and I/O usage, reducing costs and allowing more work to be processed with existing hardware.

Processing Speed

Faster job completion enables tighter batch windows, improved data currency, and better service level agreement (SLA) compliance.

System Throughput

Efficient jobs allow the system to process more work concurrently, maximizing the value of your mainframe investment.

Operational Reliability

Well-designed jobs are less likely to fail due to resource constraints, ensuring more consistent operations.

Performance tuning involves optimizing several key areas:

  • Dataset access patterns - How data is allocated, accessed, and managed
  • I/O efficiency - Minimizing the number and impact of input/output operations
  • Memory utilization - Optimizing memory allocation and usage
  • Processing parallelism - Maximizing concurrent execution when possible
  • Job structure - Organizing job steps for efficiency

Performance optimization should be based on measurement rather than assumptions. Always establish baseline metrics before making changes and measure the impact of your optimizations.

Dataset Access Optimization

Dataset access is often the primary performance bottleneck in JCL jobs. Optimizing how data is stored, accessed, and processed can yield significant performance improvements.

Optimal Block Sizes

Block size has a direct impact on I/O efficiency. Larger block sizes generally reduce the number of I/O operations required to process a dataset.

jcl
1
2
3
4
//OUTDD DD DSN=MY.OUTPUT.DATASET, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5),RLSE), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)

Block Size Guidelines:

  • For optimal performance, use half-track or full-track block sizes
  • For 3390 DASD: half-track is 27,998 bytes, full-track is 56,664 bytes
  • For sequential datasets, specify BLKSIZE=0 to use system-determined block size
  • For VSAM, adjust Control Interval size based on access patterns

Buffer Optimization

Increasing the number of buffers can dramatically improve I/O performance by reducing physical I/O operations.

jcl
1
2
3
4
5
6
//INDD DD DSN=MY.LARGE.INPUT.FILE,DISP=SHR, // DCB=(BUFNO=20) // For VSAM files: //VSAMDD DD DSN=MY.VSAM.DATASET,DISP=SHR, // AMP=('BUFND=20,BUFNI=5')

Buffer optimization guidelines:

  • Sequential input: Higher BUFNO (15-30) improves read-ahead processing
  • Sequential output: Moderate BUFNO (5-15) improves write performance
  • VSAM KSDS: Balance BUFND (data) and BUFNI (index) buffers based on access patterns
  • Start with conservative values and increase incrementally while measuring

Important: Increasing buffer counts allocates more memory. Monitor for increased REGION usage when adjusting buffer parameters.

Temporary Datasets

Optimize temporary datasets to minimize I/O and disk space usage:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Passing datasets between steps //STEP1 EXEC PGM=PROGRAM1 //OUTFILE DD DSN=&&TEMP, // DISP=(NEW,PASS,DELETE), // SPACE=(CYL,(10,5),RLSE) //... //STEP2 EXEC PGM=PROGRAM2 //INFILE DD DSN=&&TEMP,DISP=(OLD,DELETE) // Using VIO for small temporary datasets //TEMPDD DD DSN=&&SMALLTEMP, // DISP=(NEW,DELETE), // UNIT=VIO, // SPACE=(TRK,(5,1))

Temporary Dataset Best Practices:

  • Use DISP=PASS to avoid unnecessary writes and reads between steps
  • Consider VIO (Virtual I/O) for small temporary datasets that fit in memory
  • Include RLSE on SPACE parameter to release unused space
  • Use the DELETE disposition to ensure cleanup of unneeded datasets
  • For large temporary datasets, consider compression or sorting to reduce size

SMS Storage Classes

In SMS-managed environments, storage classes can be used to direct datasets to appropriate storage tiers based on performance requirements:

jcl
1
2
3
4
//PERFDD DD DSN=CRITICAL.PERFORMANCE.DATASET, // DISP=(NEW,CATLG,DELETE), // STORCLAS=PERFCLAS, // SPACE=(CYL,(100,50),RLSE)

Work with your storage administrator to understand available storage classes and their characteristics. Some environments may offer:

  • High-performance classes for critical datasets
  • Standard classes for normal workloads
  • Archive classes for less frequently accessed data
  • Special classes with specific optimization features

I/O Operation Minimization

Input/Output operations are typically the most time-consuming aspect of batch processing. Strategic I/O optimization can dramatically improve job performance.

Sequential vs. Random Access

Sequential access is almost always more efficient than random access. Structure your processing to favor sequential operations:

  • Pre-sort data before sequential processing to avoid multiple passes
  • Batch similar operations to reduce random access patterns
  • Use BSAM or QSAM access methods for truly sequential operations
  • Consider EXCP for performance-critical applications with specialized I/O needs

Dataset Compression

Data compression reduces storage requirements and I/O volume, improving performance for I/O-bound jobs:

jcl
1
2
3
4
5
//COMPDD DD DSN=MY.COMPRESSED.DATASET, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(50,10),RLSE), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920), // DATACLAS=COMPRESS

Consider different compression approaches:

  • Hardware compression - Using compression-capable storage devices
  • zEDC compression - IBM z Systems compression acceleration
  • Software compression - Application-level compression
  • SMS compression - Storage management-based compression

Note: Compression trades CPU usage for reduced I/O. For CPU-bound workloads, carefully evaluate if the I/O savings justify the additional processing.

Minimizing Dataset Copies

Avoid unnecessary dataset copies between job steps:

Inefficient Approach:

jcl
1
2
3
4
5
6
7
8
9
//STEP1 EXEC PGM=PROG1 //OUTDD DD DSN=TEMP.FILE1,DISP=(,CATLG) //... //STEP2 EXEC PGM=PROG2 //INDD DD DSN=TEMP.FILE1,DISP=SHR //OUTDD DD DSN=TEMP.FILE2,DISP=(,CATLG) //... //STEP3 EXEC PGM=PROG3 //INDD DD DSN=TEMP.FILE2,DISP=SHR

Optimized Approach:

jcl
1
2
3
4
5
6
7
8
9
//STEP1 EXEC PGM=PROG1 //OUTDD DD DSN=&&TEMP1,DISP=(,PASS) //... //STEP2 EXEC PGM=PROG2 //INDD DD DSN=&&TEMP1,DISP=(OLD,DELETE) //OUTDD DD DSN=&&TEMP2,DISP=(,PASS) //... //STEP3 EXEC PGM=PROG3 //INDD DD DSN=&&TEMP2,DISP=(OLD,DELETE)

Additional techniques for minimizing copies:

  • Use intermediate program memory buffers instead of temporary files when possible
  • Implement multi-function programs that perform multiple operations on data in memory
  • Consider pipes or shared memory for inter-process communication in compatible environments

I/O Optimization for Utilities

Common utilities have specialized parameters for I/O performance:

jcl
1
2
3
4
5
6
7
//SORT EXEC PGM=SORT //SORTIN DD DSN=UNSORTED.FILE,DISP=SHR //SORTOUT DD DSN=SORTED.FILE,DISP=(NEW,CATLG,DELETE) //SYSIN DD * SORT FIELDS=(1,10,CH,A) OPTION EQUALS,FILSZ=E50000000 /*

Key utility optimization techniques:

  • SORT/DFSORT - Use FILSZ to indicate file size, EQUALS for duplicate handling, and specialized SORTWKxx DD statements
  • IDCAMS - Use BUFFERSPACE and appropriate CI/CA settings for VSAM operations
  • DB2 utilities - Leverage SORTNUM, SORTDEVT, and parallelism options
  • FTP/data transfer utilities - Adjust buffer sizes and blocking factors

Memory Usage Optimization

Efficient memory allocation and usage are crucial for job performance. Too little memory can cause abends, while excessive allocation wastes system resources.

REGION Parameter

The REGION parameter controls memory allocation for a job or step:

jcl
1
2
3
4
5
//MYJOB JOB (ACCT),'MY JOB',CLASS=A,REGION=0M // Step-specific REGION allocation //BIGSTEP EXEC PGM=BIGJOB,REGION=256M //SMALLSTEP EXEC PGM=SMALLJOB,REGION=64M

REGION Best Practices:

  • Use REGION=0M to request maximum available memory when exact requirements aren't known
  • For steps with known requirements, specify an appropriate size plus a reasonable buffer
  • Memory allocation below 16MB (legacy) can be specified in K: REGION=4096K
  • Memory allocation above 16MB is specified in M: REGION=256M
  • Monitor step memory usage in job logs to fine-tune allocations

Memory Limits

For applications that use memory above the 2GB bar, consider MEMLIMIT:

jcl
1
2
3
4
5
//BIGJOB JOB (ACCT),'MEMORY INTENSIVE', // CLASS=A,REGION=0M,MEMLIMIT=4G // Step-specific MEMLIMIT //BIGSTEP EXEC PGM=LARGEMEM,MEMLIMIT=8G

MEMLIMIT guidelines:

  • Specify MEMLIMIT on the JOB or EXEC statement for 64-bit applications
  • MEMLIMIT=NOLIMIT allows use of all available virtual storage (use with caution)
  • Many modern utilities and programs support 64-bit addressing
  • MEMLIMIT settings may be limited by system policies

Optimizing Virtual Storage Layout

Advanced memory optimization may involve influencing virtual storage layout:

Memory Layout Considerations:

  • IEFUSI exit - System-level control over region size
  • JCL ORDER parameter - Controls dataset concatenation order
  • STACK and HEAP runtime options - For Language Environment programs
  • DSA (Dynamic Storage Area) settings - For COBOL and other language programs
jcl
1
2
//STEP1 EXEC PGM=MYPROG, // PARM='STACK(128K,128K,ANYWHERE),HEAP(4M,1M,ANYWHERE)'

Monitor job memory usage over time. Application behavior may change with data volume growth or code changes, requiring periodic reassessment of memory allocations.

Virtual I/O (VIO)

VIO can dramatically improve performance for small temporary datasets by keeping them in memory:

jcl
1
2
3
4
//SORTWORK DD DSN=&&TEMP, // UNIT=VIO, // SPACE=(CYL,(5,1)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)

VIO best practices:

  • Use VIO only for small datasets (typically under 100 cylinders, check installation limits)
  • VIO datasets should be relatively short-lived
  • VIO can be less efficient if the system is memory-constrained
  • Work with your systems programmer to understand VIO eligibility and limits

Parallel Execution Techniques

Parallel execution can dramatically reduce elapsed time for complex workloads. Modern mainframe environments offer several approaches to parallelism in JCL.

Multi-Job Parallelism

Breaking a large sequential process into multiple independent jobs allows concurrent execution:

Sequential Approach:

jcl
1
2
3
4
5
//BIGJOB JOB (ACCT),'PROCESS ALL',CLASS=A //STEP1 EXEC PGM=PROCESS //INDD DD DSN=HUGE.INPUT.FILE,DISP=SHR //OUTDD DD DSN=HUGE.OUTPUT.FILE, // DISP=(NEW,CATLG,DELETE)

Parallel Approach:

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
//CTRL JOB (ACCT),'CONTROL JOB',CLASS=A //SPLIT EXEC PGM=FILESPLIT //IN DD DSN=HUGE.INPUT.FILE,DISP=SHR //OUT1 DD DSN=TEMP.PART1,DISP=(,CATLG) //OUT2 DD DSN=TEMP.PART2,DISP=(,CATLG) //OUT3 DD DSN=TEMP.PART3,DISP=(,CATLG) //... //SUBMIT EXEC PGM=IEBGENER //SYSUT1 DD * // PART1 JOB (ACCT),'PROCESS P1',CLASS=A //STEP1 EXEC PGM=PROCESS //INDD DD DSN=TEMP.PART1,DISP=SHR //OUTDD DD DSN=TEMP.OUT1,DISP=(,CATLG) /* //SYSUT2 DD SYSOUT=(A,INTRDR) //... // (Similar SUBMIT steps for PART2, PART3) //... //COMBINE EXEC PGM=APPEND,COND=(0,LT) //IN1 DD DSN=TEMP.OUT1,DISP=SHR //IN2 DD DSN=TEMP.OUT2,DISP=SHR //IN3 DD DSN=TEMP.OUT3,DISP=SHR //OUT DD DSN=HUGE.OUTPUT.FILE, // DISP=(NEW,CATLG,DELETE)

Considerations for job-level parallelism:

  • Ensure data can be processed independently with clean boundaries
  • Consider using job scheduling tools to manage dependencies
  • Include robust error handling for partial failures
  • Monitor system-wide impact, especially for I/O-intensive operations

Within-Job Parallelism

Some JES environments support parallel execution of job steps:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//MYJOB JOB (ACCT),'PARALLEL STEPS',CLASS=A //* //JCLLIB JCLLIB ORDER=SYS1.PROCLIB //* //JOBSET JOBPARM CARDS=YES //* //STEP1A EXEC PGM=PROGRAM1 //... //STEP1B EXEC PGM=PROGRAM2 //* These steps can run in parallel //... //STEP2 EXEC PGM=FINALIZE // IF (STEP1A.RC<=4 & STEP1B.RC<=4) THEN //...

Note: The JOBPARM CARDS=YES option is JES2-specific. Different mainframe environments may have different mechanisms for parallel step execution.

Program-Level Parallelism

Many mainframe utilities and applications support internal parallelism:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//SORT EXEC PGM=SORT //SORTIN DD DSN=HUGE.INPUT.FILE,DISP=SHR //SORTOUT DD DSN=HUGE.OUTPUT.FILE, // DISP=(NEW,CATLG,DELETE) //SYSIN DD * SORT FIELDS=(1,10,CH,A) OPTION EQUALS,DYNALLOC=(SYSDA,8),PARALLEL /* //DB2UTIL EXEC PGM=DSNUTILB,PARM='DB2P,TESTUTIL' //SYSPRINT DD SYSOUT=* //SYSIN DD * RUNSTATS TABLESPACE DB1.TS1 INDEX ALL SHRLEVEL REFERENCE PARALLELISM 4 /*

Common programs with parallel capabilities:

  • DFSORT - Supports parallel sorting with DYNALLOC and PARALLEL options
  • DB2 utilities - Many support PARALLELISM options
  • FDRABR - Supports parallel processing for backups
  • FTP - Can use multiple connections for transfers
  • Custom applications - May support zIIP offload or multiple task processing

Workload Manager (WLM) Considerations

Workload Manager can be leveraged for improved parallel execution:

WLM-Managed Resources:

  • Use appropriate service classes for workload prioritization
  • Consider WLM-managed initiators for balancing concurrent jobs
  • Utilize WLM enclaves for specialized parallel processing
  • Consult your systems programmer for WLM policy optimization

Parallelism introduces complexity in debugging and recovery. Always include robust error handling and ensure you can process partial results in case of failures.

Performance Measurement

Effective measurement is the foundation of all performance optimization. Without measurement, you can't determine if your changes are helping or hurting.

SMF Records

System Management Facilities (SMF) records provide detailed performance metrics:

Key SMF Record Types for JCL Performance:

  • Type 30 - Job/step completion records containing resource usage
  • Type 42 - Data set I/O statistics
  • Type 72-79 - Workload management and resource utilization
  • Type 80-83 - Security and access statistics

SMF records can be analyzed using tools like IBM's MICS, SAS, or custom reporting applications. These tools help extract and compare job performance metrics over time.

Job Log Analysis

Job logs contain valuable performance information that can be analyzed without specialized tools:

text
1
2
3
4
5
6
IEF285I JOB12345 ENDED. NAME-MYJOB TOTAL CPU TIME= 1.083 TOTAL ELAPSED TIME= 15.133 IEF03361 STEP /PROCSTEP /STEP TOTCPU TOTHU VIRT ALLOC BYTES STEP01 / / 0.717 0.717 2048K 500K 12M STEP02 / / 0.366 0.366 4096K 1000K 24M

Key metrics to monitor in job logs:

  • CPU time - Total and per-step CPU consumption
  • Elapsed time - Wall-clock time for job execution
  • Memory usage - Virtual and real storage utilized
  • I/O counts - Number of I/O operations performed
  • EXCPs - Execute Channel Programs (detailed I/O measurement)

Performance Analysis Tools

Several tools can help analyze and optimize JCL performance:

RMF (Resource Measurement Facility)

Provides system-wide performance measurements including CPU, I/O, and memory usage patterns.

SDSF (System Display and Search Facility)

Allows viewing and analysis of job output including resource usage metrics.

Commercial Performance Monitors

Products like IBM Tivoli, BMC MAINVIEW, and CA SYSVIEW provide comprehensive performance monitoring.

Custom Reports

Organizations often develop tailored reporting solutions for specific performance metrics.

Performance Baseline Methodology

Establish a methodical approach to performance measurement:

  1. Establish baseline - Capture current performance metrics
  2. Document environment - Record hardware, software, and system settings
  3. Identify bottlenecks - Determine resource constraints
  4. Implement changes - Make one change at a time
  5. Measure impact - Compare to baseline metrics
  6. Document results - Record improvements or regressions
  7. Repeat - Continue the process for further optimization

For accurate performance comparisons, ensure measurements are taken under similar system load conditions. Measure at both peak and off-peak times to understand performance variability.

Practical Exercises

Practice your JCL performance optimization skills with these exercises:

Exercise 1: Optimize Dataset Access

Review and optimize the following JCL for better I/O performance:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//PERFORM JOB (ACCT#),'PERFORMANCE TEST',CLASS=A, // MSGCLASS=X,NOTIFY=&SYSUID //* //STEP01 EXEC PGM=IEBGENER //SYSUT1 DD DSN=LARGE.INPUT.FILE,DISP=SHR //SYSUT2 DD DSN=LARGE.OUTPUT.FILE, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(1000,100)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //* //STEP02 EXEC PGM=SORT //SORTIN DD DSN=LARGE.OUTPUT.FILE,DISP=SHR //SORTOUT DD DSN=LARGE.SORTED.FILE, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(1000,100)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) //SYSOUT DD SYSOUT=* //SYSIN DD * SORT FIELDS=(1,10,CH,A) /*

Task: Improve this JCL by:

  1. Optimizing block sizes
  2. Adding appropriate buffer parameters
  3. Improving dataset handling between steps
  4. Optimizing SORT parameters

Explain the rationale behind each optimization you make.

Exercise 2: Memory Optimization

Analyze this memory-intensive JCL and suggest improvements:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//BIGMEM JOB (ACCT#),'MEMORY TEST',CLASS=A, // MSGCLASS=X,NOTIFY=&SYSUID,REGION=4M //* //STEP01 EXEC PGM=MEMORYHOG //INPUT DD DSN=HUGE.INPUT.FILE,DISP=SHR //OUTPUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //* //STEP02 EXEC PGM=DATAPROC,REGION=6M //IN DD DSN=HUGE.INPUT.FILE,DISP=SHR //OUT DD DSN=HUGE.OUTPUT.FILE, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(100,10)) //TEMP DD DSN=&&TEMPFILE, // DISP=(NEW,DELETE), // SPACE=(CYL,(50,5)) //SYSPRINT DD SYSOUT=*

Task: Optimize the memory usage by:

  1. Adjusting REGION parameters appropriately
  2. Optimizing temporary dataset usage
  3. Adding any relevant memory-related parameters

Consider both 31-bit and 64-bit addressing options.

Exercise 3: Parallel Processing Design

Design a parallel processing solution for this sequential job:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//SEQJOB JOB (ACCT#),'SEQUENTIAL JOB',CLASS=A //* //STEP01 EXEC PGM=EXTRACT //IN DD DSN=REGION.MASTER.FILE,DISP=SHR //OUT DD DSN=EXTRACTED.DATA, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(200,20)) //* //STEP02 EXEC PGM=TRANSFORM,COND=(0,LT,STEP01) //IN DD DSN=EXTRACTED.DATA,DISP=SHR //OUT DD DSN=TRANSFORMED.DATA, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(250,25)) //* //STEP03 EXEC PGM=ANALYZE,COND=(0,LT,STEP02) //IN DD DSN=TRANSFORMED.DATA,DISP=SHR //REPORT DD DSN=FINAL.REPORT, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5))

Task: Redesign this job to:

  1. Process regional data in parallel
  2. Utilize multi-step parallelism where possible
  3. Implement appropriate synchronization points
  4. Include error handling for partial failures

Draw a diagram of your parallel execution strategy and explain how it improves performance.

Summary

JCL performance optimization is a critical skill for mainframe professionals that can yield significant business benefits through reduced resource usage, faster processing, and improved throughput.

In this tutorial, we covered:

  • Dataset access optimization techniques
  • Strategies for minimizing I/O operations
  • Memory usage optimization approaches
  • Parallel execution techniques
  • Performance measurement methodologies

Remember that performance optimization should always follow these principles:

  • Measure before and after changes to validate improvements
  • Focus on the most significant bottlenecks first
  • Make incremental changes and test thoroughly
  • Consider system-wide impact, not just individual job performance
  • Document optimizations for future reference

Performance optimization is an ongoing process. Regularly review and tune your critical JCL as data volumes grow, processing requirements change, and system environments evolve.

Test Your Knowledge

1. Which JCL parameter helps optimize memory usage for a job step?

  • TIME
  • CLASS
  • REGION
  • PRTY

2. What is the most efficient disposition for temporary datasets that are only needed within a job?

  • DISP=(NEW,CATLG,DELETE)
  • DISP=(NEW,KEEP,DELETE)
  • DISP=(NEW,PASS,DELETE)
  • DISP=(NEW,DELETE,DELETE)

3. Which of these techniques can improve I/O performance in JCL?

  • Using a smaller blocksize for all datasets
  • Specifying a large number of small extents
  • Sorting data before sequential processing
  • Accessing datasets randomly instead of sequentially

4. What is the primary benefit of specifying BUFNO in your JCL?

  • It increases the number of concurrent jobs
  • It optimizes buffer usage for dataset I/O
  • It allocates more CPU resources to your job
  • It reduces the job priority in the system

5. Which technique allows multiple steps to execute simultaneously within a job?

  • MULTISTEP parameter
  • JOBPARM CARDS=YES
  • COND parameter with bypassing
  • EXEC PGM=IEFBR14 with PARALLEL=YES

Frequently Asked Questions