我有一个包含4个不同部门的已处理信息的数据集,我需要将其拆分为每个部门的一个数据集。这是一般记录结构:
XXXXXXX =无关字符串
AAA = 3个字母的alpha部门ID
记录详细信息无关紧要,行数可变
000001 0000000000000000000000000000000000000XXXXXXXAAA171220150000
000002 <irrelevant record details>
000003 <irrelevant record details>
000004 999999999999999999999999999999999999900000004000000000005700
000005 0000000000000000000000000000000000000XXXXXXXBBB171220150000
000006 <irrelevant record details>
000007 <irrelevant record details>
000008 <irrelevant record details>
000009 <irrelevant record details>
000010 <irrelevant record details>
000011 999999999999999999999999999999999999900000004000000000005700
000012 0000000000000000000000000000000000000XXXXXXXCCC171220150000
000013 <irrelevant record details>
000018 999999999999999999999999999999999999900000004000000000005700
如何使用DFSORT和JCL完成此操作?
答案 0 :(得分:1)
以下是使用INREC WHEN = GROUP的解决方案的示例代码,用于2个部门:
//SRT0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=DATASET.IN,
// DISP=SHR
//AAAOUT DD DSN=DATASET.OUT.DEPAAA,
// DISP=(,CATLG),AVGREC=U,SPACE=(150,(100,10),RLSE)
//BBBOUT DD DSN=DATASET.OUT.DEPBBB,
// DISP=(,CATLG),AVGREC=U,SPACE=(150,(100,10),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'0000'),
END=(1,4,CH,EQ,C'9999'),
PUSH=(151:45,3))
OUTFIL FNAMES=AAAOUT,
INCLUDE=(151,3,CH,EQ,C'AAA'),BUILD=(1,150)
OUTFIL FNAMES=BBBOUT,
INCLUDE=(151,3,CH,EQ,C'BBB'),BUILD=(1,150)
/*