Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Anand Kumar

New User

Joined: 29 Aug 2007
Posts: 24
Location: chennai

Posted: Sun Jun 14, 2009 8:04 pm    Post subject: SORT to sum the transaction amount based on acct no

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

Frank Yaeger

DFSORT Moderator

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

Posted: Mon Jun 15, 2009 6:08 am    Post subject:

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=(+,-))))    /*
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How to select record x+7 or x+2 based... JoAnn Kulcyk SYNCSORT 6 Tue Jan 16, 2018 10:49 pm SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us