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

Design : Trigger a txn based on count of records in a table


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kkalra

New User


Joined: 16 Dec 2010
Posts: 2
Location: Delhi NCR

PostPosted: Tue Jul 30, 2013 1:31 am
Reply with quote

Hello,

I have to design something that will send an automatic email if the count of records in a particular table is more than 100 records? Can you please suggest some ways to implement this?

I can think of one; where i can write a batch job that will scan the table for number of records; if the number of records > 100 trigger a new job to send the email to a group (by writing to internal reader). Also, I have to schedule the batch job to run periodically, lets say every 15 mins to monitor the count of records in the table.

Is there an easier way to accomplish this with lesser load on the system? or Avoid Batch job.

All suggestions are welcome.
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 Jul 30, 2013 8:09 pm
Reply with quote

Hello and welcome to the forum,

One way to do what you want with very little overhead is to modify the code that adds these rows to check if there are 100 (or more) rows in the table and then send the email.

If all of a sudden 1000 rowsa are inserted, there will be Lots of emails . . .

What will the email accomplish? Maybe there is an alternative.
Back to top
View user's profile Send private message
kkalra

New User


Joined: 16 Dec 2010
Posts: 2
Location: Delhi NCR

PostPosted: Wed Jul 31, 2013 12:46 am
Reply with quote

This is for an order processing system and purpose of this is to automate the monitoring of the system health. incase the order processing server is down, the orders will not be generated. Incase the orders are not generated and the backlog is more than 1000 or 5000 orders , it should send an email to the concerned person so that corrective action can be taken.

I get your point when you say that the count should be verified when the insert happens.

Also, i have a similar concern that there will be so many emails generated. For that i guess i will try to save the timestamp of last sent email - if an email was sent in last 15 mins; do not send a new email.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Wed Jul 31, 2013 12:57 am
Reply with quote

if this is a DB2 table just set a trigger when the count is greater than 100
, and have a stored procedure sent your email.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 31, 2013 4:12 am
Reply with quote

When you say "Table" is this an in-core Assembler CSECT that accumulates data or is it a storage-table (LINKAGE or WS) in the target program itself?

You could have a separate "Traffic Cop" started task (starts every 30 seconds or so), which interrogates this table and when it has reached or has exceeded 100, start a separate started task (different transid), which builds and submits an IEBGENER Job (via the SPOOL API's), which will notify the e-Mail recipient.

Or, just add code to the program which contains the table and build/submit the IEBGENER Job (via this same started task as just mentioned) when the table count is not less than 100.

But, you really need to explain this "table" concept a little better, so we can provide other scenarios.

A separate started task addressing table-storage of a completely different program can be done, but not easily.

HTH....
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top