要完成此任务,请将您的四个输入文件连接到 sortin:
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=File1,DISP=SHR
// DD DSN=File2,DISP=SHR
// DD DSN=File3,DISP=SHR
// DD DSN=File4,DISP=SHR
//SORTOUT DD DSN=Combined
//SYSIN DD *
* Combine each pair of records into a single record
SORT FIELDS=COPY
* Append a sequence number 00,50,00,50,00,...
INREC BUILD=(1,2,2X,SEQNUM,2,ZD,START=0,INCR=50)
* Reformat the output record depending on the sequence number
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(5,2,CH,EQ,C'00'),
PUSH=(7:1,2)),
IFTHEN=(WHEN=GROUP,BEGIN=(5,2,CH,EQ,C'50'),
PUSH=(9:1,2))
* Include only the second record of each group (the 50 records)
OUTFIL FILES=OUT,INCLUDE=(5,2,CH,EQ,C'50'),BUILD=(7,4)
END
对于四个输入文件:
文件1:
45
文件2:
78
文件3:
83
文件4:
52
组合输出文件应为:
4578
8352
这已通过适用于 Windows v14r3 的 AHLSORT 进行了验证,但应该适用于 z/OS 上的 DFSORT 或 SYNCSORT。