Kapiltiwari
175 pts. | Jul 27 2009 1:52PM GMT
How to journal that file on daily basis to copy only newly added records from it.
Please tell me all the steps :
Satsho
1235 pts. | Jul 27 2009 3:57PM GMT
Step 1 - Create a Journal receiver - CRTJRNRCV
Step 2 - Create a Journal
Step 3 - Add the file to the Journal - STRJRNPF - in your case, it would be with *AFTER image
Ensure you start and end commitment control in your CL programs or COMMIT in RPG.
Yorkshireman
3200 pts. | Jul 27 2009 4:14PM GMT
To ensure that you collect *ALL records, provide a file containing the keys of the records in the Physical file.
When you copy a record, place its key in the new file.
Tomorrow, and every day therafter, check the new file to see if the record has been copied, and if it has not, copy it, and place its key in the new file.
This will work through every disaster, barring a powerdown in mid updtae, in which case you may lose a record - provide a timestamp on your new file.
I recommend <a href="http://www.IBM.com" title="http://www.IBM. " target="_blank">www.IBM.com</a> for DB2 manuals on how all of this works - journalling - running the above with SQL…..
WilsonAlano
2005 pts. | Jul 27 2009 7:12PM GMT
Hi,
I suggest a trigger over the original file to add a record to a temp file that you just copy at end of the day and clear it for the next day process.
Regards,
Wilson
Kapiltiwari
175 pts. | Jul 28 2009 7:05AM GMT
Hearty thanks to all of you. I have solved .
I wanna know more explanation from Mr. Wilson Alano Junior about how to copy only new records of Physical file by CL program called on insert after trigger.
Please explain this in detail.
Thanks
WilsonAlano
2005 pts. | Jul 28 2009 3:43PM GMT
Hi Kapil,
What I was suggesting was a RPGILE trigger for “after insert”. You can do that in CL but it’s not easy (CL do not have “native” write to files).
If you don’t know how to make a trigger program you can take a look at this link
<a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/dbp/rbaforzahftrb.htm" title="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/dbp/rbaforzahftrb.htm" target="_blank">http://publib.boulder.ibm.com/infocenter…</a>
The idea is, for each record inserted in the original file, trigger a program that take the record image and write it in a temporary file. You must have a end-of-day process to copy this temp file to its final destination and clear the temp file for next day.
Regards,
Wilson
Teandy
3250 pts. | Jul 28 2009 9:06PM GMT
I’m curious as to why you would bother with a temporary file. Why not write the record to its final destination and be done with it?
Kapiltiwari
175 pts. | Jul 29 2009 6:09AM GMT
Thanks Mr Wilson.
I m trying to write records to its final destination as Mr Teandy is saying.
WilsonAlano
2005 pts. | Jul 29 2009 3:31PM GMT
I had the same thoughts about writing directly to the final destination but I assumed (!) that it wasn’t possible for some reason (EOD process needs, remote location of final destination or something like that).
Rajgoaj
150 pts. | Jul 31 2009 11:53AM GMT
Every EOD the latest RRN number could be stored in a data area, the next day you will find the new records with RRN number greater than the one stored in that data area previous day.






