PLBLinux Search Paths


 

Sunbelt's implementation supports a feature that is different from most programming language environments and even some PL/B implementations. The ability to specify one or more directories as `Logged on Drives' is a useful technique for organizing programs and data files into individual areas without impeding a program's ability to access them generically. If a search of the current directory fails on a generic OPEN, PREP, or CHAIN instruction, any Search Paths are also be searched in the order they are listed. By establishing a PLB_PATH environment variable, one or more directories, separated by colons, can be specified as Search Paths. Assume the following was added to the user's profile script (.profile):

 

PLB_PATH=/usr/prog:/usr/txt:/usr/ndx;export PLB_PATH

 

and the current directory is /usr/test. In this case, the Logged on Drives would be the current directory (/usr/test) plus those in PLB_PATH (/usr/prog, /usr/txt and /usr/ndx). Therefore, the following examples would perform as described:

 

 

OPEN

FILE,"test.txt"

 

An attempt would be made to OPEN the file "test.txt" within the current directory. If unsuccessful, the OPEN would then check the first directory specified in PLB_PATH. If that proves unsuccessful, then the second directory specified would be checked, followed by the third and so on until either the file OPEN was successful or the PLB_PATH list is exhausted, at which time an IO error (I03) would occur if the file could not be found.

 

 

PREP

FILE,"test.txt"

 

The guidelines listed above apply except that if "test.txt" did not exist in either the current directory or any of those in the PLB_PATH list, the file would be created within the current directory.

 

 

CHAIN

"test.plc"

 

An attempt would be made to locate and CHAIN to the file "test.plc" in the current directory. If unsuccessful, the directories listed in PLB_PATH would be searched until either the file is found or the list is exhausted. If "test.plc" is not found in any of the directories, a CHAIN fail error (C03) occurs.

 

 

OPEN

FILE,"/usr/programs/test.txt"

or

 

PREP

FILE,"/usr/programs/test.txt"

or

 

CHAIN

"/usr/programs/test.plc"

 

The directory preceding the name is the only one searched for its existence. The current directory or those listed in PLB_PATH are ignored.

 

Default file and/or program extensions, as defined with for the screen definition file, are still in effect when Search Paths are used.

 

 

See Also: Compiler and Runtime Options

 



Compiler and Runtime Options PLB Unix Screen Definition File PLB Unix Environment Variables