COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Accessing Files on Other Nodes
For you, as a user on one node, to have any access at all to a file on another node, even when
the file’s security attributes permit it, you must have two remote passwords declared on each node.
The TACL command REMOTEPASSWORD enables you to set the remote passwords on your own
node. You must arrange with the system manager of the other node to have the same two passwords
established on that node. For further information about remote passwords, see the Guardian User’s
Guide.
Fixed-Length and Variable-Length Records
A file has variable-length records if its file description entry has either:
A RECORD CONTAINS m TO n CHARACTERS clause
A RECORD IS VARYING FROM m TO n clause
No RECORD clause and different-sized record descriptions
If your source program does not explicitly describe a file as having variable-length records, the
HP COBOL run-time write routine writes fixed-length physical records. The length of each physical
record in the file is the larger of:
The length of the longest record description entry for the file
The maximum record length explicitly stated in the RECORD clause of the file description entry
If a file contains records of different lengths, your program must declare it as having variable-length
records to be able to read it. If the program declares the file (explicitly or implicitly) as having
fixed-length records, and the program then tries to read a record shorter than the declared length,
the read operation succeeds with a file status code “04.
Unstructured files must have fixed-length records.
Exclusion Modes
The exclusion mode is a feature of a file that determines whether other processes can read or write
to the file being opened. If two separate processes are both writing to the same file, it is possible
that both will attempt to write the same record and thereby corrupt the database.
Table 121 Exclusion Modes and Their Meanings
While the process that opened the file has it open ...Exclusion Mode
No other process can read or write the file.EXCLUSIVE
Any other process can read the file, but no other process can write the file.PROTECTED
Any other process can read or write the file.SHARED
The exclusion mode can be specified in the OPEN statement or in an ASSIGN command. The
exclusion mode in an OPEN statement takes precedence over the exclusion mode in an ASSIGN
command. If neither the OPEN statement or ASSIGN command specifies an exclusion mode, the
exclusion mode is PROTECTED if the file is being opened for input; EXCLUSIVE otherwise.
Most server files have the exclusion mode SHARED so that several servers of the same class can
all access the file. The servers use record locking to prevent conflicting write operations to the file.
If you have a batch program that needs to open a file that one or more servers have opened for
shared access, give careful consideration to whether the batch program should open the file for
shared, protected, or exclusive access. If the batch program is doing something that affects the
servers, it should probably open the file for exclusive access and thus fail if any server has it open.
If the batch program cannot affect the servers, and the activity of the servers does not affect the
activity of the batch program, then the batch program can open the file for shared access.
Common Disk File Topics 859