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, given a file name:
-
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 its own search rules using default disk drives or directories.
-
-
If the file is not found, PRO/5 will start searching the default disk drive, or, if the file name includes a disk drive, it will search only that specified drive.
-
When searching a disk drive, PRO/5 will try each prefix in the prefix list.
-
If a prefix entry specifies a disk drive other than the one currently being searched, that prefix entry will be skipped.
-
In addition, if the original file name included a path starting at a disk root, no prefix will be applied to the name.
-
-
If multiple disk drives exist on the system and the file name does not include a disk drive, PRO/5 will search the first through the last drive, skipping the default drive, applying the above prefix search for each drive in turn.
"Multiple" disk drives may be figuratively set up in the config.bbx file.
-
If you have access to named disk drives (as in DOS), the DISABLE, ENABLE, and SETDRIVE commands will have the following effects 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
BBj-Specific Information
When searching for a file in Windows, BBj defaults to the same rules as Visual PRO/5; if a disk (e.g. C:) is specified, it only looks for the file on that disk. Earlier versions of BBj would check for the file on all available disks, even if the filename specified a particular disk. The LEGACY_SCAN_MODE !COMPAT setting can be set to TRUE in BBj 14 and higher to revert to the original BBj behavior of checking all disks.