Assuming there are no numbers in the characters for which you want to count x's, you can use this DFSORT job to do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
aaaaxxaaaaaxxxx
aaaaaaffdfxmm
dddddxxxdddddd
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
* Change 'x' to '1'
ALTSEQ CODE=(A7F1)
* Copy 1-15 to 21-35 and change each 'x' to a '1' in 21-35.
INREC FIELDS=(1,15,21:1,15,TRAN=ALTSEQ)
* Get total of 1s in 21-35 (with FS, letters will be treated as 0).
OUTREC FIELDS=(1,15,X,
21,1,FS,ADD,22,1,FS,ADD,23,1,FS,ADD,24,1,FS,ADD,25,1,FS,ADD,
26,1,FS,ADD,27,1,FS,ADD,28,1,FS,ADD,29,1,FS,ADD,30,1,FS,ADD,
31,1,FS,ADD,32,1,FS,ADD,33,1,FS,ADD,34,1,FS,ADD,35,1,FS,
TO=FS,LENGTH=3)
/*
SORTOUT will have:
Code:
aaaxxaaaaaxxxx 6
aaaaaffdfxmm 1
ddddxxxdddddd 3
If there are numbers in the characters for which you want to count x's, change the ALTSEQ statement to:
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
shuklas,
Here is a DFSORT JCL which will give you the desired results. Using FINDREP we eliminate all character A thru Z and 0 thru 9 and ", - . By doing this we are only left with the character which you want to count. And now we convert this to VB file so that we get the accurate count of the characters. It also eliminates records without the | character
FINDREP function of DFSORT is available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008)