senjay
Active User
Joined: 10 May 2007 Posts: 147 Location: India
|
|
|
|
Hi,
I have two files, already sorted. I need unpaired records from File1 and paired records.
For unpaired records, I don't always need 'blanks' for fields from file2. Because some fields from file 2 can be alphanumeric and some fields can have packed decimal values, the final output file will be used as an input to a COBOL program. So I am using FILL to override blanks with '$' for such cases and I am using OUTREC IFTHEN and HIT=NEXT to replace $ values with blanks or zeroes, whereever applicable .
Below is the code I used. Still I have a feeling that there could be a better solution in DFSORT to do this. Could any one provide your suggestion to improve the below code.
Code: |
JOINKEYS F1=IN1,FIELDS=(1,16,A),SORTED,NOSEQCK
JOINKEYS F2=IN2,FIELDS=(1,16,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,19,34,4,
38,8,54,6,
84,16,
F2:72,4,77,2,80,2,
82,8,
90,4,95,2,98,2,
100,20,
122,8,
131,6,
159,22,
F1:109,22,
F2:181,31,
F1:100,9,
F2:221,9,232,2,
F1:131,2,
F2:234,2,71,1,
F1:20,6,46,8,60,8,26,8,68,16,
F2:38,6,29,1),FILL=C'$'
SORT FIELDS=COPY
INREC BUILD=(C'23',1,19,X,C'00',20,4,X,24,14,X,
38,16,X,
54,44,C'00',
98,114,2X,
212,46,X'000000000000000C',
258,6,C'0',
264,1,C'01010001',
X'000000000000000C',
X'000000000000000C')
OUTREC IFTHEN=(WHEN=(62,8,CH,EQ,C'$$$$$$$$'),
OVERLAY=(62:8X),HIT=NEXT),
IFTHEN=(WHEN=(70,8,CH,EQ,C'$$$$$$$$'),
OVERLAY=(70:X'000000000000000C'))
|
|
|