Database Triggers and Database Operations in RPGLE
Last Post 07 Dec 2012 07:28 AM by JJ Dahlheimer. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
BrianB13
New Member
New Member
Posts:68
Avatar

--
06 Dec 2012 04:09 PM

If you have database triggers over a file and a program executes a Read statement and a trigger program is called, can the trigger program manipulate the data in the record being retrieved by the Read statement in the program before it is read into the program?  I have a situation where depending upon which user is accessing the data, some of the data in the fields being retrieved by the read could come form a different file.  Would the same thing be true of a Write statement in a program where a trigger program could alter what is actually being written out to a file?  I have used triggers quite a bit but never tried to do this.  Thanks.


Brian

Crispin
Veteran Member
Veteran Member
Posts:1501

--
07 Dec 2012 05:18 AM

Brian,

I think both of what you are asking can be achieved, by updating the file buffer in the trigger. For the write, have a look at hte ALWREPCHG keyword on the ADDPFTRG command.

Crispin.

JJ Dahlheimer
Advanced Member
Advanced Member
Posts:626

--
07 Dec 2012 07:28 AM
You might also look at instead of triggers, though I think those only work on views. Seems though this is going is to a serious performance drag, I have never done a trigger on a read operation but I know it is not recommended. Wouldn't it be better just to have two programs and only give permissions to run based on the user name?
You are not authorized to post a reply.

Acceptable Use Policy