Grouping records and split into two or more files based on a



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Grouping records and split into two or more files based on a

Postby David2k8 » Mon Mar 30, 2015 3:06 pm

//Jobname JOB ,,REGION=0M,CLASS=E,MSGCLASS=Z,
// NOTIFY=&SYSUID
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1 FACETS 123456789
2 ACES 123456790
3 CHIPS 123456791
4 FACETS 123456792
5 CHIPS 123456793
6 CS90 123456794
7 NASCO 123456795
8 CHIPS 123456796
9 ACES 123456797
10 CS90 123456798
/*
//OUT01 DD SYSOUT=*
//OUT02 DD SYSOUT=*
//OUT03 DD SYSOUT=*
//OUT04 DD SYSOUT=*
//OUT05 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(5,6,CH,A)
OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(5,6),PUSH=(21:ID=2))
OUTFIL FNAMES=OUT01,BUILD=(1,20),INCLUDE=(21,2,ZD,EQ,01)
OUTFIL FNAMES=OUT02,BUILD=(1,20),INCLUDE=(21,2,ZD,EQ,02)
OUTFIL FNAMES=OUT03,BUILD=(1,20),INCLUDE=(21,2,ZD,EQ,03)
OUTFIL FNAMES=OUT04,BUILD=(1,20),INCLUDE=(21,2,ZD,EQ,04)
OUTFIL FNAMES=OUT05,BUILD=(1,20),INCLUDE=(21,2,ZD,EQ,05)
/*

Output:

2 ACES 123456790 01
9 ACES 123456797 01
3 CHIPS 123456791 02
5 CHIPS 123456793 02
8 CHIPS 123456796 02
6 CS90 123456794 03
10 CS90 123456798 03
1 FACETS 123456789 04
4 FACETS 123456792 04
7 NASCO 123456795 05
David2k8
 
Posts: 7
Joined: Mon Mar 23, 2015 10:32 am
Has thanked: 0 time
Been thanked: 2 times

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post