Reconstruct disk file
Component: | BS2000 |
Functional area: | File processing |
Domain: | FILE |
Privileges: | STD-PROCESSING |
Function
The REPAIR-DISK-FILES command reconstructs a disk file which was incorrectly closed due to a system crash or a job being aborted. This involves: updating of the catalog entry, the implicit removal of any lock which may apply, and closing of the file (see the command REMOVE-FILE-ALLOCATION-LOCKS); ISAM files will be reconstructed using the available records. The files which need to be reconstructed can be displayed by using the SHOW-FILE-ATTRIBUTES command with the option STATUS=*PAR(REPAIR-NEEDED=*YES).
The reconstruction of files is discussed in the general section of the “Introductory Guide to DMS” [13].
Privileged functions
If reconstruction is not possible because of a file lock, systems support receives the message DMS06F0 in interactive mode (in batch mode command processing is aborted without any message) and can then, if required, cancel the file lock and thus force reconstruction. In the event of forced reconstruction, it is essential to ensure that the file is not open for writing at this time.
Format
REPAIR-DISK-FILES | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Operands
FILE-STATUS = *OPEN(...) / *ANY(...)
Specifies whether the file is to be reconstructed only if it was not closed correctly, or in any case.
FILE-STATUS = *OPEN(...)
The file is only to be reconstructed if it was not closed correctly.
FILE-NAME = <filename 1..54> / <partial-filename 2..53>
Identifies the permanent or temporary file, file generation group or file generation which is to be reconstructed. If FILE-NAME is specified in partially qualified form, then:
ISAM-COPY-NAME (if required) must also be specified in partially qualified form.
ISAM-COPY-NAME will be ignored when generations are being reconstructed.
Only the user’s own user ID may be specified.
The reconstruction of the file depends on the access method with which the file was created (see the output field FILE-STRUC in the output of the SHOW-FILE-ATTRIBUTES command):
PAM: The file lock is removed. If the file is identified as open, the system carries out a privileged close operation, and the last page pointer (LPP) is updated if required:
For a K-PAM file (BLOCK-CONTR=PAMKEY), the LLP will then point to the last reserved PAM page (corresponds to the file size). For an NK-PAM file (BLOCK-CONTR=DATA/NO), the LLP will contain a value which is determined by the file size, rounded down to a multiple of the number of PAM pages in the data block (see the blocking factor in the output field BUF-LEN of the SHOW-FILE-ATTRIBUTES command). If the file is on a disk that is operated in dual mode (see the “DRV” manual [11]), the contents of the data blocks will not be updated. However, this can also be achieved with FILE-
STATUS=*ANY(...).
SAM: The file lock is removed. If the file is identified as open, the last page pointer is set to the highest used PAM page if required. After that, the file is closed. If the file is on disk that is operated in dual mode, the contents of data blocks are restored. “Dual mode” disks are explained in the “DRV” manual [11].
ISAM: The file lock is removed. The file is reconstructed from the repairable data blocks. Secondary keys which are identified as complete are also reconstructed.
Irrespective of the access method, concurrent copy locks are retained if the concurrent copy session is still in progress.
SELECT = *ANY-VOLUME / *PRIVATE-DISK / *PUBLIC-DISK
The type of volume to which the reconstruction is to be restricted.
This operand is only meaningful if FILE-NAME was a partially qualified file name or the name of a file generation group.
SELECT = *ANY-VOLUME
The specified files will be selected, irrespective of the volume on which they are held.
SELECT = *PRIVATE-DISK
Of the specified files, those which are held on private disk will be selected.
SELECT = *PUBLIC-DISK
Of the specified files, those which are held on public volumes (disk) will be selected.
SELECT = *NET-STORAGE
Of the specified files, those which are held on Net-Storage volume will be selected.
FILE-STATUS = *ANY(...)
The file is to be reconstructed irrespective of its status.
FILE-NAME = <filename 1..54>
Identifies the permanent or temporary file, file generation group or file generation which is to be reconstructed. Only the user’s own user ID may be specified.
The reconstruction of the file depends on the access method with which the file was created (see the output field FILE-STRUC in the output of the SHOW-FILE-ATTRIBUTES command):
PAM: The file lock is removed. If the file is identified as open, the system carries out a privileged close operation, and the last page pointer (LPP) is updated if required: For a file that was created with BLOCK-CONTROL-INFO=*WITHIN-DATA-BLOCK or *PAMKEY, the last page pointer will point to the last PAM page which was written. For a file that was created with BLOCK-CONTROL-INFO=*NO, the LLP will point to a value which is determined by the file size, rounded down to a multiple of the number of PAM pages in the data block (see the blocking factor in the output field BUF-LEN of the SHOW-FILE-ATTRIBUTES command). If the file is on a disk that is operated in dual mode (see reference below), the contents of its data blocks will be updated if required. “Dual mode” disks are explained in the “DRV” manual [11].
SAM: The file lock is removed. If the file is identified as open, the system carries out a privileged close operation, and the last page pointer (LPP) is set to the last PAM page that was written. If the file is on a disk that is operated in dual mode (see reference below), the contents of its data blocks will be updated if required. “Dual mode” disks are explained in the “DRV” manual [11].
ISAM: The file lock is removed. The file is reconstructed from the repairable data blocks. Secondary keys which are identified as complete are also reconstructed.
Irrespective of the access method, concurrent copy locks are retained if the concurrent copy session is still in progress.
SELECT = *ANY-VOLUME / *PRIVATE-DISK / *PUBLIC-DISK
The type of volume to which the reconstruction is to be restricted.
This operand is only meaningful if FILE-NAME was a partially qualified file name or the name of a file generation group.
SELECT = *ANY-VOLUME
The specified files will be selected, irrespective of the volume on which they are held.
SELECT = *PRIVATE-DISK
Of the specified files, those which are held on private disk will be selected.
SELECT = *PUBLIC-DISK
Of the specified files, those which are held on public volumes (disk) will be selected.
SELECT = *NET-STORAGE
Of the specified files, those which are held on Net-Storage volume will be selected.
ISAM-COPY-NAME = *SAME / <partial-filename 2..53> / <filename 1..54>
ISAM-COPY-NAME is only meaningful when ISAM files are being reconstructed, and identifies the file into which the reconstructed copy of the ISAM file ISAM-COPY-NAME is to be put. The file is assigned the encryption attributes of the file to be reconstructed. ISAM-COPY-NAME can be the name of a permanent file, temporary file or file generation, but may not be the name of file generation group.
Write access is required for files which are not under the user’s own user ID. ISAM-COPY-NAME may not be the same as FILE-NAME.
If FILE-NAME is partially qualified, so must ISAM-COPY-NAME be.
If no ISAM-COPY-NAME is specified, the system will create a work file for use in reconstructing the ISAM file (default value *SAME). If the reconstruction is to be carried out on a private disk, then the file must be cataloged. If the data and index sections of the file which is to be reconstructed are held on separate disks, corresponding storage space must also be requested for the reconstructed copy (using CREATE-FILE or MODIFY-FILE-ATTRIBUTES as appropriate). Only the user’s own user ID may be specified.
ISAM-COPY-NAME = *SAME
The reconstruction will be put into the file specified by FILE-NAME. This procedure will be mediated by a work file, created by the system. For ISAM files on private disks or under user IDs other than the user’s, the work file will be copied into the file specified by FILE-NAME, and will then be deleted. Since copying can be very time-consuming, it is recommended that a fully qualified file name is specified. For ISAM files on PUBLIC disks under the user’s own user ID, the work file will simply be recataloged and the original file will be deleted. If an ISAM file on PUBLIC disk is subject to a concurrent copy lock which cannot be reset, message DMS06EE is issued. The repaired ISAM file will then be in a file named REPAIR.<tsn>.hhmmss, as it will not have been possible to delete the original file owing to the concurrent copy lock and then rename the work file under the name of the original file.
ISAM-REPAIR-INFO = *NO / *YES(...)
This operand is evaluated for ISAM files only: specifies whether file blocks which cannot be reconstructed are to be logged.
ISAM-REPAIR-INFO = *NO
File blocks which cannot be reconstructed are not logged.
ISAM-REPAIR-INFO = *YES(...)
The block numbers of file blocks which cannot be reconstructed are output. The output can be directed to SYSOUT (default) or SYSLST.
OUTPUT = *SYSOUT / *SYSLST
Specifies where the block numbers of the file blocks which cannot be reconstructed are to be output. SYSOUT is the default.
Return codes
(SC2) | SC1 | Maincode | Meaning/Guaranteed messages |
---|---|---|---|
0 | CMD0001 | Command executed | |
1 | 0 | CMD0001 | No action required |
2 | 0 | DMS06E6 | File specified in command is empty |
2 | 0 | DMS06E9 | No valid record found during reconstruction of ISAM file |
2 | 0 | DMS06ED | Error on writing unrecoverable blocks to scratch file |
1 | CMD0202 | Syntactical or semantic error in command | |
32 | DMS0584 | A state that does not allow the function to continue was reported during processing | |
64 | CMD0102 | Interrupted by K2 key | |
64 | CMD0216 | Privileges error | |
64 | DMS0501 | Requested catalog not available | |
64 | DMS0512 | Requested catalog not available | |
64 | DMS051B | Requested user ID not in pubset | |
64 | DMS051C | User not authorized to access pubset | |
64 | DMS0533 | Requested file not cataloged in pubset | |
64 | DMS0535 | Specified file not shareable | |
64 | DMS055C | Catalog entry not found on assigned private disk | |
64 | DMS0583 | An error occurred when reconstructing the file | |
64 | DMS0585 | Error detected during catalog processing or multihost processing | |
64 | DMS0586 | Currently not possible to access or reserve volume | |
64 | DMS0587 | Use of specified command restricted by system administrator | |
64 | DMS0588 | It was not possible to allocate disk space | |
64 | DMS05F8 | It was not possible to allocate disk space | |
64 | DMS05FC | Specified user ID not in HOME pubset | |
64 | DMS0609 | No access to system file | |
64 | DMS06CC | No file corresponding to specified operands | |
64 | DMS06E4 | Reconstruction with specified command not possible for this file type | |
64 | DMS06FF | Reconstruction for this file type not possible with specified command | |
64 | DMS06FF | File created with WROUT=NO. Consistency check is not practical | |
130 | DMS0524 | System address space full | |
130 | DMS053C | No space in pubset catalog file | |
130 | DMS0582 | File is currently locked or in use and cannot be processed | |
130 | DMS0585 | Error detected during catalog processing or multihost processing | |
130 | DMS0586 | Currently not possible to access or reserve volume | |
130 | DMS0588 | It was not possible to allocate disk space | |
130 | DMS0594 | Not enough virtual memory available | |
130 | DMS05C8 | Maximum permitted number of files reached |
Notes on reconstructing ISAM files
For ISAM files, the data buffers are written back out to the disk as soon as a new data block has to be fetched into main memory. This means that the last changes which were made to the file may be missing from the reconstructed ISAM file (if WRITE-IMMEDIATE=*YES was specified, then no more than one record can be missing).
If no ISAM-COPY-NAME is specified for an ISAM file on public volumes, it will be reconstructed in a work file created by the system. The file FILE-NAME will then be deleted, even without an explicit DESTROY instruction (see the DESTROY-BY-DELETE operand in the CREATE-FILE and MODIFY-FILE-ATTRIBUTES commands), and the work file will be renamed as FILE-NAME.
If no ISAM-COPY-NAME is specified for an ISAM file on private volumes, it will be reconstructed in a temporary work file on public data volumes. The work file will then be copied into the file FILE-NAME, and then deleted with an explicit DESTROY instruction (see the DESTROY-BY-DELETE operand in the CREATE-FILE and MODIFY-FILE-ATTRIBUTES commands). This procedure can be very time-consuming so that it is advantageous to specify an ISAM-COPY-NAME.
If an ISAM-COPY-NAME is specified in the command REPAIR-DISK-FILES, that is where FILE-NAME will be reconstructed. FILE-NAME itself will remain unaltered. If ISAM-COPY-NAME is to be held on private volumes, or if FILE-NAME is a file on private volumes, then ISAM-COPY-NAME must be cataloged before the command REPAIR-DISK-FILES is input. If the data and index blocks are stored on separate volumes, then it is also necessary to reserve storage space for ISAM-COPY-NAME (see the CREATE-FILE and MODIFY-FILE-ATTRIBUTES commands).
In the data blocks in the reconstructed file, no space will be kept free for later expansion of the file, equivalent to specifying PADDING-FACTOR=0 in the ADD-FILE-LINK command.
ISAM files for which the data and index blocks are on separate private volumes can only be reconstructed if BUFFER-LENGTH=*STD.
If an ISAM data block contains data items which cannot be associated with any specific record, the whole block will be saved in the PAM file S.filename1.REPAIR. On completion of the REPAIR-DISK-FILES processing, this file is available for the user to make his own reconstruction attempts. If the new file name is too long, filename1 will be correspondingly shortened.
Since the recreation of an ISAM file involves the setting up of a copy of the file, which is within pubspace, the user must ensure that sufficient storage space is available.