Say you have an input file with transaction details and want to count the number of records with same transaction ID.
Input File
TRN1
TRN1
TRN1
TRN2
TRN2
TRN3
Output File
TRN1 3
TRN2 2
TRN3 1
JCL
//STEP10 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//OUTFILE DD DSN=TRNCNT.PS,DISP=SHR
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//OUTFILE DD DSN=TRNCNT.PS,DISP=SHR
//INFILE DD DSN=TNFIL.PS,DISP=SHR
//TOOLIN DD *
OCCUR FROM(INFILE) LIST(OUTFILE) -
NOHEADER NOCC-
ON(1,4,CH) -
ON(VALCNT,N06)
/*
NOHEADER NOCC-
ON(1,4,CH) -
ON(VALCNT,N06)
/*
The duplicate values will be looked only in the first 4 bytes of each record and count will be displayed in the 6th position.
If you want compare records with 80 bytes change 4 as 80 and 6 to the position where you want to display your count
No comments:
Post a Comment