Specifying a Current Directory

The system supports two different methods of file searching: native rules and POSIX rules. You can select the file searching method by setting the SEARCHRULE file attribute to NATIVE or POSIX. Native rules are the default.

An advantage to using POSIX rules for file searching is that POSIX allows you to define the current working directory for a process. You define this directory with the CURRENTDIRECTORY task attribute. Once you have defined a current directory, the process can specify file names using an incomplete form known as a relative pathname. The system automatically combines the relative pathname with the CURRENTDIRECTORY value to determine the absolute pathname. The absolute pathname is the complete title of the file, encoded in a POSIX-defined format. The pathname is stored in the PATHNAME file attribute.

For example, consider the following WFL statements:

MYSELF (CURRENTDIRECTORY = “/-/MYFAM/USERCODE/JASMITH/DATA”);
FILE F1(SEARCHRULE = POSIX, PATHNAME = “TEST/ONE”);
FILE F2(SEARCHRULE = POSIX, PATHNAME = “REPORT/BRIEF”);

The preceding statements have the same effect as the following statements:

FILE F1(SEARCHRULE = POSIX,
        PATHNAME = “/-/MYFAM/USERCODE/JASMITH/DATA/TEST/ONE”);
FILE F2(SEARCHRULE = POSIX,
        PATHNAME = “/-/MYFAM/USERCODE/JASMITH/DATA/REPORT/BRIEF”);

You can use a SEARCHRULE value of POSIX only if the DL (Disk Location) command has been used to define a DL ROOT family on your system.

A SEARCHRULE value of POSIX has two side effects of which you should be aware:

  • Family substitution is disabled.

  • For usercoded files, the usercode must be explicitly included in the PATHNAME attribute or the CURRENTDIRECTORY attribute. The system does not implicitly add a usercode when none is specified.

For more details about absolute and relative pathnames, refer to the CURRENTDIRECTORY task attribute description. Refer also to the descriptions of the SEARCHRULE and PATHNAME file attributes in the File Attributes Programming Reference Manual.