Concatenation

Purpose

Dataset concatenation in JCL allows multiple datasets to be treated as a single logical dataset during job execution. This powerful technique enables programs to process data from multiple sources without requiring modification to handle multiple inputs.

Key Benefit:

Concatenation simplifies data processing by combining multiple input sources, such as libraries, data files, or temporary datasets, allowing programs to access them sequentially as if they were a single dataset.

Basic Syntax

To concatenate datasets, omit the DD statement name for all datasets after the first one:

jcl
1
2
3
4
5
6
//ddname DD DSN=dataset1.name, // DISP=SHR // DD DSN=dataset2.name, // DISP=SHR // DD DSN=dataset3.name, // DISP=SHR

The system processes these datasets in the order they appear, creating a virtual combined dataset.

Types of Concatenation

TypeDescriptionUsage
Sequential Dataset ConcatenationCombining multiple sequential datasetsProcessing sequential input files or logs in a specific order
Library ConcatenationCombining multiple partitioned datasets (PDS/PDSE)Creating search paths for program libraries, JCL procedures, or copybooks
Mixed ConcatenationCombining different types of datasets (requires compatible attributes)Special-case processing where different types of data must be combined
In-stream and Dataset ConcatenationCombining in-stream data with cataloged datasetsAdding job-specific control statements or data to standard input files

Concatenation Rules and Requirements

Sequential Dataset Concatenation

  • Attributes: Datasets should have compatible DCB attributes (RECFM, LRECL, BLKSIZE)
    • For fixed-length records, all datasets must have the same LRECL
    • For variable-length records, later datasets can have smaller LRECL than the first, but not larger
  • Processing Order: Datasets are processed in the order specified in the JCL
  • End-of-File: When the system reaches the end of a dataset, it automatically opens the next dataset in the concatenation
  • Access Method: Works with all sequential access methods (QSAM, BSAM, BPAM)

Library Concatenation

  • Member Resolution: The system searches libraries in the order specified until it finds the requested member
  • Directory Processing: For directory searches, each PDS directory is searched in the specified order
  • Attributes: Libraries should have compatible attributes
    • For load libraries (RECFM=U), all datasets should be load libraries
    • For source libraries, consistent LRECL is recommended
  • Common Usage: STEPLIB, JOBLIB, SYSLIB, SYSPROC concatenations

Limitations and Special Cases

  • VSAM Datasets: Cannot be concatenated with non-VSAM datasets
  • Backwards References: Concatenated datasets cannot include backward references (*.ddname)
  • DISP=MOD: Not meaningful for datasets after the first one in concatenation
  • Checkpoint/Restart: May not work correctly with checkpoint/restart processing
  • System Determined Blocksize (SDB): Uses the first dataset's blocksize for system-determined calculations

Common Usage Examples

STEPLIB Concatenation

jcl
1
2
3
4
5
6
7
//STEP1 EXEC PGM=MYPGM //STEPLIB DD DSN=USER.PRIVATE.LOADLIB, // DISP=SHR // DD DSN=PROJECT.LOADLIB, // DISP=SHR // DD DSN=SYS1.LINKLIB, // DISP=SHR

This example sets up a search path for executable modules. The system first searches USER.PRIVATE.LOADLIB, then PROJECT.LOADLIB, and finally SYS1.LINKLIB.

Input Data Concatenation

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//STEP2 EXEC PGM=SORT //SORTIN DD DSN=USER.DATA.JAN, // DISP=SHR // DD DSN=USER.DATA.FEB, // DISP=SHR // DD DSN=USER.DATA.MAR, // DISP=SHR //SORTOUT DD DSN=USER.DATA.Q1, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920) //SYSIN DD * SORT FIELDS=(1,10,CH,A) /*

This example concatenates three monthly datasets as input to a sort job, producing a combined quarterly dataset.

SYSLIB Concatenation for Compilers

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//COBCOMP EXEC PGM=IGYCRCTL //SYSLIB DD DSN=USER.COPYLIB, // DISP=SHR // DD DSN=PROJECT.COPYLIB, // DISP=SHR // DD DSN=SYS1.COBLIB, // DISP=SHR //SYSIN DD DSN=USER.COBOL.SOURCE(PROGRAM1), // DISP=SHR //SYSLIN DD DSN=&&OBJMOD, // DISP=(NEW,PASS), // SPACE=(TRK,(5,5)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200) //SYSPRINT DD SYSOUT=*

This example shows a COBOL compiler with a concatenated SYSLIB for copybook resolution. When the program includes a copybook, the system searches each library in order until it finds the member.

Mixed Source Concatenation

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//STEP4 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD * These are initial control records. /* // DD DSN=USER.CONTROL.DATASET, // DISP=SHR // DD * These are final control records. /* //SYSUT2 DD DSN=USER.COMBINED.CONTROL, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)

This example combines in-stream data with a cataloged dataset to create a custom control file. This technique allows job-specific data to be combined with standard data.

Performance Considerations

FactorImpactRecommendation
Order of ConcatenationAffects search speed for librariesPlace most frequently accessed libraries first in the concatenation
Number of DatasetsLarge numbers of concatenated datasets increase system overheadLimit concatenation to a reasonable number of datasets (generally under 16)
Buffer AllocationSystem allocates buffers based on the first datasetPlace the dataset with optimal DCB attributes first
Dataset LocationAccessing datasets on different volumes adds I/O overheadWhen possible, keep concatenated datasets on the same volume

Common Issues and Troubleshooting

IssuePossible CausesSolutions
ABEND013-4CDCB attribute conflict between concatenated datasets
  • Ensure LRECL values are compatible
  • For variable length records, ensure largest LRECL is first
  • Ensure all datasets have compatible RECFM
Member not foundMember exists but in a library later in the concatenation with duplicate names earlier
  • Check for duplicate member names in concatenated libraries
  • Reorder libraries to prioritize the correct version
S806-4 (Module not found)Load module not in concatenated libraries
  • Verify module name and spelling
  • Check appropriate libraries are included
  • Check library order
Unexpected data processingData processed in incorrect order
  • Verify concatenation order matches intended processing sequence
  • Check for empty datasets that might be skipped

Special Concatenation Cases

Unlike Attributes Concatenation

In some cases, you can concatenate datasets with unlike attributes by using special DCB parameters:

jcl
1
2
3
4
//INPUT DD DSN=LARGE.RECORDS,DISP=SHR, // DCB=(RECFM=VB,LRECL=8000) // DD DSN=SMALL.RECORDS,DISP=SHR, // DCB=(RECFM=VB,LRECL=100)

In this example, even though SMALL.RECORDS has smaller records than LARGE.RECORDS, the DCB parameter on the second DD statement ensures the system knows how to handle the transition.

Temporary and Permanent Dataset Concatenation

jcl
1
2
//INPUT DD DSN=&&TEMPDATA,DISP=(OLD,DELETE) // DD DSN=PERMANENT.DATA,DISP=SHR

This example shows concatenation of a temporary dataset (created in a previous step) with a permanent dataset.

Conditional Concatenation

You can use symbolic parameters to conditionally include datasets in a concatenation:

jcl
1
2
3
4
5
6
7
8
//PROCSTEP PROC ENV=PROD //SYSLIB DD DSN=SYS1.MACLIB,DISP=SHR // DD DSN=SYS1.MODGEN,DISP=SHR // DD DSN=USER.MACLIB,DISP=SHR //* // IF &ENV = TEST THEN //TESTLIB DD DSN=TEST.MACLIB,DISP=SHR // ENDIF

In this example, TEST.MACLIB is only included in the concatenation when the procedure is called with ENV=TEST.

Best Practices

  1. Order Matters: Place the most frequently accessed datasets first in library concatenations to improve performance.
  2. Maintain Compatible Attributes: Ensure concatenated datasets have compatible DCB attributes to avoid processing errors.
  3. Document Purpose: Add comments to explain the purpose of complex concatenations for maintainability.
  4. Limit Concatenation Size: Keep the number of concatenated datasets reasonable to minimize overhead.
  5. Be Aware of Search Order: Remember that for libraries, the first occurrence of a member is used, which can lead to subtle bugs if newer versions appear later in the concatenation.
  6. Consider Using Path Libraries: For modern z/OS, consider using PATH concatenations for Unix file system libraries when appropriate.
  7. Use System Symbolics: Leverage system symbolics for flexible concatenations that adapt to different environments.
  8. Check for Empty Datasets: Be aware that empty datasets in a concatenation are simply skipped without error.

JES2 vs JES3 Considerations

Dataset concatenation behavior is generally the same in both JES2 and JES3 environments, but there are some considerations:

FeatureJES2JES3
Dataset allocationAll datasets in concatenation are allocated at step execution timeCan pre-allocate datasets in concatenation during setup phase
SYSIN DD * concatenationStandard behaviorEnhanced options with JES3 control statements

Related Concepts