Merge 2 Files.



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

Merge 2 Files.

Postby Vineet » Sat May 02, 2015 12:34 am

Hi All,

I have 2 Sequential Files (File A, File B) both files have LRECL = 131, RECFM = FB. I want to merge both the Files based on 4 Key Fields. In Both the Files Key Fields are @ different Positions so not sure how to Merge. Below is Example.

File A
Date : 41,10,CH,A
Store : 31,9,CH,A
Item : 11,14,CH,A
Indicatore : 26,4,CH,A

File B
Date : 21,10,CH,A
Store : 41,9,CH,A
Item : 31,14,CH,A
Indicatore : 36,4,CH,A

How can I merge both the Files using SORT.

Thanks
Kind Rgd's

Vineet Anand
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: Merge 2 Files.

Postby BillyBoyo » Sat May 02, 2015 12:43 am

Are the keys unique? Within each file and between the files? Is there anything on each record which would indicate which file they came from?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Merge 2 Files.

Postby Vineet » Sun May 03, 2015 9:11 pm

These are the Unique Keys in both the Files & using these keys only we need to write the Record to the O/P file. O/P having attribute LRECL = 131, RECFM=FB.

Thanks
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: Merge 2 Files.

Postby BillyBoyo » Mon May 04, 2015 6:32 pm

If you can't identify which record comes from which file, you can't use MERGE, as the same key would be needed, and you'd not know how to get the correct data into the key for both files.

So, use JOINKEYS. Specify SORTED,NOSEQCK on the JOINKEYS statements. I'd suggest putting something on your output so you could be certain which record is of which type, otherwise you'll just have scrambled your data.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post