× 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.







I added a before update trigger to a file, calling my program. When
running in debug with UPDPROD(*YES), I can see and verify the after
image buffer is updated in the program. However, the changes are not
flowing to the file. No errors in processing, the calling program
(WRKDBF), or the job log. I changed the program owner to match the file.
It's as if the after image buffer is ignored. This is a DDS-defined file
with no null values.



OR_TXANT2 OF ORRECORD = 'BLAH2345 '

OR_TXWUVA OF ORRECORD = 00000000000.00



NW_TXANT2 OF NWRECORD = 'B '

NW_TXWUVA OF NWRECORD = 00000000058.68



I've used this trigger template program many times in the past without
incident, and just don't see what's different here. The trigger template
is from Pete Hall's web site (down now?).



===> ADDPFTRG FILE(VNGDBDTA/DBTXREP) TRGTIME(*BEFORE) TRGEVENT(*UPDATE)
PGM(LG/TRGEDBTX)

Trigger QSYS_TRIG_VNGDBDTA___DBTXREP____000001 in library VNGDBDTA was
added to file DBTXREP in library VNGDBDTA.

Trigger added to physical file.



The program:

h usrprf(*owner)

h dftactgrp(*no) actgrp(*caller)



fdblurel1 if e k disk usropn



d Buffer ds 32767

d PFName 10

d PFLibrary 10

d PFMember 10

d TrgEvent 1

d TrgTime 1

d TrgCmtLvl 1

d 3

d TrgCCSID 7b 0

d 8

d OrOffset 7b 0

d OrRcdLen 7b 0

d OrNBMapOfs 7b 0

d OrBNMapLen 7b 0

d NwOffset 7b 0

d NwRcdLen 7b 0

d NwNBMapOfs 7b 0

d NwNBMapLen 7b 0

d DataSpace 1 32767

d Bytes 1 overlay(dataspace) dim(32767)



d BufferLen s 7b 0



d @OrRecord s * inz(*null)

d OrRecord e ds extname(dbtxrep) prefix(OR_)

d based(@OrRecord)



d @NwRecord s * inz(*null)

d NwRecord e ds extname(dbtxrep) prefix(NW_)

d based(@NwRecord)



d TE_INSERT c '1'

d TE_DELETE c '2'

d TE_UPDATE c '3'



c *entry plist

c parm Buffer

c parm BufferLen



/free



// Assign record templates to their data space.

@orrecord = %addr(bytes(oroffset+1));

@nwrecord = %addr(bytes(nwoffset+1));



// Execute the correct procedure based on the trigger event.

select;

when trgevent = TE_INSERT;

exsr DoInsert;

when trgevent = TE_UPDATE;

exsr DoUpdate;

when trgevent = TE_DELETE;

exsr DoDelete;

endsl;

*inlr = *on;

return;



begsr DoDelete;

endsr;



begsr DoInsert;

// Restrict to work order charges with employee hours.

if nw_txz4c3 = 'PRDACT' // Transaction type.

and nw_txesst = 'L' // Cost category.

and nw_txp5t2 = 'A12345678' // Item number.

and nw_txavt2 <> *blanks // Employee number available.

and nw_txwuva = 0; // No cost for this work order.

if %open(dblurel1);

close dblurel1;

endif;

open dblurel1;

chain(n) (nw_txazcd:nw_txavt2) @lureje;

if %found;

// Work order hours * employee rate.

nw_txwuva = nw_txqan2 * luxbnb; // Employee's rate.

else;

nw_txwuva = nw_txqan2 * 15.00; // Default rate.

endif;

close dblurel1;

endif;

endsr;



begsr DoUpdate;

exsr doinsert;

endsr;



/end-free



Loyd Goodbar

Senior programmer/analyst

BorgWarner

TS Water Valley

662-473-5713




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.