Record lock on physical file

280 pts.
Tags:
Logical File
RPGLE
When a logical file is open in update mode to read and update the record, while performing read operation on logical file, lock applies on which file(logical or physical)? I have a scenario where one logical holds a lock and when another logical tries to read it shows 'Record is already lock to this job'.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Lock will be apply on Physical file when file will read. Once read file will be unlock.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    ...while performing read operation on logical file,lock applies on which file(logical or physical)? : This comment will be formatted badly because the site is clearly having serious scripting problems. But a record lock is on the record; not on a file. The lock will affect every file that you attempt to access that record through. File locks are different from record locks. -- Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    As Tom said, Records are in the physical file, record locks are on records. Logical files provide alternate "views" of the physical file. So if the record is locked from one access path, it's locked from all.Phil
    49,840 pointsBadges:
    report
  • asakla
    I also faced the same scenario , If its the case that you read a record and then based on some conditions u decide as to update the record or not . so the records which was not updated remains in lock ..To avoid this use another logical in Input mode and if the conditiosn are satisfied for update then read the file which is open in Both mode and update the record ..this will eliminate he problem of unwanted record locks 
    240 pointsBadges:
    report
  • TomLiotta
    It's not necessary to have a second file. You can read a record without lock, then read the same record with a lock when it's time to update it. -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following