PASSWORD clause
The PASSWORD clause controls access to files.
- data-name-6 , data-name-7
- Password data items. Each must be defined in the WORKING-STORAGE SECTION of the DATA DIVISION as a data item of category alphabetic, alphanumeric, or alphanumeric-edited. The first eight characters are used as the password; a shorter field is padded with blanks to eight characters. Each password data item must be equivalent to one that is externally defined.
When the PASSWORD clause is specified, at object time the PASSWORD data item must contain a valid password for this file before the file can be successfully opened.
Format 1 considerations:
The PASSWORD clause is not valid for QSAM sequential files.
Format 2 and 3 considerations:
The PASSWORD clause, if specified, must immediately follow the RECORD KEY or ALTERNATE RECORD KEY data-name with which it is associated.
For indexed files that have been completely predefined to VSAM, only the PASSWORD data item for the RECORD KEY need contain the valid password before the file can be successfully opened at file creation time.
For any other type of file processing (including the processing of dynamic calls at file creation time through a COBOL runtime subroutine), every PASSWORD data item for the file must contain a valid password before the file can be successfully opened, regardless of whether all paths to the data are used in this object program.
For external files, data-name-6 and data-name-7 must reference external data items. The PASSWORD clauses in each associated file-control entry must reference the same external data items.