Merge 2 files with key at different position.



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

Merge 2 files with key at different position.

Postby pawantm » Fri May 27, 2016 8:59 pm

Hi,

I need to merge 2 files into one. Below is the example:

File1:

ABC 123 DEF
ABC 456 DEF
ABC 789 DEF


File2:

ABC DEF 123
ABC DEF 456
ABC DEF 789


OUTPUT File :

ABC 123 DEF
ABC DEF 123
ABC 456 DEF
ABC DEF 456
ABC 789 DEF
ABC DEF 789

Numbers in both the files are key at different position. Key at file 1 start from position 4 and key in file 2 starts from position 9. I have to create a output as illustrated above i.e. file1 record and then file2 record based on keys. Both the files have same no. of records and same keys.
pawantm
 
Posts: 1
Joined: Fri May 27, 2016 8:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Merge 2 files with key at different position.

 

Re: Merge 2 files with key at different position.

Postby BillyBoyo » Sat May 28, 2016 12:39 am

If the two files are in the correct order, a simple MERGE with an INREC to use OVERLAY to extend each record to format the "key" for the MERGE from different locations on the records. If you can uniquely identify from NUMeric, then you can do that.

If you only know from which dataset it is on, then do the same type of thing in the JNFnCNTL files of a JOINKEYS. Here you'd have to handle output processing of any duplicate keys yourself.
BillyBoyo
Global moderator
 
Posts: 3795
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 259 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post