Records and Files in the File System [ Getting Started as an MPE/iX Programmer Programmer's Guide ] MPE/iX 5.0 Documentation
Getting Started as an MPE/iX Programmer Programmer's Guide
Records and Files in the File System
The File System manages data being transferred or stored with peripheral
devices. It handles I/O operations, such as passing information to and
from user processes, compilers, and information management subsystems.
Conceptually, information for data transfers is arranged as elements of
data in a record. The record is input, processed, and output as a single
unit. Logically related records are grouped into sets called files,
which can be kept in any storage medium or sent to any I/O peripheral, as
shown in Figure 6-2 . In some cases, records may be physically
grouped together in blocks when they are in a file residing on a non-disc
device.
Figure 6-2. Records and Files Relationship
Since all I/O operations are done through the mechanism of files, you can
access different devices in a standard, consistent way. The names
assigned to a file when it is defined in a program do not restrict that
file to residing on the same device every time the program is run; the
program is device independent.
The File System recognizes two basic types of files, classified by the
media on which they reside when processed: disc files and device files.
For detailed information on the File System interface, disc files, device
files, and spooled device files, refer to Accessing Files Programmer's
Guide (32650-90017).
Device Files
Device files are files currently being input to or output from any
peripheral device, except a system or private domain disc volume. A
foreign disc or serial disc file is considered to be a device file. A
device file is nonsharable; it is accessed exclusively by the job or
session that acquires it and is owned by that job or session until the
job or session explicitly releases it or terminates.
A device file is a set of logically related records transferred to or
from a non-random disc device such as a terminal, magnetic tape, or line
printer. A device file is built differently from a disc file. You
define the physical and operational characteristics each time you access
the device. However, the File System is used to open, access, and close
a device file, just as it does a disc file. When you have a program that
is written to use a disc file and you want it to use a device file at run
time, use the DEV= parameter of the :FILE command to specify a device
class (such as TAPE) or a specific logical device number that corresponds
to a device on your system. If you do not use the DEV= parameter, the
:FILE command defaults to defining a disc file. Magnetic tape has no
mandatory settings. You can use the REC= parameter of the :FILE command
to specify physical characteristics.
The File System HPFOPEN and FOPEN intrinsics automatically set actual
device characteristics that override any specifications passed from the
program or the :FILE command. For example, the actual device
characteristics of a line printer are always NEW, ASCII, UNDEFINED, and
WRITE ONLY access.
If a device file characteristic is not specified through one of the
following, then it has a default value:
* Use of device characteristics.
* :FILE command.
* The way in which a program opens the file.
Figure 6-3 shows an example of specifying device file characteristics
in a :FILE command. In this figure, the device specified by :DEV= for
the file named PAYROLL is a line printer; the output priority of the
spoolfile is 1; and the number of copies of output to print is 3. The
;FORMS= message is sent to the console when the file is ready to be
output to a device.
Figure 6-3. Specifying Device File Characteristics
The most common medium for storage of a device file is magnetic tape.
The File System has several capabilities in handling magnetic tape
labels, and the Labeled Tape Facility provides for the handling of
multireel tape sets. For detailed information on magnetic tape labels,
refer to the MPE/iX Commands Reference Manual Volumes 1 and 2
(32650-90003 and 32650-90364) and Accessing Files Programmer's Guide
(32650-90017).
Disc Files
A disc file is a set of logically related records that reside on disc. A
disc file is immediately accessible by the system and is potentially
sharable by several jobs or sessions at a time. The structure of a disc
file is determined by the physical constraints of the disc, such as
available space, and user-defined elements of the file. You use the File
System to build, open, access, and close a disc file.
A disc file resides on one or more volumes. A file does not have to
reside as a contiguous piece on one volume, but can be broken into many
extents distributed on different volumes.
The File System must store data on disc in an efficient manner, since
files are constantly manipulated: added, deleted, and updated. It uses
demand paged virtual memory to manage virtual memory and the user
interface to files. This occurs transparently from the user's
perspective. Page-sized portions of files are swapped into memory only
when needed.
The user-defined elements of a disc file are those within your control.
Elements you can specify include:
* Which disc (or discs) the file will reside on.
* Record type, size, and access.
For detailed information on record types and elements you can specify,
refer to the "Record Structure" subsection and Accessing Files
Programmer's Guide (32650-90017).
MPE/iX 5.0 Documentation