Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SORT to sum the transaction amount based on acct no

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: SORT to sum the transaction amount based on acct no
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 Moderator


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

PostPosted: Mon Jun 15, 2009 6:08 am    Post subject:
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    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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us