Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Here's one way. In DFSORT. You'll need the JNFnCNTL files, so if you don't have them, talk to Syncsort support. If you get nowhere there, do that work in two separate steps before the join.
Concatenate your three single-number files. Use JOINKEYS. Append something to each record of each file (I used zero). Append sequence number to number records. JOINKEYS on the appended value. Three GROUPs to pass the "different" pieces of data down, defined on the sequence number. OUTFIL INCLUDE for the third record, as the first two are incomplete "work" records.
If you get it working, make sure you fully understand and document it.
Code: |
//MERGEDAT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(9,1,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(10,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,9,F2:1,9,11,1)
INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,10,9,X,4,3,9X,X,7,2,X,9X,19,1)),
IFTHEN=(WHEN=GROUP,BEGIN=(39,1,CH,EQ,C'3'),RECORDS=1,
PUSH=(30:4,9)),
IFTHEN=(WHEN=GROUP,BEGIN=(39,1,CH,EQ,C'2'),RECORDS=2,
PUSH=(17:4,9)),
IFTHEN=(WHEN=GROUP,BEGIN=(39,1,CH,EQ,C'1'),RECORDS=3,
PUSH=(4:4,9))
OUTFIL INCLUDE=(39,1,CH,EQ,C'3'),BUILD=(1,38)
//JNF1CNTL DD *
OPTION COPY
INREC OVERLAY=(9:C'0')
//JNF2CNTL DD *
OPTION COPY
INREC OVERLAY=(10:C'0',SEQNUM,1,ZD)
//INA DD *
AA BB CC
//INB DD *
000033.00
45000.00
450.00
|
Output:
Code: |
AA 000033.00 BB 45000.00 CC 450.00 |
|
|