View previous topic :: View next topic
|
Author |
Message |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Hi,
I have 25 VSAM files with same attributes. As per the layout there are so many record types in each files. I need to extract the particular type from all files and copy into single dataset.
Please share your ideas. I heard with sort card we cannot merge VSAM files. |
|
Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
I think that you misunderstand - you can not concatenate VSAM files so would have to run one SORT extract for each of the 25 VSAM files seperately.
Or maybe use ICETOOL to do it all in one step. |
|
Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10896 Location: italy
|
|
|
|
or try a MERGE application ...
IIRC most/many of the options used for a SORT application also apply to MERGE |
|
Back to top |
|
 |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Hi Expat,
Thanks for yoru reply.
I need that ICETOOL to do it one step..i have the ICETOOL it wil merge all the 25 files and extracting in another step..If posible can you please share the syntax for ICETOOL with merging many files aong with extarct condtion
Thanks. |
|
Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10896 Location: italy
|
|
|
|
You did not give too much to work on...
what about something like
Code: |
****** ***************************** Top of Data ******************************
- - - - - - - - - - - - - - - - - - - 4 Line(s) not Displayed
000005 //S EXEC PGM=SORT
000006 //SYSPRINT DD SYSOUT=*
000007 //SYSOUT DD SYSOUT=*
000008 //SORTIN01 DD DISP=SHR,DSN=VSAM01
000009 //SORTIN02 DD DISP=SHR,DSN=VSAM02
000010 //SORTIN.. DD DISP=SHR,DSN=VSAM..
000011 //SORTIN.. DD DISP=SHR,DSN=VSAM..
000012 //SORTIN.. DD DISP=SHR,DSN=VSAM..
000013 //SORTINXX DD DISP=SHR,DSN=VSAMXX
000014 //SORTOUT DD ...
000015 //SYSIN DD *
000016 MERGE FIELDS=.....
000017 INCLUDE COND=(...........)
****** **************************** Bottom of Data **************************** |
tested and working |
|
Back to top |
|
 |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Hi Enrico,
Please correct my JCL. I am getting the belwo error,
Code: |
//STEP010 EXEC PGM=SORT
//SORTIN DD DSN=file1,DISP=SHR
// DD DSN=file2,DISP=SHR
// DD DSN=file3,DISP=SHR
.
.
..
// DD DSN=file24,DISP=SHR
// DD DSN=file25,DISP=SHR
//SORTOUT DD DSN=outfile1,
// DISP=OLD
//SYSIN DD *
MERGE FIELDS=COPY
INCLUDE COND=(1,2,PD,EQ,40,AND,10,3,PD,LT,13001,AND,
43,2,CH,NE,C'008',AND,43,2,CH,NE,C'017',AND,
69,1,CH,EQ,C'S',OR,69,1,CH,EQ,C'Y',AND,
183,1,CH,NE,C'I',AND,183,1,CH,NE,C'T')
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
|
error
Code: |
SYSIN :
MERGE FIELDS=COPY 0081920
INCLUDE COND=(1,2,PD,EQ,40,AND,10,3,PD,LT,13001,AND, 0081930
43,2,CH,NE,C'008',AND,43,2,CH,NE,C'017',AND, 0081940
69,1,CH,EQ,C'S',OR,69,1,CH,EQ,C'Y',AND, 0081950
183,1,CH,NE,C'I',AND,183,1,CH,NE,C'T') 0081960
WER276B SYSDIAG= 506357, 6250134, 6250134, 6195225
WER164B 6,896K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 1,004K BYTES USED
WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER254A SORTIN VSAM OPEN ERROR -- BC
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
|
If i give numbering for SORTIN, i am getting E1 8 DSS20011E DD 'SORTIN' WAS NOT ALLOCATED. |
|
Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
WER is SYNCSORT
and You never did what Enrico suggested |
|
Back to top |
|
 |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Quote: |
and You never did what Enrico suggested
|
I hope you won't say like this after once you read my post clearly. |
|
Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Aplologies I am overseeing things
Solution given by Enrico was for DFSORT and not SYNCSORT product
You might need SYNCSORT |
|
Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10896 Location: italy
|
|
|
|
Quote: |
I hope you won't say like this after once you read my post clearly. |
unfortunately I have to shatter your hopes,
Your jcl does not have any relation with what I have posted .
and I do not think that MERGE FIELDS=COPY is a reasonable control card
start with something simpler like
Code: |
****** ***************************** Top of Data ******************************
- - - - - - - - - - - - - - - - - - - 4 Line(s) not Displayed
000005 //ICE EXEC PGM=SORT
000006 //SORTLIB DD DISP=SHR,DSN=SYS1.SORTLIB
000007 //SYSPRINT DD SYSOUT=*
000008 //SYSOUT DD SYSOUT=*
000009 //SORTIN01 DD *
000010 1
000011 3
000012 5
000013 7
000014 9
000015 //SORTIN02 DD *
000016 0
000017 2
000018 4
000019 6
000020 8
000021 //SORTOUT DD SYSOUT=*,
000022 // DCB=(RECFM=FB,LRECL=80)
000023 //SYSIN DD *
000024 MERGE FIELDS=(1,1,ZD,A)
000025 INCLUDE COND=(1,1,ZD,GE,5)
****** **************************** Bottom of Data ****************************
|
and in a couple of steps You will get the results You ask for |
|
Back to top |
|
 |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Hi Enric,
I read the below in DFSORT programming guide
[img]
Example 4
MERGE FIELDS=COPY
FIELDS
The input data set is copied to output. No merge takes place.
MERGE Control Statement
Chapter 3. Using DFSORT Program Control Statements 167[/img]
In my case, the input files having the below
Organization: ESDS
KSDS key length: 0
KSDS key location: 0
Average record size: 3000
Maximum record size: 10000
Please tel me in this case how the merge fields should be given since its a VB. |
|
Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10896 Location: italy
|
|
|
|
unfortunately the DFSORT documentation in this case is not clear enough ..
MERGE FIELDS=COPY
behaves as
SORT FILEDS=COPY
and wants it input on SORTIN
( tested )
do You have a reasonable sequence key for Your records |
|
Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
You need to read the SYNCSORT guide rather than the DFSORT guide.
The product that you are using is SYNCSORT NOT DFSORT
There may well be many differences |
|
Back to top |
|
 |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Quote: |
do You have a reasonable sequence key for Your records
|
Since its an ESDS ti wont be in sequence based on key fields. But we have key starts from 17 position to 48th position 32 length...also since its an VB file we need to add 4 bytes to get correct length. Here i mentioned without adding those 4 bytes. |
|
Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello
If my understanding of what you have and want to do is correct, one way would be to extract the needed data from each file, sort it by the "merge key(s)", and then merge the selected data as needed.
There is often a desire (by someone - doesn't really matter who) to do "something" in one step. There is neither business nor technical Need to do this. . . |
|
Back to top |
|
 |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Quote: |
If my understanding of what you have and want to do is correct, one way would be to extract the needed data from each file, sort it by the "merge key(s)", and then merge the selected data as needed.
|
Yes you correct Dick, but i said there are 25 files. So we need 25 similar steps with different files as input. I don't think your idea won't suite for effective coding. Instead if we know the merging logic of VSAM files we can Merge in single step and extract the records it in another step or same step if feasible. |
|
Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I think you need to contact SyncSort. They have a software update which allows multiple VSAM files to be specified as input to a SORT.
Your other possibility is to write an "EXIT" program, which can be in Cobol, which will read the 25 VSAM files passing the data records one-at-a-time back to SORT to represent a single input file which can then be SORTed and have other processing applied to it.
Short of either of these, you are looking at the 25 copies to "flat" files and concatenating to SORTIN. |
|
Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
enrico had already posted a tested and working approach of MERGEing on keys and keeping the VSAM file as output. If the order of output records is not a matter of concern, would it not be enough to MERGE on an arbitrary key field and write into output. Is there a problem the OP cannot follow the same approach?
Am I missing something!  |
|
Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I may have read too much into the data having a "key" but not being in key order.
The MERGE FIELDS=COPY can only process multiple files using concatenation. VSAM can't be (normally) concatenated.
INREC could be used to generate a sequence number, and that sequence number could be used as the MERGE key.
With the software patch I'm not sure how SORT FIELDS=COPY would be processed. |
|
Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I don't think your idea won't suite for effective coding. |
What might you mean by "effective"? Just that with the suggestion there would be multiple sort steps?
It would take less than 1/2 an hour to copy a working "step" 24 times. . . Then one step for the merge. Pretty simple actually and is easily maintained. This is a holdover from wanting on ly 1 step . . .  |
|
Back to top |
|
 |
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Quote: |
This is a holdover from wanting on ly 1 step . . . |
Agree. Multiple steps oftentimes can be more readily understood and maintained than a single step. |
|
Back to top |
|
 |
|
|