I have a requirement where in I have to obtain number of record counts from the same dataset based on different conditions. I would like this to be done in a single pass.
e.g.
HI-1
HI-2
HI-3
HI-1
HI-2
HI-5
HI-3
HI-1
HI-2
HI-3
HI-8
HI-8
HI-1
HI-2
HI-3
HI-3
HI-1
HI-2
HI-3
HI-1
HI-2
HI-3
HI-1
HI-2
HI-3
HI-2
HI-3
HI-1
HI-2
HI-5
HI-3
HI-1
HI-2
HI-3
HI-8
HI-8
HI-1
HI-2
HI-3
HI-3
HI-1
HI-2
HI-3
HI-1
HI-2
HI-3
HI-1
HI-2
HI-3
I need the total number of record for below conditions but in the same output dataset.
1) Total number of records (INCLUDE=ALL)
2) Total number of records with '1' in position 4 (INCLUDE=(4,1,CH,EQ,C'1')
2) Total number of records with '2' in position 4 (INCLUDE=(4,1,CH,EQ,C'2')
2) Total number of records with '3' in position 4 (INCLUDE=(4,1,CH,EQ,C'3')
Expected output
RECORD COUNT : 0000000000000025
RECORD COUNT1 : 000000000000007
RECORD COUNT2 : 000000000000007
RECORD COUNT3 : 000000000000008
RECORD COUNT1 : 000000000000007
RECORD COUNT2 : 000000000000007
RECORD COUNT3 : 000000000000008
I tried it with COPY operator and 4 different OUTFIL datasets with output dataset as MOD, but I am just getting the last count which is for condition INCLUDE=(4,1,CH,EQ,C'3'). SORT does not allow same DD statement to be used for OUTFIL (which is quite logical).
OUTFIL FNAMES=OUTPUTFI,REMOVECC,NODETAIL,
INCLUDE=ALL,
TRAILER1=(1C'RECORD COUNT1 : ',COUNT=(M11,LENGTH=20))
OUTFIL FNAMES=OUTPUTF1,REMOVECC,NODETAIL,
INCLUDE=(4,1,CH,EQ,C'1'),
TRAILER1=(1C'RECORD COUNT2 : ',COUNT=(M11,LENGTH=20))
OUTFIL FNAMES=OUTPUTF2,REMOVECC,NODETAIL,
INCLUDE=(4,1,CH,EQ,C'2'),
TRAILER1=(1C'RECORD COUNT3 : ',COUNT=(M11,LENGTH=20))
OUTFIL FNAMES=OUTPUTF3,REMOVECC,NODETAIL,
INCLUDE=(4,1,CH,EQ,C'3'),
TRAILER1=(1C'RECORD COUNT4 : ',COUNT=(M11,LENGTH=20))
INCLUDE=ALL,
TRAILER1=(1C'RECORD COUNT1 : ',COUNT=(M11,LENGTH=20))
OUTFIL FNAMES=OUTPUTF1,REMOVECC,NODETAIL,
INCLUDE=(4,1,CH,EQ,C'1'),
TRAILER1=(1C'RECORD COUNT2 : ',COUNT=(M11,LENGTH=20))
OUTFIL FNAMES=OUTPUTF2,REMOVECC,NODETAIL,
INCLUDE=(4,1,CH,EQ,C'2'),
TRAILER1=(1C'RECORD COUNT3 : ',COUNT=(M11,LENGTH=20))
OUTFIL FNAMES=OUTPUTF3,REMOVECC,NODETAIL,
INCLUDE=(4,1,CH,EQ,C'3'),
TRAILER1=(1C'RECORD COUNT4 : ',COUNT=(M11,LENGTH=20))
What I am getting in the output dataset -
RECORD COUNT4 : 000000000000008
Is there any way to achieve the results in a single pass, in the same dataset.
Thanks