|
|
| Author |
Message |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 478 Location: Milan, Italy
|
|
|
|
Hi to all.
I'm looking for a way to write and execute less amout of sortstep I can.
I've searched in this forum for various sample of count but I can't find what I need.
Assume this input layout:
| Code: |
AAA-0001-BB-F
AAA-0002-CC-F
AAA-0003-CC-F
AAA-0005-DD-F
BBB-0009-AA-F
|
I need this output:
| Code: |
AAA 0004
BBB 0001
BB 0001
CC 0002
DD 0001
F 0020 /*this is the sum of the second field */ |
It's possible execute a list of sum directly thru ICETOOL and generate this output?
All the comment are wellcome
P.S.= LrecL and RecFm are not important. |
|
| Back to top |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AAA-0001-BB-F
AAA-0002-CC-F
AAA-0003-CC-F
AAA-0005-DD-F
BBB-0009-AA-F
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,
OUTREC=(C'1',1,3,6:C'0001'/,
C'3',13,1,6:5,4,/,
C'2',10,2,6:C'0001')
//CTL2CNTL DD *
OPTION ZDPRINT
SORT FIELDS=(1,4,CH,A)
SUM FIELDS=(6,4,ZD)
OUTREC FIELDS=(2,8)
/*
|
OUT will have:
| Code: |
AAA 0004
BBB 0001
AA 0001
BB 0001
CC 0002
DD 0001
F 0020
|
|
|
| Back to top |
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 478 Location: Milan, Italy
|
|
|
|
Hi Frank, really thanks! Your solution is great!
Really congrats to you and your punctual genius. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
| Glad I could help. That's a pretty fancy happy face. |
|
| Back to top |
|
 |
|
|
|