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

DFSORT ICETOOL Question Summing and Totaling


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

New User


Joined: 03 May 2010
Posts: 13
Location: Malvern PA

PostPosted: Mon May 03, 2010 8:14 pm
Reply with quote

My input dsn is a FBA report that contains data that I wish to summarize and produce just a total of the number of occurances and a SUM of the number of lines. My input records look like....


Code:
 CICSRJE1 J026976 G5897    SMSSYHT        105  D  R102
 CICSRJE1 J713840 G7011    SMSSYHT      62125  D  R102
 ARMWP50  J756526 G1       SMSPROD        171  F  R102
 ARMWP50  J756550 G1       SMSPROD        164  F  R102
 PAMWF50  J828641 G1       SMSPROD         18  F  R102
 PAMWF50  J725056 G1       SMSPROD      20802  F  R102
 CICSRJE1 J617658 G3386    SMSSYHT         43  D  R147
 CICSRJE1 J184491 G1384    SMSSYHT         57  D  R165
 CICSRJE1 J323451 G703     SMSSYHT         57  D  R165
 CICSRJE1 J462147 G1095    SMSSYHT         57  D  R165
 CICSRJE1 J594882 G946     SMSSYHT         57  D  R165
 CICSRJE1 J594882 G6592    SMSSYHT         15  D  R165
 CICSRJE1 J594882 G10600   SMSSYHT         12  D  R165
0CICSRJE1 J713840 G6987    SMSSYHT         71  D  R165
 CICSRJE1 J713840 G1698    SMSSYHT       6132  D  R165


Each line displays a sysout and the number of lines and the destination.

Columns 51 for a length of 8 contain the JES2 destid and columns 39 for a length of 9 contain the number of lines of the report.

I would like to generate an output file that breaks by the data in column 51 (destination) and produces a line that summarizes by destination and totals the number of lines by destination.

For example I would like an output file like

Code:
DEST           Tot LINES       Num Rpts
R102              1232345           6
R147                   43           1
R165              1234567           8


Nick
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 May 03, 2010 11:00 pm
Reply with quote

Here's a DFSORT job that will do what you asked for. I assumed your input records were already sorted by the dest field as shown in your example. (The output totals you show don't correspond to the input amounts, but I ignored that.)

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    HEADER2=('Dest           Tot Lines       Num Rpts'),
    SECTIONS=(51,8,
      TRAILER3=(51,8,17:TOT=(39,9,UFF,M10,LENGTH=9),
          33:COUNT=(M10,LENGTH=5)))
/*
Back to top
View user's profile Send private message
nickciancio

New User


Joined: 03 May 2010
Posts: 13
Location: Malvern PA

PostPosted: Mon May 03, 2010 11:50 pm
Reply with quote

Thank you so much for the accurate and quick response. The sample you supplied worked perfectly!


I really need to sit down and spend some time reading the Sort and tool documentation.

With that said, how can I (if it can be done) only print records that exceed a limiting value (for example if the count exceeds 200 or TOT exceeds 100K ) ?

Thanks in advance...

Nick
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 May 04, 2010 1:08 am
Reply with quote

Quote:
how can I only print records that exceed a limiting value (for example if the count exceeds 200 or TOT exceeds 100K ) ?


You can use a DFSORT/ICETOOL job like the following:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
    HEADER2=('Dest           Tot Lines       Num Rpts'),
    SECTIONS=(51,8,
      TRAILER3=(51,8,17:TOT=(39,9,UFF,M10,LENGTH=9),
          33:COUNT=(M10,LENGTH=5)))
/*
//CTL2CNTL DD *
  INCLUDE COND=(1,4,CH,EQ,C'Dest',OR,
    33,5,UFF,GT,200,OR,17,9,UFF,GT,100000)
/*
Back to top
View user's profile Send private message
nickciancio

New User


Joined: 03 May 2010
Posts: 13
Location: Malvern PA

PostPosted: Tue May 04, 2010 5:02 pm
Reply with quote

Thank You very much!!!

....This has saved me an enormous amount of time and effort, which I plan to use to educate myself on all the neat tricks that this product can perform.

Thank !

Nick
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 May 04, 2010 11:04 pm
Reply with quote

Glad to help.
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
Search our Forums:

Back to Top