Code: |
File 1:
------- Fld#1 Fld#2 Fld#3 Fld#4 Fld#5 Fld#6 Fld#7 111 991 Y 12.10 A 10 12.70 222 992 N 11.10 A 10 17.70 333 993 Y 8.10 D 11 11.88 444 994 N 2.23 D 12 6.12 555 995 Y 18.12 A 12 19.39 File 2: ------- Fld#1 Fld#2 Fld#3 Fld#4 Fld#5 Fld#6 Fld#7 111 991 1-may Y 12.10 A 10 222 992 6-Apr N 11.10 A 10 333 996 8-may Y 18.10 D 11 666 997 1-oct N 21.23 D 12 777 998 4-Jun Y 38.12 A 12 JOINKEYS FILE=F1,FIELDS=(1,3,A,5,3,A,8,1,A),SORTED,NOSEQCK JOINKEYS FILE=F2,FIELDS=(1,3,A,5,3,A,14,1,A),SORTED,NOSEQCK JOIN UNPAIRED,F1,F2 Output file: ------------ Fld#1 Fld#2 Fld#3 Fld#4 Fld#5 Fld#6 Fld#7 111 991 Y 12.10 A 10 12.70 222 992 N 11.10 A 10 17.70 333 993 Y 8.10 D 11 11.88 333 996 Y 18.10 D 11 0.00 444 994 N 2.23 D 12 6.12 555 995 Y 18.12 A 12 19.39 666 997 N 21.23 D 12 0.00 777 998 Y 38.12 A 12 0.00 |
Code: |
//STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //INA DD * ----+----1----+----2----+----3----+----4----+----5----+----6---- 111 991Y 12.10 A 10 12.70 222 992N 11.10 A 10 17.70 333 993Y 8.10 D 11 11.88 444 994N 2.23 D 12 6.12 555 995Y 18.12 A 12 19.39 //INB DD * 111 991 1-MAYY 12.10 A 10 222 992 6-APRN 11.10 A 10 333 996 8-MAYY 18.10 D 11 666 997 1-OCTN 21.23 D 12 777 998 4-JUNY 38.12 A 12 //SORTOUT DD SYSOUT=* //SYSIN DD * OPTION COPY JOINKEYS F1=INA,FIELDS=(1,3,A,5,3,A,08,1,A),SORTED,NOSEQCK JOINKEYS F2=INB,FIELDS=(1,3,A,5,3,A,14,1,A),SORTED,NOSEQCK JOIN UNPAIRED REFORMAT FIELDS=(F1:1,80,?,F2:1,80) INREC IFOUTLEN=80, IFTHEN=(WHEN=(81,1,CH,EQ,C'2'), BUILD=(82,07,95,18,C' 0.00',113,49)) //* |
Code: |
111 991Y 12.10 A 10 12.70 222 992N 11.10 A 10 17.70 333 993Y 8.10 D 11 11.88 333 996Y 18.10 D 11 0.00 444 994N 2.23 D 12 6.12 555 995Y 18.12 A 12 19.39 666 997N 21.23 D 12 0.00 777 998Y 38.12 A 12 0.00 |
Code: |
JOIN UNPAIRED |
Code: |
REFORMAT FIELDS=(F1:1,80,?,F2:1,80) |
Code: |
INREC IFOUTLEN=80, |
Code: |
IFTHEN=(WHEN=(81,1,CH,EQ,C'2'),
BUILD=(82,07,95,18,C' 0.00',113,49)) |
balaryan wrote: |
This is as same as JOIN UNPAIRED F1, F2 which will extract the paired records (when JOINKEYS matches F1 and F2 record) from F1 ONLY along with unpaired records from F1 and F2. This is my requirement. |
balaryan wrote: |
Reformatting fields with '?' indicates complete file content from files (F1 and F2) and 1-byte indicator at end of the file to show if key present in F1 or F2. |
Code: |
---------------------------------------------------------------- |BYTES 1 THU 80 FROM FILE-1 | IND ? | BYTES 1 THU 80 FROM FILE2 | ---------------------------------------------------------------- |
DFSORT Application Programming Guide wrote: |
? indicates a 1-byte indicator is to be included in each joined record. The indicator will be set to one of the following values in each paired or unpaired joined record, as appropriate: 'B' - the key was found in F1 and F2. '1' - the key was found in F1, but not in F2. '2' - the key was found in F2, but not in F1. |
balaryan wrote: |
Hi Kolusu,
Apologies for using the same topic to post my query which was based on the initial problem. Is it possible to sort the output file as a result of this JOINKEYS with two fields in ASC and other fields in DESC order in the same step? |
balaryan wrote: |
I tried searched in IBM DFSORT manuals and no luck in finding any information. |
output generated using printer-friendly topic mod. All times are GMT - 5 Hours