Accessing Files Programmer's Guide (32650-90885)

Chapter 2 51
Creating A File
The FILE Command
The FILE Command
The FILE command is used to determine how a file will be accessed. You may use FILE to
describe any of the characteristics available with HPFOPEN/FOPEN or BUILD, but you cannot
actually create a file with the FILE command. While HPFOPEN/FOPEN and BUILD
physically allocates space for a file and define its characteristics, the FILE command may
only define how a file will be accessed at run time.
To be effective, a FILE command must be issued before your file is opened; it takes effect
when the file is opened. A FILE command remains in effect until the job or session ends,
until it is canceled with a RESET command, or until it is overridden by another command
for the same file. Thus, if you enter a FILE command equating the formal designator
DATAFL to the actual designator DISCFILE (indicating a disk file) and then run three
programs that reference DATAFL, all three programs will access the file DISCFILE. If you
wish to define other characteristics for the file, simply issue another FILE command; if you
want to nullify the FILE command completely so that the formal designator has the
characteristics originally specified by the program that is using it, issue a RESET command.
For example, suppose that you run two programs, both referencing a new temporary file
named DFILE located on disk. Before you un the first program, you want to redefine the file
so that it is output to the standard list device. To do this, you would issue a FILE command
equating DFILE with the actual designator $STDLIST. In the second program, the file is
again to be a temporary file on disk. You issue a RESET command so that the specifications
supplied by the second program (rather than those in the FILE command) apply.
JOB JNAME,UNAME.ANAME
.
.
.
FILE DFILE=$STDLIST
RUN PROG1
.
.
.
RESET DFILE
RUN PROG2
.
.
.
A comparison of the parameters for FILE, FOPEN, and HPFOPEN is given in Table 2-3. on
page 52 For more information about using the FILE command, refer to the MPE/iX
Commands Reference Manual.