MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COUNT and SUM of fields using ICETOOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
pai_sunil_bs
Beginner


Joined: 19 Sep 2005
Posts: 21
Topics: 11

PostPosted: Mon Oct 05, 2020 9:23 pm    Post subject: COUNT and SUM of fields using ICETOOL Reply with quote

Hello,

I scanned the board before posting the query.

Query: Is it possible to get COUNT and SUM of fields in ICETOOL just like we have in DB2. I know it is possible in DFSORT and also we have OCCURS in ICETOOL to get count of grouped fields using VALECNT. However, I am struggling to get summation of amounts against same set of grouped fields.

For example:Imagine you have a file with LRECL=80. You have employee ID as first 10 character followed by 2 byte state code (MH, JK etc) followed by 2 byte numeric field depicting years of experience.


So output should have State, Number of employees, Consolidated experience.

Thank You

Sunil
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Mon Oct 05, 2020 11:24 pm    Post subject: Re: COUNT and SUM of fields using ICETOOL Reply with quote

pai_sunil_bs wrote:

For example:Imagine you have a file with LRECL=80. You have employee ID as first 10 character followed by 2 byte state code (MH, JK etc) followed by 2 byte numeric field depicting years of experience.


So output should have State, Number of employees, Consolidated experience.

Thank You

Sunil


Pai_sunil_bs

try this untested DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DISP=SHR,DSN=Your input FB 80 byte file
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *                                       
  SORT FIELDS=(11,02,CH,A)      # STATE
                     
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),               
   HEADER2=('STATE|COUNT|EXPERIENCE|',/,             
           '-----|-----|----------|'),               
  SECTIONS=(11,2,                                     
  TRAILER3=(04:11,02,'|',                             
            07:COUNT=(M10,LENGTH=5),'|',             
            15:TOTAL=(13,02,UFF,M10,LENGTH=8),'|')),
  TRAILER1=(23'-'/,                                   
            'TOTAL|',                                 
            07:COUNT=(M10,LENGTH=5),'|',             
            15:TOTAL=(13,02,UFF,M10,LENGTH=8),'|')   
                                                     
/*   

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pai_sunil_bs
Beginner


Joined: 19 Sep 2005
Posts: 21
Topics: 11

PostPosted: Tue Oct 06, 2020 12:49 am    Post subject: Reply with quote

Thanks Kolusu. I am aware of the SORT. What I am looking for is whether the same is possible via ICETOOL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Tue Oct 06, 2020 10:12 am    Post subject: Reply with quote

pai_sunil_bs wrote:
Thanks Kolusu. I am aware of the SORT.


Really? I don't think so

pai_sunil_bs wrote:
What I am looking for is whether the same is possible via ICETOOL.


Huh? Do you realize that ICETOOL actually invokes SORT? Sigh ! Check this topic of how you can convert to ICETOOL.

https://www.mvsforums.com/helpboards/viewtopic.php?t=12731&highlight=icetool
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pai_sunil_bs
Beginner


Joined: 19 Sep 2005
Posts: 21
Topics: 11

PostPosted: Tue Oct 06, 2020 1:31 pm    Post subject: Reply with quote

I am no comparison to you Kolusu in terms of knowledge!
What I meant to say was that I am aware that my requirement can be met through SORT. I am also aware that ICETOOL invokes SORT.
I am only curious to know if ICETOOL operators within TOOLIN itself give us the flexibility to get count and amount together (without having to code additional DFSORT statements within XXXXCNTL).
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Tue Oct 06, 2020 3:23 pm    Post subject: Reply with quote

pai_sunil_bs wrote:
I am no comparison to you Kolusu in terms of knowledge!


It is NOT the question of who is knowledgeable here. Being knowledgeable is relative. Everyone is knowledgeable in their own way.

pai_sunil_bs wrote:

What I meant to say was that I am aware that my requirement can be met through SORT. I am also aware that ICETOOL invokes SORT.
I am only curious to know if ICETOOL operators within TOOLIN itself give us the flexibility to get count and amount together (without having to code additional DFSORT statements within XXXXCNTL).


ICETOOL's DISPLAY Operator can give you total and counts, however you need to have the file sorted on the STATE prior to invoking the DISPLAY operator. So that would be 2 passes of the data which is quite unnecessary.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pai_sunil_bs
Beginner


Joined: 19 Sep 2005
Posts: 21
Topics: 11

PostPosted: Sun Oct 11, 2020 10:41 am    Post subject: Reply with quote

Thanks Kolusu. Using DISPLAY ON "experience" field, I put a BREAK on the "STATE" field and then used BCOUNT and BTOTAL. I am getting the desired results. Thanks for your guidance.
But what I found is that the output is not user friendly.
It comes something like this
MH
(40,2,ZD)
+0000000012
COUNT0000000001
TOTAL
+0000000012

What I was looking for
MH 00001 00012

i.e. state, count, total like a normal report

I tried HEADER, BTITLE etc but could not the desired output.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group