i have physical file in which records are added on daily basis. i have to copy record to another Flate file. How can i recognise the block of newly added records?
There is no date field in Physical File sothat i can copy records on date basis.
Software/Hardware used:
ASKED:
July 27, 2009 10:45 AM
UPDATED:
July 31, 2009 11:53 AM
How to journal that file on daily basis to copy only newly added records from it.
Please tell me all the steps :
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.
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 http://www.IBM.com for DB2 manuals on how all of this works – journalling – running the above with SQL…..
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
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
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
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/dbp/rbaforzahftrb.htm
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
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?
Thanks Mr Wilson.
I m trying to write records to its final destination as Mr Teandy is saying.
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).
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.