Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Logical truncation of files / erasing file contents

A file is logically truncated if all of the following conditions apply:

  1. No condition for file extension applies.

  2. The last logical page is located in a window with the attribute DISPOS=*UNCHNG and in the SAVE area.

  3. At least the last page is in the initial state and has not yet been written to the file with SAVE.

The logical truncation of a file ends if any of the following results has been produced:

  • The end of the SAVE area has been reached.

  • At least one page is not in a window with the attribute DISPOS=*UNCHNG (i.e. if there is no window or if the window attribute is DISPOS=*OBJECT).

  • At least one page is not in the initial state or has already been written to the file with SAVE.

Example 1: truncating a file logically

Key

1...10

page numbers (file/window)

M

modified

nc

new contents

F

FRESHLY_OBTAINED

M

MODIFIED

oc

old contents

pllp

previous logical last page

--

undefined contents

Explanation

Window pages 4-10 were never accessed or were returned to the initial status (FRESH-LY_OBTAINED) by RESET. Page 5 constitutes the new logical EOF. The immediately preceding page (page 4) was never accessed. That is why pages 4 and 5 are logically truncated by SAVE.

Modified pages between the start of the file and the new logical EOF (pages 1 to 3) are written to the file. Pages which are in this area and have never been accessed (i.e. with page status FRESHLY_OBTAINED: not yet written to disk by an earlier SAVE operation) are deleted in the disk file, i.e. initialized with X'00'. Page 1 in the above example.

Example 2: truncating a file logically

Key

1...10

page numbers (file/window)

M

modified

nc

new contents

M

new logical last page

oc

old contents

pllp

previous logical last page

--

undefined contents

Explanation

There are no modified pages in the SAVE area beyond the last logical page (page 8). The condition for extending a file is therefore not fulfilled.
Since the last logical page, i.e. the last page of the SAVE area (page 8), and the preceding pages of the second window have not yet been accessed, these pages are still in the initial state. The file is truncated by these pages.
Truncation ends when a page which does not appear in any window or which is not in a window with the attribute DISPOS=*UNCHNG is encountered.
In the example, pages 1, 2 and 3 have already been written to file with SAVE. They will hence retain their existing contents and will not be initialized with X'00'.

If page 9 belongs to the SAVE area, the file is extended up to this page (inclusive).