Problem solve Get help with specific problems with your technologies, process and projects.

Serialize access of a file

I want to know how to serialize access of a file by multiple RPG programs. Multiple RPG programs under different jobs need to read/update the same file but different records. The read/update process needs to be serialized. I think record lock doesn't work because it accesses different records.

The system already handles the files and record locking, if I understand your question. When you chain or read a record of a file open for update, the system locks the record for you. When searching for your record, you may read or chain with the (n) no lock option. (e.g. Chain (n) FileName) When you get the record that you want, you can read or chain to the record again without the (n). This will lock the record and prevent other users from updating the record.


The Best Web Links: tips, tutorials and more.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.

Dig Deeper on iSeries COBOL programming

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.