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.
Join Vs Concatenation on VSAM datasets
-
- Posts: 5
- Joined: Tue Feb 14, 2012 3:29 pm
- Skillset: COBOL, JCL, VSAM, DB2
- Referer: Internet
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Join Vs Concatenation on VSAM datasets
Hello and welcome to the forum,
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).
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.How is that VSAM datasets are allowed sorting during JOINKEYS operation, but SORT FIELDS=COPY does not work for concatenation?
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).
Hope this helps,
d.sch.
d.sch.
-
- Posts: 5
- Joined: Tue Feb 14, 2012 3:29 pm
- Skillset: COBOL, JCL, VSAM, DB2
- Referer: Internet
Re: Join Vs Concatenation on VSAM datasets
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).
Which, with just a sort with inputs defined by SORTIN without the use of MULTIIN parm would have thrown me the following error:
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
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).
Code: Select all
//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:
Code: Select all
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
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Join Vs Concatenation on VSAM datasets
Hello,
In the posted step, there is No SORTIN DD statement . . .
There is also no concatenation specified. Are you familiar with concatenation?
In the posted step, there is No SORTIN DD statement . . .
There is also no concatenation specified. Are you familiar with concatenation?
Hope this helps,
d.sch.
d.sch.
-
- Posts: 5
- Joined: Tue Feb 14, 2012 3:29 pm
- Skillset: COBOL, JCL, VSAM, DB2
- Referer: Internet
Re: Join Vs Concatenation on VSAM datasets
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
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
-
- Posts: 5
- Joined: Tue Feb 14, 2012 3:29 pm
- Skillset: COBOL, JCL, VSAM, DB2
- Referer: Internet
Re: Join Vs Concatenation on VSAM datasets
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?
- Akatsukami
- Global moderator
- Posts: 1058
- Joined: Sat Oct 16, 2010 2:31 am
- Skillset: Rexx, JCL, DB2/SQL, TSO/ISPF, PL/I
- Referer: ibmmainframes
- Location: Bloomington, IL
- Contact:
Re: Join Vs Concatenation on VSAM datasets
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.
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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Join Vs Concatenation on VSAM datasets
Hello,
Yup - my bad. I got too hung up on "concatenation" . . .
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.
It may be that Priya-chan and you are talking at cross-purposes, Dick.
Yup - my bad. I got too hung up on "concatenation" . . .

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.
Hope this helps,
d.sch.
d.sch.
-
- Posts: 5
- Joined: Tue Feb 14, 2012 3:29 pm
- Skillset: COBOL, JCL, VSAM, DB2
- Referer: Internet
Re: Join Vs Concatenation on VSAM datasets
Hi..
You are right.. I was just wondering why the below JCL which appends the input flat files would not work for VSAM input files.
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.
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.
Code: Select all
//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.

-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: Join Vs Concatenation on VSAM datasets
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.
-
- Similar Topics
- Replies
- Views
- Last post
-
- 6
- 2357
-
by engh
View the latest post
Wed Sep 04, 2024 7:41 pm
-
- 5
- 4612
-
by arya_starc
View the latest post
Thu Sep 23, 2021 4:37 pm
-
-
Join parts of two records from same file
by Mickes » Thu Apr 27, 2023 3:47 am » in DFSORT/ICETOOL/ICEGENER - 3
- 1227
-
by sergeyken
View the latest post
Sat Apr 29, 2023 1:32 pm
-
-
- 23
- 8093
-
by Devrana
View the latest post
Wed Jul 27, 2022 5:30 pm
-
- 2
- 1427
-
by Robert Sample
View the latest post
Fri Oct 22, 2021 9:41 pm