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

Counting number of invoices associated with each Vendor


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

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Thu Dec 30, 2010 11:52 pm
Reply with quote

Hi.
i have a 200 byte flat file that I need to get the invoice amount summarized for each vendor that exists on the file and also need to count the number of records each vendor has as well as grand totals.
With the DISPLAY Operand ( and DFSort ) I can get the vendor amounts rolled up with each vendor but I cannot see how I can get the number of records count. I thought I saw something out here a while back to do a similiar thing but cannot find the post. A cobol program will do this in a snap I know, but similiar reports come over often during this conversion.
Once I have a model I will be cranking them out lickety split with this tool I believe.

These are the 2 inputs I am working with:

05 VENDOR-NUMBER PIC X(07).
05 NET-AMOUNT PIC S9(09)V99 VALUE 0.

And the requested output should be similiar to this:

Vendor No. of invoices Total net amount
A123456 7 $47,322.98
A123457 2 $100.00
A123458 27 $227,005.09

Grand total 36 $6,774,398.10

thanks in advance and happy new year
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: Fri Dec 31, 2010 12:31 am
Reply with quote

Why can't you use the BCOUNT operand of DISPLAY to get the break counts and the COUNT operand of DISPLAY to get the file count?

Note that if it's a matter of how you want the output formatted vs how DISPLAY formats it, then you probably need to use OUTFIL for the report rather than DISPLAY to get that level of control of the formatting.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Tue Jan 04, 2011 3:14 am
Reply with quote

ok. thanks frank. i checked those and those operands worked for what I was looking for. The problem with using those for I had to get done was I couldn't suppress the line item display and just retain the BCOUNT Tots and money summary. So I went in at that sorta backwards but it worked nonetheless.
I did the following to summarize the data first:

Code:
000077 //SYSIN     DD *                                           
000078  SORT FIELDS=(21,7,CH,A)                                   
000079  OUTFIL REMOVECC,NODETAIL,                                 
000080  SECTIONS=(21,7,                                           
000081   TRAILER3=(21,7,' ',COUNT=(EDIT=(IIII)),                   
000082            ' ',TOTAL=(092,11,ZD,EDIT=(III,III,III,IIT.TT))))


Output looks like this but right justified:

Code:
A042300    1           3,630.00
A074845    1             856.00
A074922    4          10,420.72
A074937    1           1,310.00


Then I let ICETOOL do some work. i stated that the counter field coming in was numeric so I got Grand Totals on that as well as well as my Net Amounts.

Code:
 //TOOLIN    DD *                               
  MODE STOP                                     
  DISPLAY FROM(INPUT) LIST(APDMS01) -           
  TITLE('APDMS VENDOR INVOICE BREAKDOWN') PAGE -
  DATE     -                                   
  TIME     -                                   
  HEADER('VENDOR ') -                           
  HEADER(' INVOICE COUNT ') -                   
  HEADER('NET AMOUNT ') -                       
  ON(1,07,CH) ON(08,05,SFF,U05) -               
  ON(013,19,SFF,C1,U14,F'$') -                 
  TOTAL('TOTALS ') -                           
  COUNT('TOTAL COUNT OF VENDORS IN FILE')       
/*


output looks like but right justified ! ( geez ) :

Code:
VENDOR     INVOICE COUNT             NET AMOUNT 
-------   ---------------   --------------------
99325A0                 1                $130.30
9940310                 1                $922.35
9947280                 2             $34,778.65
99625A0                 1                $100.00
9968090                 2                $278.99
9971830                 3             $11,500.00
9973520                 1              $3,012.00
99750A0                 2             $33,206.80
9976750                 2             $11,675.15
9981970                 1                $998.30
9982710                 1             $15,000.00
99973A0                 8              $5,035.43
                                                 
TOTALS              17449        $123,159,324.81


Now if i can just figure out how to format output to exactly what I want it to be. I am going there next.
Thanks again to your team.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jan 04, 2011 3:20 am
Reply with quote

Hello,

Well, i'm lost. . . When "Code'd", the data appears to be right-justified - which is how nearly all business data is presented. . . icon_confused.gif

Suggest you practice using the "Code" tag so that your posts will be aligned and more readable.

Possibly, there is something i've misunderstood.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Tue Jan 04, 2011 3:27 am
Reply with quote

thats what happened. i didnt use the code tag. and yes it does help because the data was left justified in my post. thanks Dick.
now, where is that little tag anyway.....hmmmm.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Tue Jan 04, 2011 3:30 am
Reply with quote

Code:

//TOOLIN    DD *                               
 MODE STOP                                     
 DISPLAY FROM(INPUT) LIST(APDMS01) -           
 TITLE('APDMS VENDOR INVOICE VALIDATION') PAGE -
 DATE     -                                     
 TIME     -                                     
 HEADER('VENDOR ') -                           
 HEADER(' INVOICE COUNT ') -                   
 HEADER('NET AMOUNT ') -                       
 ON(1,07,CH) ON(08,05,SFF,U05) -               
 ON(013,19,SFF,C1,U14,F'$') -                   
 TOTAL('TOTALS ') -                             
 COUNT('TOTAL COUNT OF VENDORS IN FILE')       
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jan 04, 2011 3:37 am
Reply with quote

There ya go. . .

It couldn't hide for long. . . icon_wink.gif

d
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: Tue Jan 04, 2011 5:51 am
Reply with quote

madmartinsonxx,

Instead of using two passes with OUTFIL and DISPLAY, why not just add TRAILER1 to OUTFIL to get what you want in one pass? TRAILER3 is the section trailer. TRAILER1 is the report trailer (overall count and totals).
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 Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top