Know IDMS?
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?
What’s your course of action?
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?
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 making as much space as possible available. For an example, lets assume that 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. Then when you read next, it erases the second record, and moves the remaining 8 records down on the page 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 all 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 does not have to move all the data to the bottom of the page.
Of course, if there is only one record within the Area you would initialize the Area to be most efficient.
I hope that helps, if you would like to discuss IDMS, give us a call.