DIV actions are internally controlled via a page status indicator. The status of a page can have one of the following values: FRESHLY_OBTAINED (F), ACCESSED (A) or MODIFIED (M).
The current status of a page in a DIV window determines which actions are performed on it after it is accessed.
Control via page status
If the definition of a window includes the specification that the pages of the file should appear in that window (function MAP with the operand DISPOS=*OBJECT), all pages of that window will have the status FRESHLY_OBTAINED. This is also the status of a page when memory has been allocated using the REQM macro (initial state).
When such a page is accessed (by any CPU instruction), a page fault interrupt is generated, and DIV receives control from the memory management system in order to read the page from the file. If the page in question is located after the last logical page of the file, it is initialized with X'00'. The page will then no longer be in the initial state but in the state ACCESSED. It will be treated like any other page in virtual address space when subsequently accessed.
If the page is modified by the program, its status is set to MODIFIED. The contents of a page having this status are different from the corresponding page on file. The DIV function SAVE can be used to write modified pages to the file. Following the SAVE operation, the pages in question will no longer have the status MODIFIED and will not be written to file when SAVE is called again, unless they were accessed and modified again by the program.
The selection of window pages to be written to the file on disk also depends on which value was specified for the DISPOS operand (in the MAP function) when creating the window, and on the position of the page with respect to the logical end-of-file.
The DIV function RESET can be used to reset the status of a modified page to the initial state. In a window with the attribute DISPOS=*OBJECT, the page is read in from the file again when it is subsequently accessed (or initialized with X'00' if it lies beyond the logical end-of-file). For a window defined with DISPOS=*OBJECT, RESET therefore causes the pages from the file to reappear in the window.
The RESET function with the operand RELEASE=*YES causes not only unmodified pages, but all pages of a predefined region to be reverted to the initial state. As a result, all such pages are read in from the file when they are accessed.
MAP does not alter the status of pages in a window defined with DISPOS=*UNCHNG. If a page has never been accessed, it retains its initial state; otherwise, as far as DIV is concerned, its status is MODIFIED.
When DIV obtains control following access to a page in a window specified with DISPOS=*UNCHNG, the page is initialized with X'00' and is set to the status MODIFIED.
If a page has previously been written to file with SAVE and then set to the initial state by RESET, it will be read from the file even for a DISPOS=*UNCHNG window and will not be initialized with X'00'.
Note
Allocating address space: in order to use DIV, the user must request virtual address space. Address space in the program space is allocated using the REQM macro, address space in the data space with the macro DSPSRV. When pages are allocated in main memory, they are first initialized with X'00'.