Accessing Files Programmer's Guide (32650-90885)

Chapter 3 75
Specifying a File Designation
User-Defined Files
In addition, the slash mark (/) that separates these names should not be preceded or
followed by blanks. The lockword may contain from one to eight alphanumeric
characters, beginning with a letter. If a file is protected by a lockword and you fail to
supply that lockword in your reference, you are denied access to the file. In the following
example, the old disk file XREF, protected by the lockword OKAY, is referenced:
FILE INPUT=XREF/OKAY <---- Lockword
In session mode, you can supply the lockword as part of the file designator specified in
the FILE command or HPFOPEN/FOPEN intrinsic call that establishes access to the file,
using the same syntax rules described above. If a file is protected by a lockword and you
fail to supply it when you open the file, the file system interactively requests you to
supply the lockword as shown in the example below:
LOCKWORD: YOURFILE.YOURGRP.YOURACCT?
Always bear in mind that the file lockword relates only to the ability to access files, and not
to the account and group passwords used to log on. Three examples of FILE commands
referencing lockwords are shown below; the last command illustrates the complete, fully
qualified form of the
filereference
format.
FILE AFILE=GOFILE/Z22 <---- Lockword
FILE BFILE=FILEM/LOCKB.GRO7
|
|---- Lockwords
|
FILE CFILE=PAYROLL/X229AD.GROPN.ACCT10
A file may have only one lockword at a time. You can change or remove the lockword by
using the RENAME command or the FRENAME intrinsic. You can also initially assign a
lockword to an existing file with this command or intrinsic.
To accomplish these tasks, you must be the creator of the file.
Backreferencing files
Once you establish a set of specifications in a FILE command, you can apply those
specifications to other file references in your job or session simply by using the file's formal
designator, preceded by an asterisk (*), in those references. For example, suppose you use a
FILE command to establish the specifications shown below for the file FILEA, used by
program PROGA. You then run PROGA. Now you wish to apply those same specifications to
the file FILEB, used by PROGB, and run that program. Rather than specify all those
parameters again in a second FILE command, you can simply use FILE to equate the FILEA
specifications to cover FILEB, as follows:
This technique is called backreferencing files, and the files to which it applies are
FILE FILEA;DEV=TAPE;REC=-80,4,V;BUF=4 Establishes specifications.
RUN PROGA Runs program A.
FILE FILEB=*FILEA Backreferences specifications for FILEA.
RUN PROGB Runs program B.