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



Here is a trigger skeleton program

h actgrp('POWEREXT') dftactgrp(*no)

* Record Image Before
d recBefore e ds extName(pxxatbl)
d prefix(B_)
d based(beforePtr)

* Record Image After
d recAfter e ds extName(pxxatbl)
d prefix(A_)
d based(afterPtr)

* Declare Global Variables
d startBuff s *
d beforePtr s *
d afterPtr s *

d insert c const('1')
d delete c const('2')
d update c const('3')

* Trigger Interface
d triggerDS ds
d fileName 10
d libName 10
d mbrName 10
d trgEvent 1
d trgTime 1
d cmtLevel 1
d reserved1 3
d ccsId 10I 0
d reserved2 8
d orgRecOffset 10I 0
d orgRecLength 10I 0
d orgRecNulOff 10I 0
d orgRecNulLen 10I 0
d newRecOffset 10I 0
d newRecLength 10I 0
d newRecNulOff 10I 0
d newRecNulLen 10I 0
d reserved3 16

* Program Entry
d pgmEntry pr extpgm('PEXTTRG')
d 96
d 10I 0

d pgmEntry pi
d trgDS 96
d trgBufLen 10I 0

* Processors
d recInsert pr
d recUpdate pr
d recDelete pr

/free
// Set pointers for before and after record image
triggerDS = trgDS;
startbuff = %addr(trgDS);
beforePtr = startbuff + orgRecOffset;
afterPtr = startbuff + newRecOffset;

// Process Change
select;
when trgEvent = insert;
recInsert();
when trgEvent = update;
recUpdate();
when trgEvent = delete;
recDelete();
endsl;

return;
/end-free
*=====================================================================
* recInsert
* Record Inserted (all fields are in A_fields)
*=====================================================================
p recInsert b
d recInsert pi
/free
clear recBefore;
dsply ('Inserted: ' + a_xahead);
/end-free
p e
*=====================================================================
* recUpdate
* Record Updated (old fields are in B_fields, new in A_fields)
*=====================================================================
p recUpdate b
d recUpdate pi
/free
dsply ('Updated b: ' + b_xahead);
dsply ('Updated a: ' + a_xahead);
/end-free
p e
*=====================================================================
* recDelete
* Record Deleted (all fields are in B_fields)
*=====================================================================
p recDelete b
d recDelete pi
/free
clear recAfter;
dsply ('Deleted: ' + b_xahead);
/end-free
p e


CL to activate the trigger ...

RMVPFTRG FILE(PXXATBL)
MONMSG MSGID(CPF0000)
ADDPFTRG FILE(PXXATBL) TRGTIME(*AFTER) +
TRGEVENT(*INSERT) PGM(PEXTALLI/PEXTTRG)
ADDPFTRG FILE(PXXATBL) TRGTIME(*AFTER) +
TRGEVENT(*UPDATE) PGM(PEXTALLI/PEXTTRG) +
TRGUPDCND(*CHANGE)
ADDPFTRG FILE(PXXATBL) TRGTIME(*AFTER) +
TRGEVENT(*DELETE) PGM(PEXTALLI/PEXTTRG)



On Sun, Jan 5, 2014 at 3:09 PM, <chamaraw@xxxxxxxxxx> wrote:

Hi,
What about adding a trigger and that trigger can record your triggered
DB
suits.
Chamara.

From: William Salim
Sent: Sunday, 5 January 2014 19:28
To: RPG programming on the IBM i (AS/400 and iSeries)
Reply To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Get Record Creation Date

First of all, there are no journals and files cannot added new fields..
Files used by many old programs that strictly cannot changed and do
those
two things (journal and add field).
Bad design but need alternative solutions..

Thanks
On Jan 5, 2014 8:48 PM, "Henrik Rützou" <hr@xxxxxxxxxxxx> wrote:

> As suggested - add a creation data field to the record
>
> or ...
>
> journal the file
>
> or
>
> add a trigger program that records when records are added
>
>
> On Sun, Jan 5, 2014 at 2:31 PM, Bill Wragg <bill_wragg@xxxxxxxx>
wrote:
>
> > Only solution is to add a date field to the record and when it is
created
> > populate it with the date.
> >
> > Good Luck
> >
> > -----Original Message-----
> > From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:
> rpg400-l-bounces@xxxxxxxxxxxx]
> > On Behalf Of William Salim
> > Sent: January-05-14 7:17 AM
> > To: rpg400-l@xxxxxxxxxxxx
> > Subject: Get Record Creation Date
> >
> > Hi Everyone..
> >
> > I look something that RPG or Any other language can have the
capability
> to
> > get the creation date for the record that has been created in files
> > (PF/LF).
> >
> > i have try to do the exploration using the QDBRTVFD but still no
result,
> > the
> > API only gave the last updated files not record.
> >
> > is there any solutions for this?, i really appreciate whether it
will
do
> > another language or process in I series
> >
> >
> > Thanks
> >
> > --
> > Regards,
> >
> > William Salim
> > --
> > 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.
> >
> > --
> > 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.
> >
> >
>
>
> --
> Regards,
> Henrik Rützou
>
> http://powerEXT.com <http://powerext.com/>
> --
> 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.
>
>
--
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.
--
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.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.