Understanding the lock byte on an IDMS database page
search cancel

Understanding the lock byte on an IDMS database page

book

Article ID: 25909

calendar_today

Updated On:

Products

IDMS IDMS - Database

Issue/Introduction

When IDMS readies a database area, it places a physical lock on a page to disallow update access to that same page from any other job. This document contains instructions on how to how to locate and interpret the lock byte on the page.

Environment

Release: All supported releases.

Resolution

In looking at a database page, the page number of the page is stored in the last four bytes of the page. The area lock byte setting is stored in the two bytes preceding the page number. The specific value contained in these two bytes will vary depending on where this specific page resides within the page range for the area; the mode in which the area is readied; and on the number of updates which have been performed on this page.

For the first page in the area, these two bytes are set to a value of X'0001' whenever IDMS needs to open the area in update mode; this is referred to as the "area-in-use" lock. If the area is not in use by the CV for update (varied offline or readied in retrieval), then this area-in-use lock is set to X'0000'. For all other pages in the area, these two bytes contain a page update count; i.e. this value is increased by 1 every time that page is updated. If the value eventually reaches X'FFFF', on the next update it is set back to x'0000'.

These bytes are part of the PAGE FOOTER of a database page, which is structured as follows:

| Line space | Page Update count | Line index 0 | count or Area-in-use-lock | Page number | ---------------------------------------------------------------- 8 bytes 2 bytes 2 bytes 4 bytes

Thus, the fifth byte before the last position on the page is part of a half word (two bytes) which is used for

  1. Page Update Count : for all but the first page of the area, this is a looping counter which is incremented every time a database page is updated; OR
  2. Area-in-use Lock : for the very first page of the area (SMP page), this will indicate whether the area has been readied for update or not.

To summarize, to find and interpret the area-in-use lock:

  1. Go to the first page of the area;
  2. Look at the footer of the page;
  3. Check the fifth byte before the end of the page. This is the the area-in-use Lock;
  4. When IDMS readies an area in UPDATE mode, it reads the first page of the area, sets the area-in-use lock to X'0001', then writes the page back. If the area is not readied by the CV, is varied offline, or is readied for retrieval, this will contain a value of '0000'.

Additional Information