How to determine if ANY fields have changed in a file, when user maintains a record of info

30 pts.
iseries v5r4
I have maintenance programs that need audit records created when someone changes any field, within a record, within my existing RPG maintenance program.

Software/Hardware used:
I5 - OS/400 V5R4

Answer Wiki

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

I quickest, most accurate, and most secure way of doing this it to Journal the PF.
You do not have to make any coding changes and it will also capture any other changes made from outside your program.
Another option is to create a trigger program that would compare the before and after images of the record. Then you could write the changes to a log, This might be better if you are only looking for selected field changes.
The last option is to modiffy your maintenance program to compare the fields from the file agains those entered by the user and write an audit record at that time.


<i>determine if ANY fields have changed</i>

Changes a field how? Through a DSPF that you wrote and displayed with a program you wrote? Through UPDDTA? Through STRSQL? Through something else?

If your programming is in control, you could compare what was returned as display input to your program against a copy of the display output from your program. If they’re different, then it was changed. If your programming is not in control, you can use a trigger program to compare ‘old record’ to ‘new record’. If those are different, then a change was made.

Are you scanning a file to see if changes were made in the past? Or is this a real-time process?

If it’s real-time, then the trigger is probably your best choice. If it’s after the fact, then proper journaling is probably the only choice you have. If proper journaling wasn’t done, then you might only be able to check against some backup of the file. If proper backups aren’t available, you probably can’t even determine <b>if</b> any changes were made.


Discuss This Question: 2  Replies

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.
  • ToddN2000
    Can be done a few ways. I agree the easiest would be to turn on journaling if you want every possibility of change being caught. If you are only interested in changes within the application you could store the fields in a data structure when retrieved, then compare the values before the update is done.
    136,960 pointsBadges:
  • TomLiotta
    Note that journaling for this purpose may require both before and after images. Also, recent database journal enhancements allow CRTJRN MINENTDTA(*FLDBDY) which might make STRJRNPF IMAGES(*BOTH) more attractive -- at the cost of potentially more complex auditing. Tom
    125,585 pointsBadges:

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.

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


Share this item with your network: