Here's a template that I brought from a prior job. Haven't used it recently, but I believe it is fairly efficient using pointers instead of moving records to data structures. Obviously you have to add your logic in the Insert, Delete and Update routines.

Sam

*=== Output File ==============================================
F*RBHDRPA O E K DISK

*=== Data Structures for Old and New Records ===================
DOld_Rcd E DS extname($MENUOPT)
D prefix(O_)
D based(OPtr)
DNew_Rcd E DS extname($MENUOPT)
D prefix(N_)
D based(NPtr)

DOPtr s *
DNPtr s *

*=== Passed Trigger Buffer =====================================
DBuffer DS 32767

*--- Physical File Name
D FileName 10
*
*--- Physical File Library.
D LibraryName 10
*
*--- Member Name.
D MemberName 10
*
*--- Trigger Event.
D TrgEvent 1
*
*--- Trigger Time.
D TrgTime 1
*
*--- Commit Lock Level.
D CommitLckLvl 1
*
*--- Reserved.
D Filler1 3
*
*--- CCSID.
D CCSID 10I 0
*
*--- Reserved.
D Filler2 8
*
*--- Offset to the Original Record.
D OldOff 10I 0
*
*--- Length of the Original Record.
D OldLen 10I 0
*
*--- Offset to the Original record null byte map.
D OldNullOffset 10I 0
*
*--- Length of the null byte map.
D OldNullLength 10I 0
*
*--- Offset to the new record.
D NewOff 10I 0
*
*--- Length of the new record.
D NewLen 10I 0
*
*--- Offset to the new record null byte map.
D NewNullOffset 10I 0
*
*--- Length of the null byte map.
D NewNullLength 10I 0
*
*--- Reserved.
D Resv3 16


D BufLen s 10I 0

*=== Passed Parameters =========================================
C *ENTRY plist
C Buffer parm Buffer
C BufLen parm BufLen


//=== Program flow starts here ==================================

/FREE
select;
when TrgEvent = '1';
exsr Insert;
when TrgEvent = '2';
exsr Delete;
when TrgEvent = '3';
exsr Update;
endsl;

*inlr = *on;

//=== Insert ====================================================
//
begsr Insert;
NPtr=%addr(Buffer) + NewOff;
endsr;

//=== Delete ====================================================
//
begsr Delete;
OPtr=%addr(Buffer) + OldOff;
endsr;
//
//=== Update ====================================================
//
begsr Update;
NPtr=%addr(Buffer) + NewOff;
OPtr=%addr(Buffer) + OldOff;
endsr;

/END-FREE


On 5/10/2011 7:54 PM, jmmckee wrote:
Seeing a working example would be helpful. Thanks.

John McKee

This thread ...


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

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