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

Disk Input and Output
HP COBOL Manual for TNS/E Programs520347-003
28-41
Obtaining File Numbers and Other File Attributes
The data item ONE-BYTE-SYSTEM-NUMBER is a 1-byte integer whose value is in the
range 0 through 254. Each node in an Expand network has a unique system name and
a unique system number. The number and name of a node are established during
system generation.
Obtaining File Numbers and Other File Attributes
When a process opens a file, Enscribe assigns the file a number that is unique within
that process. File number zero is always set aside for $RECEIVE, regardless of
whether a process opens it or not. The first other file that a process opens is assigned
file number one. Enscribe always assigns the lowest available file number. After a
process closes a file, the associated file number becomes available.
Many Enscribe routines require file numbers instead of file names. Each of these
routines returns a file number:
HP COBOL routine COBOLFILEINFO or COBOL_FILE_INFO_
Enscribe routine FILE_GETINFO_
Each of the preceding routines can return other file attributes in addition to the file
number; use the routine best suited to your needs.
The HP COBOL routine COBOLFILEINFO or COBOL_FILE_INFO_ accepts a COBOL
file name and returns:
The file number of the file
The internal form of the file name associated with the file description
The file-system error code of the last input-output operation attempted for that file
For more information about the COBOLFILEINFO routine, see COBOLFILEINFO. For
more information about the COBOL_FILE_INFO_ routine, see COBOL_FILE_INFO_.
The FILE_GETINFO_ procedure can return more attributes than the HP COBOL
routine COBOLFILEINFO can. For details, see the Guardian Procedure Calls
Reference Manual.
Determining Whether Two COBOL File Names Specify the Same
Physical File
Through programmer error or a TACL ASSIGN command, two COBOL file names in
the same run unit can refer to the same physical file. This situation is not forbidden; in
fact, it can be useful: you can develop a server by having the input come from a disk
file and the output go to a printer, and then putting the server into production with both
the input file and the output file assigned to $RECEIVE.
Having two COBOL file names refer to the same physical file can also cause problems.
If, for example, a program has two output files that are intended as two separate
reports, and both are assigned to the same printer (not a spooler collector but the
same mechanical device), then the program terminates abnormally. If both files have
the exclusion mode SHARED, the lines of the two reports are interspersed on the
paper.