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 UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 5 Sat May 06, 2017 12:59 am


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