How to copy a binary file while the file is being written to by another process

Hello,
Can I copy a binary file while the file is being written to by another process?

Another process (program) �P1� creates and opens (for writing) binary file �ABC� on local disk. Process P1 continuously write into ABC file every couple of seconds, adding 512-byte blocks of data. ABC file usually grows to the size of 20-30 MB.
I need to make a copy (replica) of ABC file every one hour, while process P1 is still active. My copy action must not disturb process P1 and no data can be lost (not written) into ABC file because of my copy action. It is ok if my action causes a short delay in P1 writing, but data must not be lost. It is ok if my copy of ABC file misses the latest blocks of data from ABC file. If I can safely make a copy of ABC file which will be a snapshot of ABC file from 5 minutes ago, that is ok for me.

Can you please help me with the description of steps that I need to do in my program or script?
Is there a way to open a file for read-only, but in a way that UNIX would guarantee that my reading program will not disturb the other writing program P1?

I'm working on AIX server.

Thank you,
Milan

Reading from a file doesn't disturb anything, at all. The writer doesn't know or care anything else is reading, and the data being written or position it's being written to won't be upset, reset, or altered.

The real worry would be whether you'd get anything sensible by doing so. You could catch the data file in an in-between or invalid state -- a half-written line or some such -- except you've handily told us your application appends, so that earlier records won't be altered; and does so in individual 512-byte blocks.

If your application writes 512 bytes at a time, i.e. one write of 512 bytes instead of 512 writes of 1 byte, you'll never catch the file in a halfway state -- from a user perspective, the file will grow cleanly in 512-byte jumps.

In short, it ought to be safe to simply copy this file. You don't even need to stop the application.