Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Counts Using ICETOOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ballaswaroop

New User


Joined: 20 Sep 2005
Posts: 24

PostPosted: Wed Mar 05, 2014 3:33 pm    Post subject: Counts Using ICETOOL
Reply with quote

I've a file which has the following Data

IMA06010
IMA06010
IMA06010
IMA06010
IMA06010
IMA06012
IMA06012
IMA06012
IMA06012
IMA06012
IMA06018
IMA06018
IMA06018
IMA06018
IMB06122
IMB06122
IMB06122

I would like to have the O/P as

IMA - 6010 - Count = 5
IMA - 6012 - Count = 5
IMA - 6018 - Count = 4
IMB - 6122 - Count = 3
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Mar 05, 2014 4:59 pm    Post subject: Reply to: Counts Using ICETOOL
Reply with quote

Have you looked at ICETOOL's OCCURS operator?
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 73
Location: Boston

PostPosted: Wed Mar 05, 2014 5:11 pm    Post subject: Reply to: Counts Using ICETOOL
Reply with quote

One way of doing this could be as below, but might not be the most efficient way..

Code:

//STEP010  EXEC PGM=ICETOOL     
//*                             
//TOOLMSG DD SYSOUT=*           
//SSMSG   DD SYSOUT=*           
//*                             
//SORTIN   DD *                 
IMA06010                       
IMA06010                       
IMA06010                       
IMA06010                       
IMA06010                       
IMA06012                       
IMA06012                       
IMA06012                       
IMA06012                       
IMA06012                       
IMA06018                       
IMA06018                       
IMA06018                                     
IMA06018                                     
IMB06122                                     
IMB06122                                     
IMB06122                                     
//*                                         
//CTL3JNF1 DD DSN=X1,   
//            DISP=(,CATLG,DELETE),         
//            SPACE=(CYL,(1,1),RLSE)       
//*                                         
//CTL3JNF2 DD DSN=X2,   
//            DISP=(,CATLG,DELETE),         
//            SPACE=(CYL,(1,1),RLSE)       
//TOOLIN DD *                                             
 SORT FROM(SORTIN)   TO(CTL3JNF1) USING(CTL1)             
 SORT FROM(CTL3JNF1) TO(CTL3JNF2) USING(CTL2)             
//*                                                       
//CTL1CNTL DD *                                           
  OPTION COPY                                             
  INREC OVERLAY=(79:C'1')                                 
    OUTFIL FNAMES=CTL3JNF1,REMOVECC,                     
      SECTIONS=(5,4,                                   
        TRAILER3=(1,3,C'-',5,4,C'-COUNT=',TOT=(79,1,ZD)))
//*                                                       
//CTL2CNTL DD *                                           
  OPTION COPY                                             
  INCLUDE COND=(4,1,CH,EQ,C'-')                           
  INREC BUILD=(1,80,SQZ=(SHIFT=LEFT))                     
//*                                                       
//SYSOUT   DD SYSOUT=*



Thanks,
Ashwin.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Mar 06, 2014 11:16 pm    Post subject: Re: Reply to: Counts Using ICETOOL
Reply with quote

hailashwin wrote:
One way of doing this could be as below, but might not be the most efficient way..


hailashwin,

I appreciate your enthusiasm on providing solutions but if do think it is not efficient solution, please refrain from posting it. As Bill mentioned earlier you can use OCCUR operator or simple reporting features in DFSORT to get the desired results.

You don't need 2 passes of data to get the desired results. You Just need the parm NODETAIL. Check this link which explains in detail about NODETAIL

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1ca60/3.15

Code:

//STEP0100 EXEC PGM=ICETOOL                         
//TOOLMSG  DD SYSOUT=*                             
//DFSMSG   DD SYSOUT=*                             
//IN       DD *                                     
IMA06010                                           
IMA06010                                           
IMA06010                                           
IMA06010                                           
IMA06010                                           
IMA06012                                           
IMA06012                                           
IMA06012                                           
IMA06012                                           
IMA06012                                           
IMA06018                                           
IMA06018                                           
IMA06018                                           
IMA06018                                           
IMB06122                                           
IMB06122                                           
IMB06122                                           
//RPT      DD SYSOUT=*                             
//TOOLIN   DD *                                     
OCCUR FROM(IN) LIST(RPT) -                         
DATE TITLE('COUNTS BY ID AND SEQUENCE') TIME PAGE -
BLANK -                                             
HEADER('ID') ON(1,3,CH) -                           
HEADER('SEQUENCE') ON(5,4,CH) -                     
HEADER('COUNT') ON(VALCNT,A1)                       
//*


The output from this job is
Code:

03/06/14        COUNTS BY ID AND SEQUENCE        10:34:57        - 1 - 
                                                                       
ID    SEQUENCE                  COUNT                                   
---   --------   --------------------                                   
IMA   6010                          5                                   
IMA   6012                          5                                   
IMA   6018                          4                                   
IMB   6122                          3                                   


Alternatively you can use the following JCL with reporting features.

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                                 
IMA06010                                       
IMA06010                                       
IMA06010                                       
IMA06010                                       
IMA06010                                       
IMA06012                                       
IMA06012                                       
IMA06012                                       
IMA06012                                       
IMA06012                                       
IMA06018                                       
IMA06018                                       
IMA06018                                       
IMA06018                                       
IMB06122                                       
IMB06122                                       
IMB06122                                       
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                                 
  OPTION COPY                                   
  OUTFIL REMOVECC,NODETAIL,                     
  SECTIONS=(1,3,5,4,                           
  TRAILER3=(1,3,' - ',5,4,' - COUNT = ',COUNT))
//*


The output from this is
Code:

IMA - 6010 - COUNT =        5         
IMA - 6012 - COUNT =        5         
IMA - 6018 - COUNT =        4         
IMB - 6122 - COUNT =        3         
Back to top
View user's profile Send private message
ballaswaroop

New User


Joined: 20 Sep 2005
Posts: 24

PostPosted: Fri Mar 07, 2014 12:43 pm    Post subject:
Reply with quote

Thank You !

Part - 2 Of the requirement is to generate a alert when the count falls below a tresh hold

Eg:
IMA - 6010 - COUNT = 5
IMA - 6012 - COUNT = 5
IMA - 6018 - COUNT = 4
IMB - 6122 - COUNT = 3


If IMA - 6012 - COUNT = 5 ie row 2 falls below 3 for example we would like to generate a alert by sending email to the concern team. Will that be possible to do the validation via SORT ?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Mar 07, 2014 1:11 pm    Post subject: Reply to: Counts Using ICETOOL
Reply with quote

If all that you require can be done by manipulating data in files, then probably Yes.

Specifically to your question, we can't know, as your question is far too general.
Back to top
View user's profile Send private message
ballaswaroop

New User


Joined: 20 Sep 2005
Posts: 24

PostPosted: Fri Mar 07, 2014 4:19 pm    Post subject:
Reply with quote

If the count in any particular row falls below a tresh hold I want to generate an alert.

eg: if for row 2 IMSA-6012-Count=5 falls below a pre defined treshold say 3 then I want a alert say email to be triggered.

Let me know if you need any more details.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Mar 07, 2014 6:38 pm    Post subject: Reply to: Counts Using ICETOOL
Reply with quote

Let's say you have a file containing your e-mail, such that by writing it to a sysout dataset with the appropriate settings, it will be sent (or to any file which will be processed afterwards would also be fine).

Let's say you have a file from which you can select data which requires an e-mail to be sent.

It would then be possible to use a cartesian join with JOINKEYS to output, modified if necessary, e-mails for records matching selection criteria.

So if you have, or can get, e-mails working in that way for you, the rest will be quite simple.

This is what I meant earlier.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 07, 2014 10:25 pm    Post subject:
Reply with quote

ballaswaroop wrote:
Part - 2 Of the requirement is to generate a alert when the count falls below a tresh hold


So when is Part -3 or Part -4 or Part - n requirement coming up? I always wonder why people show a part of the requirement and when a solution is provided for the specific task they change it or keep on appending requirements to it which makes the solution a moot.

ballaswaroop wrote:
If the count in any particular row falls below a tresh hold I want to generate an alert.

eg: if for row 2 IMSA-6012-Count=5 falls below a pre defined treshold say 3 then I want a alert say email to be triggered.

Let me know if you need any more details.


Take a look at Hailashwin's solution and take the first part of it where he appends a "1" to every record. You need to expand it and sum on it and use OUTFIL Include/Omit and get the desired results.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts ICETOOL/SYNCSORT - SYSPRINT output nartcr DFSORT/ICETOOL 17 Wed Oct 05, 2016 10:46 pm
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am
No new posts ICETOOL higher option Anshul Das DFSORT/ICETOOL 14 Thu Apr 14, 2016 8:00 am
No new posts Compare Files and extract matching re... vimalravi83 DFSORT/ICETOOL 3 Wed Jan 06, 2016 2:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us