Imran Lamba,
I think You missed my second solution. I would prefer second solution because it just do a copy and no sorting.
Still if you prefer my first solution, On sort fields, please add EQUALS to preserve the order of the same key, because DFSORT comes with EQUALS=NO by default.
Also you have to consider what happen if you have different number of records, Say first file is having 3 records and second file is having 4 records.
Second solution will fails, if you have difference in number of records, because you dont have a matching record. You can make second solution work by handling
Code: Select all
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OUTFIL IFTHEN=(WHEN=(161,1,CH,EQ,C'B'),BUILD=(1,80,/,81,80)),
IFTHEN=(WHEN=(161,1,CH,EQ,C'1'),BUILD=(1,80)),
IFTHEN=(WHEN=NONE,BUILD=(81,80))