Specifying #include File Names

You can use the SEARCH and LSEARCH compiler options to specify search paths for system and user include files. For more information on these options, see LSEARCH | NOLSEARCH and SEARCH | NOSEARCH.

You can specify a file name using the syntax:
Read syntax diagramSkip visual syntax diagram/path.qualifierDD: ddname
Notes:
  1. Absolute CMS file names contain a file mode or are ddnames.
  2. Absolute BFS file names begin with a leading slash (/) as the first character in filename.

For more information on absolute file names, see Determining If filename Is In Absolute Form .

When the compiler performs a library search, filename may be treated as a BFS file name or a CMS file name. This depends on whether a CMS library or a BFS directory is being searched. If filename is treated as a BFS file name, then no conversions are performed on filename. If, on the other hand, filename is to be treated as a CMS file name, then the following conversions are performed:

  • For the first format:
    Read syntax diagramSkip visual syntax diagram /path .qualifier

    The compiler performs name conversions in the following order:

    1. All periods (.) are replaced with blank spaces.
    2. Characters up to and including the rightmost slash (/) (if any slashes are present) are deleted from the file specification.
    3. The remaining file specification must be of the form:
      Read syntax diagramSkip visual syntax diagramfilename filetypefilemode

      If there are more than three qualifiers, only the first three are used as the file name, file type and file mode, beginning with the leftmost qualifier. The remaining ones are ignored. If you specify the CHECKOUT(PPTRACE) compiler option, a message states what include files the preprocessor is looking for.

    4. All file names and file types are truncated to a maximum of eight characters. File modes are truncated to two characters.
    5. The file mode must be a valid CMS file mode, or an asterisk (*).
    6. If a file mode is not specified, the currently accessed disks are searched in the order described under Search Sequences for Include Files.
    7. If a file type is not specified, the default is H.
  • For the second format:
    Read syntax diagramSkip visual syntax diagramDD: ddname
    1. DD: and ddname are uppercased and truncated to eight characters.
    2. Invalid characters are not converted to at signs(@, hex 7c).

Table 1 gives the original format of the file name as specified on a #include directive in a source file, and the actual file name used when XL C/C++ attempts to locate and open the file.

Table 1. Include Directive and Resulting File Names
#include Directive Resulting File Name
#include <stdio.h> STDIO H
#include <Shoe/Sale/Fall.D> FALL D
#include "cprog" CPROG H
#include "utility.h.a" UTILITY H A
Note: If the file is not found on disk A, no further search is made.
#include "DD:MYSYS" file name on MYSYS DD
Note: The file name associated with the ddname MYSYS will be used.
#include <DD:PLANLIB> file name on PLANLIB DD
Note: The file name associated with the ddname PLANLIB will be used.