HPlogo Accessing Files Programmer's Guide > Chapter 3 Specifying a File Designation

User-Defined Files

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 6 ♥
E0692 Edition 5

You can reference any user-defined file by writing its name and descriptors in the filereference format, as follows:

  filename[/lockword][.groupname][.accountname]

In no case must any file designator written in the filereference format exceed 35 characters, including delimiters.

When you reference a file that belongs to your logon account and group, you need only use the filereference format in its simplest form, which includes only a file name that may range from one to eight alphanumeric characters, beginning with a letter (unless, of course, the file has a lockword, in which case you must specify the lockword and a delimiter). In the following examples, both formal and actual designators appear in this format:

         Formal designator
         |
  FILE ALPHA=BETA     <---- Actual designator
  FILE REPORT=OUTPUT
  FILE X=AL126797
  FILE PAYROLL=SELFL

A file reference is always qualified, in the appropriate directory, by the names of the group and account to which the file belongs, so you need ensure only that the file's name is unique within its group. For instance, if you create a file named FILX under GROUPA and ACCOUNT1, the system recognizes your file as FILX.GROUPA.ACCOUNT1; a file with the same file name, created under a different group, could be recognized as FILX.GROUPB.ACCOUNT1.

File groups serve as the basis for your local file references; thus, when you log on, if the default file system file security provisions are in effect, you have unlimited access to all files assigned to your logon group and your home group. Furthermore, you are permitted to read, and execute programs residing in, the public group of your logon account. This group, always named PUB, is created under every account to serve as a common file base for all users of the account. In addition, you may read and execute programs residing in the PUB group of the System Account. This is a special account available to all users on every system, always named SYS.

When you reference a file that belongs to your logon account, but not to your logon group, you must specify the name of the file's group within your reference. In this form of the filereference format, the group name appears after the file name, separated from it by a period. Embedded blanks within the file or group names, or surrounding the period, are prohibited. As an example, suppose your program references a file under the name LEDGER, which is recorded in the system by the actual designator GENACCT. This file belongs to your home group, but you are logged on under another group when you run the program. To access the file, you must specify the group name as follows:

  FILE LEDGER=GENACCT.XGROUP  <------- Group name
  RUN MYPROG                  <------- Program file (in logon group)

As another example, suppose that you are logged on under the group name XGROUP but wish to reference a file named X3 that is assigned to the Public Group of your account. If your program refers to this file by the name FILLER, you would enter:

  FILE FILLER=X3.PUB

When you reference a file that does not belong to your logon account, you must use an even more extensive form of the filereference format. With this form, you include both group name and account name. The account name follows the group name, and is separated from it by a period. Embedded blanks are not permitted. As an example, suppose you are logged on under the account named MYACCT but wish to reference the file named GENINFO in the public group of the system account. Your program references this file under the formal designator GENFILE. You would enter:

  FILE GENFILE=GENINFO.PUB.SYS

A file reference that includes the file name, group, and account is called a fully qualified file name.


NOTE: You can create a new file only within your logon account; therefore, if you wish to have a new file under a different account, you log on to the other account and create the file in that account and group.

In summary, remember that if you do not supply a group name or account name in your filereference, MPE/iX supplies the defaults of the group and account in which you are currently logged on.

Lockwords


When you create a disk file, you can assign to it a lockword that must thereafter be supplied (as part of the filereference format) to access the file in any way. This lockword is independent of, and serves in addition to, the other file system security provisions governing the file.

You assign a lockword to a new file by specifying it in the filereference parameter of the BUILD command or the formaldesignator parameter of the HPFOPEN/FOPEN intrinsic used to create the file. For example, to assign the lockword SESAME to a new file named FILEA, you could enter the following BUILD command:

  BUILD FILEA/SESAME  <---- Lockword

From this point on, whenever you, or another user, reference the file in an MPE/iX command or HPFOPEN/FOPEN intrinsic, you must supply the lockword. It is important to remember that you need the lockword even if you are the creator of the file. Lockwords, however, are required only for old files on disk.

When referencing a file protected by a lockword, supply the lockword in the following manner:
  • In batch mode, supply the lockword as part of the file designator (filereference format) specified in the FILE command or HPFOPEN/FOPEN intrinsic call used to establish access to the file. Enter the lockword after the file name, separated from it by a slash mark. Neither the file name nor the lockword should contain embedded blanks. 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:

FILE FILEA;DEV=TAPE;REC=-80,4,V;BUF=4Establishes specifications.
RUN PROGARuns program A.
FILE FILEB=*FILEABackreferences specifications for FILEA.
RUN PROGBRuns program B.

This technique is called backreferencing files, and the files to which it applies are sometimes known as user predefined files. Whenever you reference a predefined file in a file system command, you must enter the asterisk before the formal designator if you want the predefinition to apply.




MPE/iX File Designators


System-Defined Files