|
Thanks Alan.
So, I've made both the trigger program and the data queue listener program
MAIN programs with named AGs. In my performance tests, the trigger program
is about 50% faster.
For testing purposes, I opened another interactive session and called the
data queue listener program. It waits until there is a record insert,
update, or delete in the triggered file. Then the program ends. Other
than that, it works as expected (adds records to a log file). I noticed in
your example that there is a Return op code, and I have one in mine.
Should I be coding some kind of loop? How does the loop terminate, say,
when I need to shut down the subsystem where the listener programs run?
h ActGrp('TRG001RRDQ')
DftActGrp(*No)
h
Main(RcvDtaQ001)
p RcvDtaQ001
b
fTRG001H o e
disk
d TriggerRecord e ds ExtName( OWNER
)
d
Qualified
d TrgType 1 Overlay( TriggerRecord : *Next
)
d TrgTmStamp z Overlay( TriggerRecord : *Next
)
d OutputRecord e ds ExtName( TRG001H : *Output
)
d Sequence# s 15 0
Static
d DtaQLength s 5p 0
Static
d RcvDtaQ pr ExtPgm( 'QRCVDTAQ'
)
d dtaqname 10A
const
d dtaqlib 10A
const
d dtaqlen 5P 0
const
d data 32766A const
options(*varsize)
d dtaqwait 5P 0
const
RcvDtaQ( 'TRG001DTAQ' : '*LIBL' : DtaQLength : TriggerRecord : -1
);
Eval-Corr OutputRecord = TriggerRecord;
Sequence# =+ 1;
TrgSequenc = Sequence#;
Write TRG001Hr OutputRecord;
Return;
p RcvDtaQ001 e
On Thu, Apr 7, 2016 at 6:22 PM, Alan Campin <alan0307d@xxxxxxxxx> wrote:
The other thing to think about assuming your at V6R1 or higher. Make any--
callable program a Main program. It eliminates the cycle, runs aobut 20%
faster and cuts size of program.
Going to use free format here. Easy enough to translate back to fixed.
Use a named activation group for best performance and assuming all this
program is going to do is write to data queue. Always recommend mediator.
In that case, this would be a very simple Service Program.
**FREE
ctl-opt Option(*Srcstmt:*Nodebugio:*Nounref);
ctl-opt Main(ProcessTransaction);
dcl-ds TD_DbTriggerBuffer Qualified Template;
PhysicalFileName Char(10);
PhysicalFileLibrary Char(10);
PhysicalFileMember Char(10);
TriggerEvent Char(1);
TriggerTime Char(1);
CommitLockLevel Char(1);
Reserve1 Char(3);
CCSIDOfData Int(10);
RelativeRecordNumber Int(10);
Reserve2 Char(4);
BeforeOffset Int(10);
BeforeLength Int(10);
BeforeNullByteOffset Int(10);
BeforeNullByteLength Int(10);
AfterOffset Int(10);
AfterLength Int(10);
AfterNullByteOffset Int(10);
AfterNullByteLength Int(10);
Reserved3 Char(16);
end-ds;
dcl-pr ProcessTransaction ExtPgm('YOURNAME');
PR_InTriggerBuffer LikeDs(TD_DbTriggerBuffer);
PR_InBufferLength Int(10) Const;
end-pr;
dcl-proc ProcessTransaction;
dcl-pi *N;
InTriggerBuffer LikeDs(TD_DbTriggerBuffer);
InBufferLength Int(10) Const;
end-pi;
// declare all variables as local to procedure. As little static as
possible.
// Your write data queue logic.
Return;
end-proc;
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
As an Amazon Associate we earn from qualifying purchases.
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.