How can we accomplish (called as LATERAL I guess)concatenation of files. My scenario is:
file-1, file-2 and file-3 have some data of diff LRECLs and I need to
combine them. Can you pls enlighten me on this. Should I use MERGE or
can SPLICE/DFSORT help. One crude way I have is to have file-1, then file-2 with spaces till LRECL of file-1, file-3 with SPACES for LRECL of file-1+LRECL of file-2. Later concatenate them. I think theres much better way to do it.
Also, can you pls guide me to the useful IBM links where I can learn more about SORT Utils.
As for concatenating files: With SORT or COPY, you can use SORTIN concatenation. If the files have RECFM=VB, you can concatenate them directly even if they have different LRECLs. If the files have RECFM=FB, they can only be concatenated if they all have the same LRECL. So you would have to pad the shorter files out to the length of the longest file before you can concatenate them.
Should I use MERGE
You can only use MERGE if each file is already in the correct sorted order. For MERGE, separate SORTINnn DDs are used rather than concatenation, but the same rules apply for RECFM=VB and RECFM=FB that apply for concatenation.
How exactly you would concatenate the files (using SORT, COPY, MERGE, SPLICE, etc) depends on exactly what you mean by concatenation.
If you give me the specific details of what you want to do (RECFM and LRECL of files, an example of the input and output records, etc), I can show you how to do it.
now after concatenation they are abc12def34ijk56 in a single row (with the new file having LRECL the SUM of LRECL of all the files). assume that RECFM is FB and LRECL is same for all the files. Please suggest the way to do it using a SORT Uitlity.
I hope its made crystal clear now.
My job works fine with the data I used (one 5-byte record in each of three input files and one 15-byte output record) which was based on what you showed me. The byte at position 16 is set up as a blank in all records so they all have the same key to splice on.
If the job doesn't work for you, then something is different on your end. You would need to show me your exact input records, tell me the RECFM and LRECL of your input file, and show me your //TOOLMSG and //DFSMSG output in order for me to help you figure out what's different and what has to be changed. Feel free to e-mail me this information offline (firstname.lastname@example.org). Please put "DFSORT" somewhere in your Subject line to catch my attention.