Page 1 of 1

Join Vs Concatenation on VSAM datasets

PostPosted: Thu Jun 06, 2013 5:41 pm
by Shakthi_Priya_R
Hi,

Can anybody please calrify me.

How is that VSAM datasets are allowed sorting during JOINKEYS operation, but SORT FIELDS=COPY does not work for concatenation?

(Though MERGE FIELDS option and MULTIIN facility allows the concatenation)?

Hoping I made my doubt clear, thanks in advance.

Re: Join Vs Concatenation on VSAM datasets

PostPosted: Thu Jun 06, 2013 7:16 pm
by dick scherrer
Hello and welcome to the forum,

How is that VSAM datasets are allowed sorting during JOINKEYS operation, but SORT FIELDS=COPY does not work for concatenation?
Not making fun, but this is like asking why the steering wheel on your vehicle cannot be used as a spare tire . . . They are unrelated.

JOINKEYS provides the ability to sort data if needed. COPY does just that - it copies data.

VSAM files do not concatenate as far as know.

Suggest you explain what you have (with some sample input data) and what you want your process to do with this data (show the desired output when the sample data is processed. Also, mention the recfm and larecl(s).

Re: Join Vs Concatenation on VSAM datasets

PostPosted: Thu Jun 06, 2013 7:39 pm
by Shakthi_Priya_R
Hi Dick,
Good Morning.
According to the SYNCSORT FOR Z/OS 1.4.1,
The following piece of code concatenates the three input files(VSAM+non VSAM files).


//STEP1 EXEC PGM=SYNCSORT,PARM=MULTIIN               
//SYSPRINT DD SYSOUT=*                               
//SYSOUT   DD SYSOUT=*                               
//SORTMI1 DD DSN=INPUT1,DISP=SHR          * VSAM     
//SORTMI2 DD DSN=INPUT2,DISP=SHR          * VSAM     
//SORTMI3 DD DSN=INPUT3,DISP=SHR          * Flat file
//SORTOUT  DD DSN=OUTPUT1,                           
//             DISP=(NEW,CATLG,DELETE),               
//             .....                                 
//SYSIN DD *                                         
   SORT FIELDS=(1,12,CH,A)                                   
/*                                                   


Which, with just a sort with inputs defined by SORTIN without the use of MULTIIN parm would have thrown me the following error:
WER254A  SORTIN   VSAM OPEN ERROR  -- BC


I am just intrigued to know why this cannot be accomplised by just SORT FIELDS statement (not just SORT FIELDS=COPY), as JOINKEYS also does some kind of sorting.

Thanks

Re: Join Vs Concatenation on VSAM datasets

PostPosted: Thu Jun 06, 2013 7:56 pm
by dick scherrer
Hello,

In the posted step, there is No SORTIN DD statement . . .

There is also no concatenation specified. Are you familiar with concatenation?

Re: Join Vs Concatenation on VSAM datasets

PostPosted: Thu Jun 06, 2013 8:04 pm
by Shakthi_Priya_R
Hi,
SORTMInn replaces the SORTIN DD which is the whole point here. MULTIIN parm along with SORTMInn is what facilitates the concatenation(or appending) here. I get all the records from all the 3 inputs into the output.

My doubt is that if SORT FIELDS with SORTIN DD does not work on VSAM datasets, JOINKEYS should not work on VSAM datasets as well, as it sorts data. Do I make sense? I am sorry, if not!

Thanks

Re: Join Vs Concatenation on VSAM datasets

PostPosted: Thu Jun 06, 2013 8:07 pm
by Shakthi_Priya_R
Or is it like, in JOINKEYS the records are joined and VSAM datasets no more come into the picture after join is done and sort is done after that?

Re: Join Vs Concatenation on VSAM datasets

PostPosted: Thu Jun 06, 2013 8:13 pm
by Akatsukami
It may be that Priya-chan and you are talking at cross-purposes, Dick.

She seems to be claiming that Syncsort can be given a MULTIIN parameter which causes it to use SORTMIn DD statements, with one data set per statement, instead of a single SORTIN with concatenated data sets, and wonders why this cannot simply be done by concatenating the data sets.

The reason is, Priya-chan, as Mr. Scherrer says: you cannot concatenate VSAM data sets. Syncsort is here doing a sort of "pseudo-concatention" in which data sets are dynamically allocated and read beginning-to-end individually; the accumulated records are stored in a temporary PS data set and treated as such.

Re: Join Vs Concatenation on VSAM datasets

PostPosted: Thu Jun 06, 2013 9:03 pm
by dick scherrer
Hello,

It may be that Priya-chan and you are talking at cross-purposes, Dick.

Yup - my bad. I got too hung up on "concatenation" . . . :oops:

My doubt is that if SORT FIELDS with SORTIN DD does not work on VSAM datasets,

SORT FIELDS Does work with VSAM datasets . . . We use this a LOT, but have not needed the MULTIIN feature (yet?).

It will probably help if you post the complete diagnostic / informational messages generated by the problem run.

Re: Join Vs Concatenation on VSAM datasets

PostPosted: Fri Jun 07, 2013 10:56 am
by Shakthi_Priya_R
Hi..
She seems to be claiming that Syncsort can be given a MULTIIN parameter which causes it to use SORTMIn DD statements, with one data set per statement, instead of a single SORTIN with concatenated data sets, and wonders why this cannot simply be done by concatenating the data sets.

You are right.. I was just wondering why the below JCL which appends the input flat files would not work for VSAM input files.
//STEP1 EXEC PGM=SORT             
//SYSPRINT DD SYSOUT=*           
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD DSN=INPUT1,DISP=SHR
//         DD DSN=INPUT2,DISP=SHR
//SORTOUT  DD SYSOUT=*           
//SYSIN DD *                     
   SORT FIELDS=(1,4,CH,A)               
/*                               

SORT FIELDS Does work with VSAM datasets . . . We use this a LOT, but have not needed the MULTIIN feature (yet?).

I agree. SORT FIELDS does sort a VSAM file. I was just curious why the concatenation aided by SORT does not work on VSAM files.
Ok.. So finally, VSAM files cannot be concatenated using SORT. :)

Thanks Dick and Akatsukami. :)

Re: Join Vs Concatenation on VSAM datasets

PostPosted: Fri Jun 07, 2013 11:53 am
by BillyBoyo
Generally, VSAM files cannot be concatenated by anything. You may find products which have been coded very deliberately to allow this, like SAS, but unless the documentation for a product specfically says you can do it, you can't.