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

Eliminate record locks

John, you answered the inquiry regarding "serializing" access to a file in RPG. For the last fifteen years or so I have used a shop standard that has served very well to eliminate record locks.

1. No physical file has any key fields.
2. Access to a file is through a logical view, as an input-only file.
3. Use the information data structure to get the relative record number (RRN) for the record retrieved.
4. When ready to update, chain to the physical file using the RRN.

This also works very nicely when the keys are not unique. You always get the record you think you are getting.


I have worked in shops that had those types of standards. They work very well. They also require the physical to be included in any program that will update or write to the file. Some shops also use server programs that are called for any write or update to a physical. These work as well. I prefer to allow my staff to use any physical or logical that they determines are required for this process to write or update. I also prefer using the no-lock as part of the chain/read. I also require my staff to use indicators (or the new keywords) to trap record locks and/or prevent errors in writing or updating records. Personal preferences aside, all of the above work.


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

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.