AS400 Trigger – Old and New Fields

5 pts.
Tags:
AS/400
AS/400 triggers
Log files
I am trying to create a log file for my physical files that shows me: the file name, the program making the change, the date of change, the name of the updated field, the old value, and the new value for that field. From what I've seen triggers only give you the RECORD old and new values but not FIELD values. Is there any way to get the old and new FIELD values since some of my records are pretty lengthy and I don't know how to go about tracking which particular field changed.
ASKED: March 23, 2012  12:23 AM
UPDATED: March 23, 2012  1:05 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

An easy solution to this is to do setup a Journal on the file and journal both before and after images. YOu do not have to do the open/close entries.

http://www.tools400.de/English/Freeware/Utilities/utilities.html

Then go to this web sites and download EXPJRNE. It works great.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Assuming you have at least V5R4, easiest way would be to journal the changes with a journal defined as MINENTDTA(*FLDBDY). Then just receive the entries and map the entry-specific data to a record image. Why do this with a trigger when a journal can do it faster, more reliably and with better performance and fewer resources and is also much more secure? A single journal could be used for all the files. ...Especially since the trigger will also need to do the same mapping to determine which field is involved. Mapping will probably involve calling the List Fields (QUSLFLD) API to generate an array of field definitions. By using the offsets of changed data, you can find the field name that corresponds. With a journal, populating the array would need to be done once per file each time you wanted to view the data. With a trigger, it would need to be done for every update process for every file. (Only per process, not necessarily per row -- if the trigger maintained the data from the API for the duration of the process. But it would get more complicated for any process that happened to update two or more different files.) Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following