Page 1 of 1

Concatenate datasets

PostPosted: Sun Jan 05, 2014 1:04 am
by kartheeswaran
How to concatenate 2 dataset and write one dataset in jcl?

Title fixed

Re: concate dataset

PostPosted: Sun Jan 05, 2014 2:14 am
by Robert Sample
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:
//IN1 DD DISP=SHR,DSN=X
//    DD DISP=SHR,DSN=Y
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?

Re: concate dataset

PostPosted: Sun Jan 05, 2014 2:56 am
by dick scherrer
Hello,

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.

Re: Concatenate datasets

PostPosted: Sun Jan 05, 2014 7:05 am
by steve-myers
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  *
BLAH
BLAH
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.