Know IDMS? Take the Developer Challenge

You are asked to erase all occurrences of a record within an Area. What is most efficient? Should you read first, then read next in Area — or is it better to read last, then read prior?
The answer
When a record is erased on a database page, the record and line index are deleted, and all data on the page is reallocated to the bottom of the page to make as much space available as possible. For example, assume there are 10 records on every page. If you read first and erase, it eliminates the bottom record, then moves the remaining 9 records down and updates their line index. When you read next, it erases the second record, moves the remaining 8 records down and updates the line index — and so on for the rest of the records on the page.
When you read last within the Area and delete the record, it erases the record and line index and does not have to move the remaining records to the bottom of the page: you are reading the “top” record on the page. When you read prior and erase, it erases the next record and again does not have to move all the data.
Of course, if there is only one record type within the Area, the most efficient approach is to initialize the Area.
- Review your Area — are there multiple record types within it?
- Only one record type in the Area — go for it, initialize the Area.
- Read first within Area — it works, but it’s not the most efficient way.
- Read last within Area — now you’ve got it.
- Not sure? Page management isn’t widely understood. If it doesn’t really matter, read last within Area and read prior for your Area sweep navigation.
If you would like to discuss IDMS, give us a call.
More case studies



Take the next step
Ready to retire your legacy 4GL? Schedule a no-cost call to review your source and conversion options.