Merging of VSAM files



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Merging of VSAM files

Postby ajuatsgp » Thu Aug 19, 2010 2:23 pm

Can I merge two VSAM files? These files can have duplicates. I Can copy the vsam files to two sequentials files merge them with SUM FIELDS=NONE, then copy the output seq file to a VSAM file.

But Can I merge the two VSAM files in one single step?
ajuatsgp
 
Posts: 82
Joined: Thu May 20, 2010 6:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging of VSAM files

Postby MrSpock » Thu Aug 19, 2010 2:45 pm

According to the DFSORT Application Programming Guide comments for Merging Records:

1.8.2 Merging Records

Input to a merge application can be up to 100 blocked or unblocked QSAM or VSAM data sets containing fixed- or variable-length records. The input data sets can be either QSAM or VSAM, but not both. The records in all input data sets must already be sorted in the same order as that required for output.

Output from a merge application can be blocked or unblocked QSAM or VSAM data sets, regardless of whether the input is QSAM or VSAM. Unless OUTFIL is used to convert variable input to fixed output, or fixed output to variable output, an output data set must be the same type (fixed or variable) as the input data set.
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: Merging of VSAM files

Postby Frank Yaeger » Thu Aug 19, 2010 10:31 pm

ajuatsgp,

If each VSAM file is already sorted by the same key(s), you can use a DFSORT MERGE application to merge them like so:

//MRG EXEC PGM=SORT                                               
//SYSOUT DD SYSOUT=*                                             
//SORTIN01 DD DSN=...  VSAM input file1 (sorted)
//SORTIN02 DD DSN=...  VSAM input file2 (sorted)                                                   
//SORTOUT DD DSN=...   VSAM output file
//SYSIN DD *                                                     
  RECORD TYPE=F
  OPTION EQUALS
  MERGE FIELDS=(...)
  SUM FIELDS=NONE
/*             


I'm assuming you can treat each VSAM file as fixed-length. If not, you'd need to use RECORD TYPE=V and add 4 to the starting position of the MERGE field.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Merging of VSAM files

Postby ajuatsgp » Fri Aug 20, 2010 1:06 pm

Hi,

what about the duplicates records.Will they be handeled???
ajuatsgp
 
Posts: 82
Joined: Thu May 20, 2010 6:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merging of VSAM files

Postby Frank Yaeger » Fri Aug 20, 2010 8:52 pm

Oh, I forgot you wanted that. To eliminate duplicates, add:

   SUM FIELDS=NONE


I changed the job above to include that and OPTION EQUALS.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Merging of VSAM files

Postby cvrupesh » Thu Oct 07, 2010 8:53 pm

I believe one can use ELIMIT(200) in IDCAMS itself if you know the approximate duplicate counts.
Thanks Always,
-Rupesh.
cvrupesh
 
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: Merging of VSAM files

Postby cvrupesh » Thu Oct 07, 2010 8:54 pm

In the example I have given by specifying ELIMIT(200) your IDCAMS can ignore as far as you have 199 duplicates and copy the data to output.
Thanks Always,
-Rupesh.
cvrupesh
 
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: Merging of VSAM files

Postby NicC » Thu Oct 07, 2010 9:08 pm

How about the merging though?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Merging of VSAM files

Postby cvrupesh » Tue Oct 12, 2010 3:40 pm

I hope once duplicates are eliminated, merging should not be a challenge. I just thought to reminding usage of ELIMIT in VSAM's.
Thanks Always,
-Rupesh.
cvrupesh
 
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: Merging of VSAM files

Postby dick scherrer » Tue Oct 12, 2010 11:18 pm

Hello,

Please do not post IDCAMS suggestions in the DFSORT part of the forum. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post