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

Author Message
shrivatsa
Warnings : 1

Active User

Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

Posted: Sun Jan 01, 2012 10:00 pm    Post subject: DFSORT SUM and RECORD Count

Hi,

Below is the Input file FB, LRECL=80
 Code: 090600           -0.43 090600           -0.43 090601           -0.43 090601           -0.43 090601            0.00 090602           -0.43 090602           -0.43 090602           -0.43 090602           -0.43

Output:-

 Code: Summary Report    --------------- Account#   Amount   Count --------   ------   ----- 090600      -1.28   3 090601      -0.86   2 090602      -1.70   4            ------  --- Total       -3.84   9

Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Sun Jan 01, 2012 10:13 pm    Post subject: Re: DFSORT SUM and RECORD Count You mean: Input Data Magic Output Data You have two 090600 and three 090601 on your input, and the reverse on your output. Is this is typo? Or do you have some rules to achieve that? There are a lot of simple report example in the Getting Started and Programming Guides.
shrivatsa
Warnings : 1

Active User

Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

Posted: Mon Jan 02, 2012 2:52 pm    Post subject:

Sorry its Typo error. The output should be as below.

 Code: Summary Report    --------------- Account#   Amount   Count --------   ------   ----- 090600      -1.28   2 090601      -0.86   3 090602      -1.70   4            ------  --- Total       -3.84   9
Frank Yaeger

DFSORT Moderator

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

Posted: Tue Jan 03, 2012 5:57 am    Post subject:

You need to work on your arithmetic. The correct output for your input example would be:

 Code: Summary Report -------------- Account#   Amount   Count --------   ------   ----- 090600      -0.86       2 090601      -0.86       3 090602      -1.72       4 -----      ------   ----- Total       -3.44       9

You can use a DFSORT job like the following:

 Code: //S1 EXEC PGM=SORT                                                //SYSOUT DD SYSOUT=*                                              //SORTIN DD *                                                    090600           -0.43                                            090600           -0.43                                            090601           -0.43                                            090601           -0.43                                            090601            0.00                                            090602           -0.43                                            090602           -0.43                                            090602           -0.43                                            090602           -0.43                                            //SORTOUT DD SYSOUT=*                                            //SYSIN DD *                                                        SORT FIELDS=(1,6,CH,A)                                            OUTFIL REMOVECC,NODETAIL,                                          HEADER2=('Summary Report',/,14'-',2/,                             'Account#',12:'Amount',21:'Count',/,                             8'-',12:6'-',21:5'-'),                                          SECTIONS=(1,6,                                                     TRAILER3=(1,6,13:TOT=(18,5,SFF,EDIT=(ST.TT),SIGNS=(,-)),           21:COUNT=(M10,LENGTH=5))),                                    TRAILER1=(5'-',12:6'-',21:5'-',/,                                   'Total',                                                         13:TOT=(18,5,SFF,EDIT=(ST.TT),SIGNS=(,-)),                       21:COUNT=(M10,LENGTH=5))                          /*
 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 Skip records depends on count lakshmiibmmainframes DFSORT/ICETOOL 5 Sun Dec 24, 2017 9:51 pm query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm Formatting using DFsort Guru Nandu DFSORT/ICETOOL 5 Thu Nov 30, 2017 7:33 am

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