SORT FIELDS=COPY
JOINKEYS FILE=F1,FIELDS=(01,16,A)
JOINKEYS FILE=F2,FIELDS=(22,16,A)
JOIN UNPAIRED F1,F2 <== NON MATCHES FROM BOTH FILES
REFORMAT FIELDS=(F1:01,80,F2:1,320,?)
OUTFIL FNAMES=SORTOF01,INCLUDE=(401,1,CH,EQ,C'B'), <==MATCH
BUILD=(38,9,12X,102,16,118,283)
OUTFIL FNAMES=SORTOF02,INCLUDE=(401,1,CH,EQ,C'1'),
BUILD=(38,9,1X,1,16,1X,C'GROUP NOT FOUND',38X) <== NO GROUP
OUTFIL FNAMES=SORTOF03,INCLUDE=(401,1,CH,EQ,C'2'),
BUILD=(C'000000000',1X,102,16,1X,C'NO CUSTOMER FOR GROUP',32X)
JOINKEYS FILE=F1,FIELDS=(01,16,A)
JOINKEYS FILE=F2,FIELDS=(22,16,A)
JOIN UNPAIRED F1,F2 <== NON MATCHES FROM BOTH FILES
REFORMAT FIELDS=(F1:01,80,F2:1,320,?)
OUTFIL FNAMES=SORTOF01,INCLUDE=(401,1,CH,EQ,C'B'), <==MATCH
BUILD=(38,9,12X,102,16,118,283)
OUTFIL FNAMES=SORTOF02,INCLUDE=(401,1,CH,EQ,C'1'),
BUILD=(38,9,1X,1,16,1X,C'GROUP NOT FOUND',38X) <== NO GROUP
OUTFIL FNAMES=SORTOF03,INCLUDE=(401,1,CH,EQ,C'2'),
BUILD=(C'000000000',1X,102,16,1X,C'NO CUSTOMER FOR GROUP',32X)
What I have been trying to do is put logic in to combine SORTOF02 AND SORTOF03 to one file. I know I can just add another sort to do this but thought I would try with ifthen when conditions.
SORT FIELDS=COPY
JOINKEYS FILE=F1,FIELDS=(01,16,A)
JOINKEYS FILE=F2,FIELDS=(22,16,A)
JOIN UNPAIRED F1,F2 <== NON MATCHES FROM BOTH FILES
REFORMAT FIELDS=(F1:01,80,F2:1,320,?)
OUTFIL FNAMES=SORTOF01,INCLUDE=(401,1,CH,EQ,C'B'), <==MATCH
BUILD=(38,9,12X,102,16,118,283)
OUTFIL FNAMES=SORTOF02,INCLUDE=(401,1,CH,NE,C'B'),
IFTHEN=(WHEN=(103,1,CH,GT,C' '),
BUILD=(C'000000000 ',102,16,1X,C'NO CUSTOMER FOR GROUP',32X)),
IFTHEN=(WHEN=(38,1,CH,GT,C' '),
BUILD=(38,9,1X,1,16,1X,C'GROUP NOT FOUND',38X))
JOINKEYS FILE=F1,FIELDS=(01,16,A)
JOINKEYS FILE=F2,FIELDS=(22,16,A)
JOIN UNPAIRED F1,F2 <== NON MATCHES FROM BOTH FILES
REFORMAT FIELDS=(F1:01,80,F2:1,320,?)
OUTFIL FNAMES=SORTOF01,INCLUDE=(401,1,CH,EQ,C'B'), <==MATCH
BUILD=(38,9,12X,102,16,118,283)
OUTFIL FNAMES=SORTOF02,INCLUDE=(401,1,CH,NE,C'B'),
IFTHEN=(WHEN=(103,1,CH,GT,C' '),
BUILD=(C'000000000 ',102,16,1X,C'NO CUSTOMER FOR GROUP',32X)),
IFTHEN=(WHEN=(38,1,CH,GT,C' '),
BUILD=(38,9,1X,1,16,1X,C'GROUP NOT FOUND',38X))
This runs but does not pickup the 2 records I expected to be labeled 'NO CUSTOMER FOR GROUP' in addition I had to comment out the lrecl of the output file of 80. So it creates a 400 byte file.
Was wondering if syncsort can do this?
Code'd