Concatenate datasets

JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Concatenate datasets

Postby kartheeswaran » Sun Jan 05, 2014 1:04 am

How to concatenate 2 dataset and write one dataset in jcl?

Title fixed
Posts: 10
Joined: Fri Dec 27, 2013 12:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: concate dataset

Postby Robert Sample » Sun Jan 05, 2014 2:14 am

Note that your post title references a word that does not exist in English ("concate"). Your post properly uses "concatenate" but the title is misleading since it is not in English.

If the data sets have compatible DCB information (same LRECL, same RECFM) you merely place one after the other in the JCL:
If the data sets do not have compatible DCB information (different LRECL), then generally the only time concatenation will work is if they both are variable-length data sets. If you want to concatenate a variable-length data set and a fixed-length data set -- this will not work.

And your post is not clear -- are you wanting to have two data sets concatenated as input and generate one output data set, or do you mean something else?
Robert Sample
Global moderator
Posts: 3716
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 278 times

Re: concate dataset

Postby dick scherrer » Sun Jan 05, 2014 2:56 am


Show a bit of sample data for the 2 input files and what output you want from that sample input.

Use the code tag to preserve alignment and improve readability.
Hope this helps,
User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Concatenate datasets

Postby steve-myers » Sun Jan 05, 2014 7:05 am

kartheeswaran wrote:How to concatenate 2 dataset and write one dataset in jcl?

You are actually making 2 queries here
  • How do you specify that 2 data sets are concatenated in JCL.
  • How do I copy these data sets.
Mr. Sample's example is one way to perform the first query.

Generally speaking, you cannot use the concatenation unless the DCB attributes of the two data sets are similar. By "similar" I mean
  • The record type in the RECFM attribute is the same. The "record type" is the F, V or U attribute in the record format.
  • When the "record type" is F, the value of the logical record length must be the same.
  • The two data sets must be on the same class of device. In other words, all the data sets in the concatenation must be on disk or all the data sets must be on tape.
Properly written Assembler programs are not bound by these restrictions, but they are rare. Quite often you will see JCL like this used for the Linkage Editor or Binder.
//SYSLIN  DD   ...,a disk data set
//        DD  *
This is an example of "unlike" concatenation. The Linkage Editor and Binder programs have be written to handle this, but most programs will fail when trying to read this concatenation.

Another type of concatenation is PDS concatenation, when two PDS data sets are specified without using member names. You will often see this used with compilers and the Linkage Editor and Binder. There used to be a restriction that the data set with the largest BLKSIXE had to be specified first in this type of concatenation. This restriction was removed many years ago, though you still see JCL like this
//xxx     DD  ...,DSN=a.PDS,DCB=BLKSIZE=32720
//        DD  ...,DSN=another.PDS

The DCB parameter in the first DD statement is no longer necessary.
Global moderator
Posts: 2106
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Return to JCL


  • Related topics
    Last post