Audit trail of masterfile changes
Jeff Hoffman
J.Hoffman@cchs.usyd.edu.au
Sat, 08 May 1999 09:09:03 +1000
Clifford
Triggers are best if you have a relational data base that support them, as
then all the coding is in one place and you do not have to worry about each
program.
However for the rest of us, Chris's idea looks good to me, try:
File Audit
Record Audit
ele user char*size of largest possible user name
ele date date
ele time
ele file_name char*size of largest possible file name
ele field_name char*size of largest possible field name
ele changed_from char*size of largest field
ele changed_to char*size of largest field
Then in each update program
file audit designer occurs N (where N is the number of fields to be audited)
temp t_file_name char*?
temp t_field_name char*?
temp t_changed_from char*?
temp t_changed_to char*?
procure internal out_audit
begin
for audit (or for N ;where N is the number of occurrances of audit)
begin
; just in case they change the same field more than once
if file_name of audit = t_file_name and &
field_name of audit = t_field_name
then begin
let date of audit = sysdate
let time of audit = systime
let changed_to of audit = t_changed_to
break
end
; first change of field
else if field_name of audit = " "
then begin
let user of audit = signonuser (or what ever you use to ID
users)
let date of audit = sysdate
let time of audit = systime
let file_name of audit = t_file_name
let field_name of audit = t_field_name
let changed_to of audit = t_changed_to
let changed_from of audit = t_changed_from
break
end
end
end
procedure edit field_name (one of these for each field to be audited)
begin
...
... (nornal edit routines)
...
let t_file_name = "YYYYYY"
let t_field_name = "XXXXXX"
let t_changed_from = oldvalue(XXXXXX)
let t_changed_to = XXXXXX
do internal out_autit
end
procedure edit field_name (one of these for each field to be audited)
begin
...
... (nornal edit routines)
...
let t_file_name = "YYYYYY"
let t_field_name = "XXXXXX"
let t_changed_from = ascii(oldvalue(XXXXXX)) (or use formatnumber)
let t_changed_to = ascii(XXXXXX) (or use formatnumber)
do internal out_autit
end
procedure postupdate (or include in update procedure)
begin
for audit
begin
if t_file_name <> " " and & ;(This part of the test may not be
necessary)
changed_from of audit <> changed_to of audit
then put audit
end
end
What ever way you do it this is going to be ugly, if you put this in
appropriate use files , maintenance should be minimal.
Good Luck
At 12:11 pm 7/05/99 +0200, you wrote:
>Anyone have a low maintenance method of writing audit trail records to a
>file when users update masterfile records.
>We want to keep the following info on a file so the users can see it:
>user
>date
>time
>masterfile name
>masterfile field
>changed from
>changed to
>
>We currently call a cobol program in the pre-update procedure passing the
>masterfile record.
>The cobol program reads the original record and compares all the fields one
>by one writing
>the audit trail records. It works but is a lot of work to maintain as our
>masterfiles are
>constantly changing.
>
>The audit file option doesn't seem to help as it only stores an after image
>of all the fields changed.
>Anyone have a better, preferably low maintenance way of doing this...
>
>PH 7.29.C5 on MPE/iX
>
>Thanks
>Clifford Art
>cart@metropolitan.co.za
>
>= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
>Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
>Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
>powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
>This list is closed, thus to post to the list, you must be a subscriber.
>
>
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ Jeff Hoffman + e-mail: J.Hoffman@cchs.usyd.EDU.AU +
+ Director + +
+ WoniCon Pty Ltd + ,-_|\ +
+ 21 Prices Circuit + voice: +61 2 9542 1527 / \ +
+ Woronora NSW 2141 + fax: +61 2 9521 3979 \_,-._* +
+ AUSTRALIA + v +
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.