Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

I need a smarter Trigger, or Trigger needs a smarter me..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I need a smarter Trigger, or Trigger needs a smarter me..

    There are two options: 1) Do not let the trigger insert new records into the PF the trigger is triggering. I think that is the normal procedure. 2) Rerieve the name of the PGM that fired the trigger; if it is the same name as the trigger, then ignore the event. Regards, Carel Teijgeler.

  • #2
    I need a smarter Trigger, or Trigger needs a smarter me..

    Thanks for the response. I have to insert into that file no way around that. Retrieving the name of the pgm is too late the trigger has already fired and incurred the overhead. This would be a great enhancement for IBM to have a trigger bypass that could be flipped/toggled when needed.

    Comment


    • #3
      I need a smarter Trigger, or Trigger needs a smarter me..

      Just a couple of thoughts about improving your trigger performance. How is your trigger written, a trigger program should be very efficient. Do you use the pointer method to map the data buffers or do your substring? The substring can take a lot longer as record length increases. Do you leave *INLR off when ending the program so any files it uses are left open? Scott Mildenberger

      Comment


      • #4
        I need a smarter Trigger, or Trigger needs a smarter me..

        Pointer method?? I use data structures to define the mandatory parms passed to the trigger. I use the RRN that invoked the trigger after that.

        Comment


        • #5
          I need a smarter Trigger, or Trigger needs a smarter me..

          How do you map the data buffers themselves since there location is dependent on other values in the trigger buffer. The code I use is below. I hope you aren't hard-coding the position of the data buffers within the trigger buffers as that is prone to break (as it did from V4R5 to V5R1). Scott Mildenberger 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

          Comment


          • #6
            I need a smarter Trigger, or Trigger needs a smarter me..

            Like you I'm a fan of external data structures, and was moving the old and new images to them. (Rather than the pointer addressing method you use.) Thanks, I learned something new.

            Comment


            • #7
              I need a smarter Trigger, or Trigger needs a smarter me..

              How do you have trgbuf defined?? How does the code look below??
              Code

              Comment


              • #8
                I need a smarter Trigger, or Trigger needs a smarter me..

                Here is my trgbuf definition: *** 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 Scott Mildenberger

                Comment


                • #9
                  I need a smarter Trigger, or Trigger needs a smarter me..

                  I have a trigger that fires after each insert. The trigger subsquently adds more records, which again fires the trigger. I test for this of course in the trigger or I'd be in the land of loop. Is there a way to tell the trigger to ignore an insert that was a result of an already handle/tested insert? This is horribly slow isn't usable because of the length of time it takes to complete.

                  Comment


                  • #10
                    I need a smarter Trigger, or Trigger needs a smarter me..

                    Thanks Scott

                    Comment

                    Working...
                    X