IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DfSort Count multiple fields


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Tue Aug 30, 2005 8:53 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Aug 30, 2005 11:04 pm
Reply with quote

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
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Tue Aug 30, 2005 11:49 pm
Reply with quote

Hi Frank, really thanks! Your solution is great!
36_8_11.gif
Really congrats to you and your punctual genius.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Aug 31, 2005 12:19 am
Reply with quote

Glad I could help. That's a pretty fancy happy face.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top