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

SORT to sum the transaction amount based on acct no


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

New User


Joined: 29 Aug 2007
Posts: 24
Location: chennai

PostPosted: Sun Jun 14, 2009 8:04 pm
Reply with quote

Hi,

I need to sum fields like this:

Code:

Acctno Transaction amt
001-00022
001+00033
002-00001
002+00001
003-00001



I need a result like which sums the transaction amount based on acct no.

Output should be:

Code:

001+00011
002+00000
003-00001



I gave a sort card like this:

Code:

 SORT FIELDS=(1,3,CH,A)
 SUM FIELDS=(4,6,ZD)                                           


The sign in the sum field is not recognized and the SORT give error.

Is there any way to solve this or any other way to sum fields with sign option before??

Please can any one help me in this..

Regards,
Anand
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: Mon Jun 15, 2009 6:08 am
Reply with quote

Those are NOT ZD values, so you can't use SUM for them without converting them. But it's actually easier to use SECTIONS and TRAILER3 with a DFSORT job like this:

Code:

//S1    EXEC  PGM=SORT                                         
//SYSOUT    DD  SYSOUT=*                                       
//SORTIN DD *                                                   
001-00022                                                       
001+00033                                                       
002-00001                                                       
002+00001                                                       
003-00001                                                       
/*
//SORTOUT DD SYSOUT=*                                           
//SYSIN    DD    *                                             
  OPTION COPY                                                   
  OUTFIL REMOVECC,NODETAIL,                                     
    SECTIONS=(1,3,                                             
      TRAILER3=(1,3,TOT=(4,6,FS,EDIT=(STTTTT),SIGNS=(+,-))))   
/*
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Adding first / last acct numerber to ... DFSORT/ICETOOL 7
Search our Forums:

Back to Top