× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: triggers
  • From: "Stone, Brad V (TC)" <bvstone@xxxxxxxxxxxxxx>
  • Date: Wed, 11 Jul 2001 08:25:15 -0500

If you're looking for a decent starting place for triggers, here's what I
use.  It's RPG, but could be translated to COBOL or any other language
you're using:

D TrigFlds      E DS                  EXTNAME(TRGFLDPF)           
D FileImage     E DS                  EXTNAME(FILENAME)            
 *                                                                
D WPPARM1         DS                                              
D  P_Trigger                          LIKE(TrigFlds)              
D  P_Before                           LIKE(FileImage)             
D  O_FldMap                     15                                
D  P_After                            LIKE(FileImage)             
D  N_FldMap                           LIKE(O_FldMap)              
 *                                                                
D WPPARM2         DS                                              
D  T_BuffLen              1      4B 0                             

WPPARM1 and WPPARM2 are the two input parms used by a trigger.  FileImage is
an external DS defined using the filename the trigger is attached to.

O_FldMap must be set to the number of fields in the file the trigger is
attached to.  In this case there are 15 fields in the file, so the size of
this field is 15.

TRGFLDPF is used to externally define the trigger specific fields.  This is
just a PF used only for external DS definition.  It looks like this:

A          R TRGFLD                    TEXT('TRIGGER FILE')             
A            TGFILE        10          TEXT('FILE NAME')                
A            TGLIB         10          TEXT('LIBRARY NAME')             
A            TGMBR         10          TEXT('MEMBER NAME')              
A            TGEVENT        1          TEXT('TRIGGER EVENT')            
A            TGTIME         1          TEXT('TRIGGER TIME')             
A            TGCOMLEV       1          TEXT('COMMIT LEVEL')             
A            TGRSVD1        3          TEXT('RESERVED FIELD 1')         
A            TGCCSID        6  0B      TEXT('CODED CHARACTER SET ID')   
A            TGRSVD2        8          TEXT('RESERVED FIELD 2')         
A            TGO_OFFSET     6  0B      TEXT('ORIGINAL RECORD OFFSET')   
A            TGO_LEN        6  0B      TEXT('ORIGINAL RECORD LENGTH')   
A            TGO_NULLOS     6  0B      TEXT('ORIGINAL NULL OFFSET')     
A            TGO_NULLLN     6  0B      TEXT('ORIGINAL NULL LENGTH')     
A            TGN_OFFSET     6  0B      TEXT('NEW RECORD OFFSET')        
A            TGN_LEN        6  0B      TEXT('NEW RECORD LENGTH')        
A            TGN_NULLOS     6  0B      TEXT('NEW NULL OFFSET')          
A            TGN_NULLLN     6  0B      TEXT('NEW NULL LENGTH')          
A            TGRSVD3       16          TEXT('RESERVED FIELD 3')  

Once this is all defined, you add a few lines of code and you've got a
trigger "shell" program.  The only thing you need to change is the O_FldMap
as stated above to be the same number as how many fields are in the file.

C     *ENTRY        PLIST                            
C                   PARM                    WPPARM1  
C                   PARM                    WPPARM2  
 *
C                   eval      FileImage = P_After   
 * now you can do anything you want checking the values using the file name
field names


Brad
+---
| 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 thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.