I am hoping that the requirement is easily understandable from the above screen.
All the files are PS, FB, and LRECL=80. Both input files have equal record counts.
I am aware that we can write one by one line from both files using sequence numbers.
The idea is
File-1 : Add odd numbers at the end. ==> 1,3,5 ==> SEQNUM start from 1, increment by 2
File-2 : Add even numbers at the end. ==> 2,4,6 ==> SEQNUM start from 2, increment by 2
Now merge both files using the ascending order of sequence numbers so that line by line would be copied from both files. (SEQNO 1,2,3,4,5,6)
I don't know how to write the code for this step.
Step-2:
I have the separator line logic (80-hyphens line after every two records). The tested code is
********************************* TOP OF DATA *********************
Line-F1L1
Line-F2L1
---------------------------------------------------
Line-F1L2
Line-F2L2
---------------------------------------------------
Line-F1L3
Line-F2L3
---------------------------------------------------
Line-F1L4
Line-F2L4
---------------------------------------------------
Line-F1L5
Line-F2L5
---------------------------------------------------
******************************** BOTTOM OF DATA *******************
Joined: 15 Aug 2015 Posts: 1334 Location: Bamberg, Germany
The advantage of the JOINKEYS is, that it is more understandable. Disadvantage, it requires temporary duplicate LRECL. The underestimated MERGE operator would here perform better, IMHO.
The advantage of the JOINKEYS is, that it is more understandable. Disadvantage, it requires temporary duplicate LRECL.
AFAIK, JFN1CNTL is handled by SORT "on the fly" - every single record is extended before it is joined. No duplicated copy of the whole input is created.