Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Musab,
You can do what you want with a DFSORT job like the following. I assumed you have a maximum of 10 commas in one record and that you want to display the count in positions 81-85 of each record.
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
q,werty
poi,uyt
asdf,g,h
a,b,,,,c,,d,,x,y
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
PARSE=(%01=(STARTAT=C',',FIXLEN=1),
%02=(STARTAT=C',',FIXLEN=1),
%03=(STARTAT=C',',FIXLEN=1),
%04=(STARTAT=C',',FIXLEN=1),
%05=(STARTAT=C',',FIXLEN=1),
%06=(STARTAT=C',',FIXLEN=1),
%07=(STARTAT=C',',FIXLEN=1),
%08=(STARTAT=C',',FIXLEN=1),
%09=(STARTAT=C',',FIXLEN=1),
%10=(STARTAT=C',',FIXLEN=1)),
OVERLAY=(81:%01,%02,%03,%04,%05,%06,%07,%08,%09,%10)),
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=81,IN=C',',OUT=C'1')),
IFTHEN=(WHEN=INIT,
BUILD=(1,80,81,1,ZD,ADD,82,1,ZD,ADD,83,1,ZD,ADD,84,1,ZD,ADD,
85,1,ZD,ADD,86,1,ZD,ADD,87,1,ZD,ADD,88,1,ZD,ADD,
89,1,ZD,ADD,90,1,ZD,TO=ZD,LENGTH=5))
/*
|
SORTOUT would have:
Code: |
q,werty 00001
poi,uyt 00001
asdf,g,h 00002
a,b,,,,c,,d,,x,y 00010
|
If that's not what you want, then you need to do a better job of explaining what you do want. |
|