Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to merge VSAM files with some conditions using SORT/TOOL
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Thu May 30, 2013 1:24 pm    Post subject: How to merge VSAM files with some conditions using SORT/TOOL
Reply with quote

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
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu May 30, 2013 1:49 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu May 30, 2013 1:58 pm    Post subject: Reply to: How to merge VSAM files with some conditions using
Reply with quote

or try a MERGE application ...
IIRC most/many of the options used for a SORT application also apply to MERGE
Back to top
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Thu May 30, 2013 2:43 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu May 30, 2013 3:38 pm    Post subject: Reply to: How to merge VSAM files with some conditions using
Reply with quote

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
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Thu May 30, 2013 4:34 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu May 30, 2013 4:38 pm    Post subject:
Reply with quote

icon_smile.gif WER is SYNCSORT

and You never did what Enrico suggested
Back to top
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Thu May 30, 2013 4:44 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu May 30, 2013 4:54 pm    Post subject:
Reply with quote

Aplologies I am overseeing things icon_sad.gif

Solution given by Enrico was for DFSORT and not SYNCSORT product

You might need SYNCSORT
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu May 30, 2013 5:18 pm    Post subject: Reply to: How to merge VSAM files with some conditions using
Reply with quote

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
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Thu May 30, 2013 5:40 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu May 30, 2013 6:08 pm    Post subject: Reply to: How to merge VSAM files with some conditions using
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu May 30, 2013 6:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Thu May 30, 2013 6:20 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 30, 2013 9:35 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Mon Jun 03, 2013 4:12 pm    Post subject: Reply to: How to merge VSAM files with some conditions using
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Jun 03, 2013 5:05 pm    Post subject: Reply to: How to merge VSAM files with some conditions using
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Mon Jun 03, 2013 6:13 pm    Post subject:
Reply with quote

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! icon_confused.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Jun 03, 2013 8:26 pm    Post subject: Reply to: How to merge VSAM files with some conditions using
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jun 04, 2013 8:44 pm    Post subject:
Reply with quote

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 . . . icon_confused.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts BWO option in VSAM blayek CICS 3 Sat Nov 05, 2016 10:47 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us