Join two files, replacing file1 values with file2 values



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

Join two files, replacing file1 values with file2 values

Postby krunalbaf » Fri Oct 25, 2013 10:18 pm

Hi Team,
I have two files:
File-1 of length - 260 (key at 209,16)
File-2 of length - 27 (Key at 12,16)
I need to match the files and write the output into a file of length 260 having values copied from file-1 with change:
Position 209 of output file - should have record from file-2 postiion (1,11)
Position 220 of output file - should have 5 spaces
Position 225 of output file - should have record from file-2 postiion (1,11)
Position 236 of output file - should have 5 spaces
Position 241 of output file - should have record from file-2 postiion (12,16)

can you please help how can I have the records in the output file.

Regards,
Krunal Bafna
krunalbaf
 
Posts: 1
Joined: Tue Feb 21, 2012 5:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Join two files, replacing file1 values with file2 values

Postby NicC » Sat Oct 26, 2013 5:38 pm

Is that 12 for 16 (16 bytes) or from 12 to 16 (5 bytes)?
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: Join two files, replacing file1 values with file2 values

Postby dick scherrer » Mon Oct 28, 2013 12:53 am

Hello and welcome to the forum,

Questions like this are better done with some sample input and output that show what you want to do.

These do not need to be full-size records, but enough to show how your rules will change the data. For what you want, you could use samples of less than 80 bytes.
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

Re: Join two files, replacing file1 values with file2 values

Postby BillyBoyo » Mon Oct 28, 2013 1:05 am

As well as what Dick has suggested, you need to confirm that your output will only be for matches on the key.

If this is so, you need to find a JOINKEYS example. If it has a JOIN, remove it (so you only get matches). You need a REFORMAT statement. You can include on that, in the order which you require for output, all the F1 pieces of data, intermingled with the F2 pieces of data. That should nearly do it. Where you need the blanks, just include five bytes from F1 or F2. It doesn't matter what they are, as you will make them blank.

You make them blank in the "Main Task", after the JOINKEYS statements and the REFORMAT.

Use INREC OVERLAY=(pos1,5,C' ',pos2,5,C' ') or however many you want.

Have a go, and let us know if you encounter problems. Show us what you have if you get it working, and we can check it over.
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