Using the PREFIX Verb
The PREFIX verb lets you specify a method of searching for a file through a prefix list. The following steps are performed when locating a file:
-
If the file name is an ALIAS for a device, the prefix is not used.
-
PRO/5 tries to locate the file using the name as given in the program. The host system may apply search rules of its own using default disk drives and/or directories.
-
If the file was not found and if multiple disk drives exist on the system, PRO/5 will start with the default disk drive. It will then proceed with the first through the last drive skipping the default drive. ("Multiple" disk drives may be figuratively set up in the config.bbx file.)
-
On each disk drive PRO/5 will try each prefix in the prefix list. If an individual prefix entry actually specifies a disk drive other than the current search disk, that entry will be skipped. If the original file name included a disk drive, only that disk will be searched. In addition, if the original file name included a path starting at a disk root, no prefix will be applied to the name.
If you have access to named disk drives (as in DOS), the DISABLE, ENABLE,
and SETDRIVE commands will have an affect on the search pattern used when
looking for a file. The SETDRIVE command tells PRO/5 (and the host operating
system) what disk drive to use first when looking for a file. The DISABLE
command tells PRO/5 what drives to ignore when looking for a file. The
ENABLE command tells PRO/5 to stop ignoring a drive that you previously
told it to ignore.
Assuming the disk drives "A", "C", and "Z"
and the following command:
OPEN(1)"ABC"
PRO/5 would attempt the following file open commands on the system:
C:ABC, A:ABC, Z:ABC (assuming the current disk was "C")
If you are using an operating system that hides the disk drive or drives
from you (e.g., the UNIX OS) then you will need to use the PREFIX command
to set up a list of directories to be searched.
Assuming you want to search the directories "/basis/pro5" and
"/u1/data" you would use the following PREFIX command:
PREFIX "/basis/pro5/ /u1/data/"
Note the trailing slash and the space used as a separator between directory
names. PRO/5 simply uses the text provided by the PREFIX command plus
your file name in the OPEN to create a file name to be opened. Note also
that the current directory is always searched and should never appear
in the prefix list.
So, using the examples above, the following would cause ABC, /basis/pro5/ABC, /u1/data/ABC
to be searched by the operating system:
PREFIX "/basis/pro5/ /u1/data/"
OPEN (1)"ABC"
Adding the disk drives named above (again assuming the current drive is "C"):
C:ABC, C:/basis/pro5/ABC, C:/u1/data/ABC
A:ABC, A:/basis/pro5/ABC, A:/u1/data/ABC
Z:ABC, Z:/basis/pro5/ABC, Z:/u1/data/ABC
You may reduce the disk drive searching by either eliminating the disk from the search list (using DISABLE) or by placing a disk name on an entry in the PREFIX list. Using the same example as above:
PREFIX "C:/basis/pro5/ Z:/u1/data/"
OPEN(1)"ABC"
The following disk accesses occur:
C:ABC, C:/basis/pro5/ABC
A:ABC
Z:ABC, Z:/u1/data/ABC