I am unclear on what exactly you want to know. The general process is to 1) write the RPGLE program that contains the instructions you want to execute when a record is added to the PF; 2) compile the program; 3) attach the RPGLE object to the physical file using the CHGPF command or the ADDPFTRG command (you must have the proper object authority on the PF to do this and I believe the PF cannot already be locked by another user); 4) in the CL command parameters identify when you want the trigger to fire (*BEFORE *INSERT and/or *AFTER INSERT).
It has been my experience that you will encounter fewer authority problems if the owner of the trigger program is the same as the owner of the PF (or at least has *ALL authority on the PF object).
The <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp”>IBM Information Center</a> is where you should be looking for information on triggers and for examples, not here. You should come here for explanation of parts that you don’t understand or for help when IBM examples don’t work for you. Go look where you are supposed to look and get solid information.
One place you would have found sooner is the <a href=”http://www.redbooks.ibm.com/abstracts/sg246503.html”>Stored Procedures, Triggers, and User-Defined Functions on DB2 Universal Database for iSeries</a> RedBook. That’s where you’ll find every related example you’ll need.