Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
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
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 ?
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
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.