× 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.



Thanks Scott, I thought I remembered seeing something from you that used _Rread.

I'll look at the .ZIP on monday.

Charles

On Fri, Sep 19, 2008 at 4:15 PM, Scott Klement
<rpg400-l@xxxxxxxxxxxxxxxx> wrote:
Hello Charles,

As you can see, the 'UPDATE sometable SET somefield = somefield' does
noting except to cause the update trigger on sometable to be fired.

Yes, I understand that. But, the UPDATE will cause an update event to
occur in the trigger, whereas a read will cause a READ event to occur in
the trigger. A READ will only fill in the "before" buffer, not both the
before and after like the update will.

So a program that reads the whole file isn't much of a substitute for
one that updates the whole file -- at least from a "testing a trigger"
point of view.

Thus, my desire for a program that gets passed a tablename,
'sometable' in this case, and a trigger program name, say 'MYTRGPGM',
which will then read each record in sometable, build an approprite
pseudo-trigger buffer and call MYTRGPGM.

Oh, I see... you're not trying to FIRE the trigger... you're trying to
build your own trigger buffer on the fly, and then CALL the program
manually... okay, I see.

Hmmm... I do have a sample program here:
http://www.scottklement.com/cpytoifs/cpytoifs.zip

This program isn't exactly what you're looking for, but perhaps will
give you a starting point. The program reads an entire PF/LF and writes
it's contents to the IFS (using the IFS APIs). Obviously, you can
remove the IFS code, and add your own code to build the trigger buffer.

You'll notice that the Ropen() in this program specifies arrseq=Y and
blkrcd=Y -- that causes the file to be read in arrival sequence
(non-keyed sequence) and enables record blocking, respectively. I did
that mainly for performance -- and I suspect that you'd want to do the
same thing, but I thought I should point it out, just in case you didn't :)

The other thing... I ignore the null field map in this program. You,
however, might want to change the code to access that null field map,
since you may want to include it in your trigger buffer.

But, otherwise, I expect it to be a good start to what you want to do.
--
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 ...

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.