× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Add a sequence number to your history file, and make it part of a unique key
on that file. Create a data area to hold the next sequence number. In the
trigger program, *LOCK IN(E) the data area, get the number, write it to both
the BI and AI records, increment the sequence number by 1, and OUT the data
area. Put a loop on the *LOCK IN(E) so that if the %ERROR indicator is on,
keep trying until the lock goes away. That way, no two change records will
ever have the same sequence number, and the history records will be unique,
even if two or more records have exactly the same information.


Regards,
Francis Lapeyre
Me transmitte sursum, Caledoni!




-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Vijaykrishna_Malladi
Sent: Friday, July 8, 2005 3:37 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: A critical Query on Triggers


Hello folks,

I have a Query on triggers in AS400.
We have an update trigger program (coded in RPGLE) on  a Physical file which
writes 2 records for an update (Before Image, say BI and After image, say AI
of the record being updated in the PF) into another PF which we call as a
history file.
We want to process the History file in the same sequence, i.e., the BI and
AI should be in pairs. so that we can read them sequentially and by the
change code field in the 2nd file, we determine whether it is BI or AI.

My problematic situation is: Suppose if two batch programs are updating the
same file, there may be a chance that a BI for one of them is written in the
History file and before the AI is written, the BI of some other record
update would be written (even though, we have coded the write statements for
the BI & AI, immediately one after other). This may happen because AS400 is
very fast. Actually will this happen? if a trigger program is running, will
it run only in one instance? or multiple instances is also possible at the
same time?

Any help in this would be highly appreciated. Since we are executing a big
project based on this here.

Thanks in Advance,
Regards,
Vijay

**************** CAUTION - Disclaimer ***************** This e-mail contains
PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the
addressee(s). If you are not the intended recipient, please notify the
sender by e-mail and delete the original message. Further, you are not to
copy, disclose, or distribute this e-mail or its contents to any other
person and any such actions are unlawful. This e-mail may contain viruses.
Infosys has taken every reasonable precaution to minimize this risk, but is
not liable for any damage you may sustain as a result of any virus in this
e-mail. You should carry out your own virus checks before opening the e-mail
or attachment. Infosys reserves the right to monitor and review the content
of all messages sent to or from this e-mail address. Messages sent to or
from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.