Working with RC/Edit avoid unnecessary Trigger activation

Document ID:  TEC313443
Last Modified Date:  07/05/2017
{{active ? 'Hide' : 'Show'}} Technical Document Details

Products

  • CA RC/Update for DB2 for z/OS
  • CA RC/Query for DB2 for z/OS

Components

  • CA RC/Update for DB2 for z/OS:RCU
Introduction:

Do you have DB2 Triggers that process their actions based on whether a specific column's data changes? If so, be sure to follow the steps below to alter the CREATE TRIGGER DDL to avoid the DB2 Trigger action from "triggering" unnecessarily.

Instructions:

Since RC/Edit within the RC/Update product automatically updates all columns data no matter which columns data is actually changed, which reduces processing overhead, the changes below to the CREATE TRIGGER syntax will ensure the DB2 Trigger action is only processed when it should be.
 
In addition to the "REFERENCING NEW AS NROW", a line should be inserted right below it including the clause "OLD AS OROW".
 
In the Atomic text, the WHERE clause should also include "AND NROW.colname <> OROW.colname".
The symbol <> represents "not equal to" and "colname" represents the column that needs to have it's data changed for the trigger action to be run.

The following is an example using the IBM DB2 sample table DSN8710.DEPT:
 
    CREATE TRIGGER DEPTRIG1
    AFTER UPDATE OF DEPTNO ON DSN8710.DEPT
    REFERENCING NEW AS NROW
                OLD AS OROW
    FOR EACH ROW MODE DB2SQL
    BEGIN ATOMIC UPDATE DSN8710.EMP
    SET WORKDEPT = NROW.DEPTNO
    WHERE NROW.DEPTNO <>  OROW.DEPTNO; END 

Please help us improve!

Will this information enable you to resolve your issue?

Please tell us what we can do better.

{{feedbackText.length ? feedbackText.length : '0'}}/255

{{status}}

Not what you were looking for?

Search Again >

Product Information

Support by Product >

Communities

Join a Community >

Chat with CA

Just give us some brief information and we'll connect you to the right CA ExpertCA sales representative.

Our hours of availability are 8AM - 5PM CST.

All Fields Required

connecting

We're matching your request.

Unfortunately, we can't connect you to an agent. If you are not automatically redirected please click here.

  • {{message.agentProfile.name}} will be helping you today.

    View Profile


  • Transfered to {{message.agentProfile.name}}

    {{message.agentProfile.name}} joined the conversation

    {{message.agentProfile.name}} left the conversation

  • Your chat with {{$storage.chatSession.messages[$index - 1].agentProfile.name}} has ended.
    Thank you for your interest in CA.


    Rate Your Chat Experience.

    {{chat.statusMsg}}

agent is typing