|
Here's one, includes trigger program and a copy member that it uses:
*** Compile options
h dftactgrp(*no) actgrp(*caller) bnddir('STARRBIND')
h option(*srcstmt : *noshowcpy : *nodebugio)
********************************************************************
* Program : xxxxxxxxxX
* Date : xx/xx/xxxx
* Programmer : xxx
* Description : Trigger program for XXXXXXXXXX
* Compilation :
* Modifications :
********************************************************************
/copy qrpglesrc,trg_buffer
d sds
d userid 254 263
*** CHANGE 'filename' below to the actual physical file name.
*** Will not need new_record for delete triggers or old_record
*** for insert triggers
d old_recordp s *
d old_record e ds extname(xxxxxxxx) prefix(old_)
d based(old_recordp)
d new_recordp s *
d new_record e ds extname(xxxxxxxx) prefix(new_)
d based(new_recordp)
c *entry plist
c parm trgbuf
c eval old_recordp = %addr(trgbuf) + tbooff
c eval new_recordp = %addr(trgbuf) + tbnoff
*** INSERT TRIGGER PROGRAM CODE HERE. THE FIELD NAMES ARE PREFIXED
*** WITH OLD_ FOR THE BEFORE RECORD AND NEW_ FOR THE AFTER RECORD.
********** SAMPLE CODE FOR UPDATING USER/DATE/TIME OF UPDATE
c********** select
c********** when (tbevnt = INSERT) or (tbevnt = UPDATE)
c********** eval new_user = userid
c********** time new_usrtim
c********** other
c********** endsl
c return
Copy member
*** TRIGGER BUFFER Copy Member
*** Constants
d AFTER c '1'
d BEFORE c '2'
d DELETE c '2'
d INSERT c '1'
d UPDATE c '3'
*** Buffer data structure
d TRGBUF ds 32000
*** FILE NAME
d TBFILE 10
*** LIBRARY NAME
d TBLIB 10
*** MEMBER NAME
d TBMBR 10
*** TRIGGER EVENT (1=INSERT, 2=DELETE, 3=UPDATE)
d TBEVNT 1
*** TRIGGER TIME (1=AFTER, 2=BEFORE)
d TBTIME 1
*** TRIGGER COMMIT LEVEL
d TBCOMT 1
*** FILLER
d TBFIL1 3
*** CCSID
d TBCCSI 8B 0
*** FILLER
d TBFIL2 8
*** OLD RECORD OFFSET
d TBOOFF 8B 0
*** OLD RECORD LENGTH
d TBOLEN 8B 0
*** OLD RECORD NULL BYTE MAP OFFSET
d TBOMPO 8B 0
*** OLD RECORD NULL BYTE MAP LENGTH
d TBOMPL 8B 0
*** NEW RECORD OFFSET
d TBNOFF 8B 0
*** NEW RECORD LENGTH
d TBNLEN 8B 0
*** NEW RECORD NULL BYTE MAP OFFSET
d TBNMPO 8B 0
*** NEW RECORD NULL BYTE MAP LENGTH
d TBNMPL 8B 0
*** FILLER
d TBFIL3 16
> -----Original Message-----
> From: Eric Kempter [SMTP:eric.kempter@RobertMondavi.com]
> Sent: Monday, December 06, 1999 2:12 PM
> To: 'midrange-l@midrange.com'
> Subject: Triggers
>
> Does anyone have an example of a trigger program? I am using the trigger
> program examples from the IBM infocenter and can not determine how to
> break the 256 data structure limit for the incoming parameter. Thanks for
> any assistance.
>
> Thank you,
>
> Eric Kempter
>
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> | To unsubscribe from this list send email to
> MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
> david@midrange.com
> +---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.