I have a dataset having some records as follows
DEM|JH|I|1234
DEM|JH|I|1235
DEM|JH|O|2115
DEM|FR|I|2536
DEM|FR|O|5264
I want to count the number of records of each type and write them in following format
DEM|JH|2|1
DEM|FZ|1|1
Here the third field is number of records of type 'I' and fourth field is number of records of type 'O'.
I used following JCL
//JBSTEP01 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=IMAN.FILE1
//SORTOUT DD DSN=IMAN.FILE2,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(550,500),RLSE),
// UNIT=SYSDA
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(1,8,CH,EQ,C'DEM|JH|I')
SORT FIELDS=(1,9,CH,A)
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('CDEM|JH|',COUNT=(M10,LENGTH=8))
//*
//SORTIN DD DISP=SHR,DSN=IMAN.FILE1
//SORTOUT DD DSN=IMAN.FILE2,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(550,500),RLSE),
// UNIT=SYSDA
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(1,8,CH,EQ,C'DEM|JH|I')
SORT FIELDS=(1,9,CH,A)
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('CDEM|JH|',COUNT=(M10,LENGTH=8))
//*
This gave me number of records of type 'I' , so I applied same step again for type 'O'.These two different steps output is like
DEM|JH|2
DEM|JH|1
DEM|FZ|1
DEM|FZ|1
but I want both the records to be written in same line as follows the first count should be of type 'I' and second should be of type 'O'.
DEM|JH|2|1
DEM|FZ|1|1
Your help is most appreciated.
Thank you.