|
Kevin,
I thought about what you suggested and was not sure if the overhead was
worth the effort. But the journaling suggestion looks intriguing. I have
never worked with triggers before. I looks like the journal store the entire
record and not just the changed field(s). So, with that, it looks like I
still have to find out what changed and be able to display it to the users.
So, trigger or journal, or ???....
Feedback always appreciated...
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Kevin Wright
Sent: Wednesday, August 27, 2008 9:11 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: trigger program question
Hi Tim,
Here are a few ideas:
1. Journal the file. Depending on OS version there are options to not record
"non-changes". This would arguably perform the fastest. Refer to Chuck's
answer for other details.
2. Write a "trigger program generator", which would perform reasonably well
as long as not in *NEW activation group and doesn't seton LR, which would
involve:
a) A skeleton with the invariant bits, and place markers for the variant
bits
b) A mechanism for replacing parts of lines and inserting whole lines that
could be run from an input parameter of the file name and library name, and
could involve reading in a DSPFFD outfile, or calling a slightly complex
API.
c) Regenerating the trigger program each time the file was changed
3. Write a "one size fits all" trigger program which would query the above
mentioned API on the fly, and could use character arrays on the record
buffers and do character comparisons based on the lengths in bytes. This
would perform more poorly based on the API call possibly needed.
Regards,
Kevin Wright.
-----Original Message-----
From: tim [mailto:tim2006@xxxxxxxxxxx]
Sent: Thursday, 28 August 2008 10:34 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: trigger program question
I have a trigger program to log any changes in a file. Here is snippit:
D OldRecord E DS ExtName(filea)
D Prefix(O_)
D Based(OldRecPtr)
D NewRecord E DS ExtName(filea)
D Prefix(N_)
D Based(NewRecPtr)
if n_name <> o_name;
writediff('name':o_name);
endif;
if n_salut <> o_SALUT ;
writediff('Salutation' : o_SALUT );
endif;
I repeat this logic for each field in the file. If I have a file with many
fields, it can be quite tedious.
I was wondering if this could be done a different way so that as I add more
files to this logging process, all I would have to do is change a file name
or something. I was thinking it would have something to do with pointer
logic, but not sure where to start.
Thanks.
--
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.
--
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.
--
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 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.