Accessing Files Programmer's Guide (32650-90885)

100 Chapter5
Opening a File
Opening a Device File
New and permanent device files
When a process accesses a device file (a file that resides on a nonshareable device), the
device's attributes may override information passed in the
domain
option
of the HPFOPEN/FOPEN call. Devices used for input only are considered permanent
files. Devices used for output only, such as line printers, are considered new files. Serial
input/output devices, such as terminals and magnetic tape drives, follow the
domain
option
specification in your HPFOPEN/FOPEN call
NOTE
The HPFOPEN intrinsic assumes that all files on nonshareable devices (device
files) are permanent files. To maintain compatibility with MPE V/E, device
files can be opened with the
domain option
specifying a new file, but a
warning is returned in the
status
parameter.
When your job or session attempts to open a permanent file on a nonshareable device,
MPE/iX searches for the file in the input device directory (IDD). If the file is not found, a
message is transmitted to the system console requesting the system operator to locate the
file by taking one of the following steps:
Indicate that the file resides on a device that is not in auto-recognition mode. No DATA
command is required; the System Operator simply allocates the device.
Make the file available on an auto-recognizing device, and allocate that device.
Indicate that the file does not exist on any device; in this case, your HPFOPEN/FOPEN
request is rejected.
When you use the
device name option
or
device class option
of HPFOPEN/FOPEN to
open a file on a nonshareable device (other than magnetic tape), you are requesting that an
unused device be allocated to your job or session. The first available device is allocated to
your job or session; the System Operator is not required to intervene. The device is
immediately available if it is not being used by another job or session, or if is already
allocated to your job or session by a previous HPFOPEN/FOPEN call.
If the device is already allocated to your job or session, you can specify that device by
passing its logical device number (LDEV) in the
device name option
of HPFOPEN/FOPEN.
Be certain, though, that you don't invoke a file equation that overrides the LDEV. (You can
use the FFILEINFO intrinsic to determine the LDEV assigned to an opened file.)
When you use the
device name option
or
device class option
of HPFOPEN/FOPEN to
open a file on a magnetic tape drive, operator intervention is usually required. The
operator must make the tape available, unless the tape is already mounted and recognized
by MPE/iX, it is auto-allocating, or if the tape drive is already allocated to the job or
session.
Opening an unlabeled magnetic tape file
Example 5-5 is an HP Pascal/iX code segment containing an HPFOPEN intrinsic call that
opens an unlabeled magnetic tape file TAPEFILE. The intrinsic call assumes that the tape
drive associated with device class TAPE supports a density of 1600 bpi.