Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

code to find the sum total for a particular field.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
gskn4u
Currently Banned

New User


Joined: 29 Feb 2008
Posts: 25
Location: hyderabad

PostPosted: Thu May 22, 2008 6:48 pm    Post subject: code to find the sum total for a particular field.
Reply with quote

Hi

Can anyone help me with the code to the following requirement:
I have a file with records
Code:

01  00000000042530405676  000001582
01  00000000042531167809  000000288
01  00000000042531234567  000000612
01  00000000042532059754  000001542
01  00000000042532422901  000005862
01  00000000042545624158  000000262
01  00000000042546018693  000000820
01  00000000042546410809  000000375
01  00000000042546631832  000000309
01  00000000042546902789  000000254
01  00000000042547253674  000002197
01  00000000042547370386  000000468
01  00000000042549774188  000000309
01  00000000042549995047  000000891
01  00000000042549998377  000000605


and i need the total sum of the 3rd field only.

Thanks,
Santosh
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu May 22, 2008 9:19 pm    Post subject:
Reply with quote

The following DFSORT JCL will give you the desired results

Code:

//STEP0300 EXEC PGM=ICEMAN               
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD *                           
----+----1----+----2----+----3----+----4--
01  00000000042530405676  000001582       
01  00000000042531167809  000000288       
01  00000000042531234567  000000612       
01  00000000042532059754  000001542       
01  00000000042532422901  000005862       
01  00000000042545624158  000000262       
01  00000000042546018693  000000820       
01  00000000042546410809  000000375       
01  00000000042546631832  000000309       
01  00000000042546902789  000000254       
01  00000000042547253674  000002197       
01  00000000042547370386  000000468       
01  00000000042549774188  000000309       
01  00000000042549995047  000000891       
01  00000000042549998377  000000605       
//SORTOUT  DD SYSOUT=*                   
//SYSIN    DD *                           
  SORT FIELDS=COPY                       
  OUTFIL REMOVECC,NODETAIL,               
  TRAILER1=('TOTAL OF 3RD FIELD : ',     
            TOT=(27,09,ZD,M10,LENGTH=11)) 
//*                                       


Hope this helps...

cheer
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu May 22, 2008 9:19 pm    Post subject:
Reply with quote

You can use these DFSORT control statements:

Code:

  OPTION COPY                               
  OUTFIL REMOVECC,NODETAIL,                 
    TRAILER1=(TOT=(27,9,ZD,TO=ZD,LENGTH=10))


The output for your example would be:

0000016376

Adjust as needed.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us