Page 1 of 1

Combining 4 files in sort

PostPosted: Wed Apr 06, 2016 11:24 pm
by shankar13288
Hi,

I have four input files and have to combine all the four files. below is the sample. Please let me know if its possible through sort.

Input:
File 1
111 aaa
222 bbb

File 2
111 ccc
222 ddd
333 eee

File 3
111 aaa
333 fff
444 ggg

File 4
111 hhh
555 iii


Output:
111 aaa ccc aaa hhh
222 bbb ddd        
333       eee fff
444             ggg
555                    iii

Re: Combining 4 files in sort

PostPosted: Thu Apr 07, 2016 2:51 pm
by Aki88
Hello,

This is a repeated query and there are many examples available for it on the forum/web; I did a quick Google search for 'Combining multiple records in DFSORT' which is what you're primarily trying to achieve; the first few results returned by the search give detailed explanation of what you want.

Look at the said examples and the Smart DFSORT Tricks manual; try coding the SORT card; if it doesn't give you the expected result show us what you've tried and someone might be able to guide you.

Re: Combining 4 files in sort

PostPosted: Thu Apr 07, 2016 2:54 pm
by NicC
Please use the code tags to present your data, code, screen shots or anything else requiring a fixed pitch font. As you keyed your post ypu output looks like this:
111 aaa ccc aaa hhh
222 bbb ddd
333 eee fff
444 ggg
555 iii

instead of like this:
111 aaa ccc aaa hhh
222 bbb ddd        
333       eee fff
444             ggg
555                    iii


RECFM of each input dataset (they are not files), LRECL, key position and length. LRECL and RECFM of the output dataset. Will there ever be duplicate keys on the input datasets - if so, how are they dealt with?

Also, do your homework first on any forum - the search facility is there to be used, not just take up screen real-estate. Also, as pointed out by Aki88 - use google.