Using include files

The #include preprocessor directive allows you to retrieve source statements from secondary input files and incorporate them into your C/C++ program.

z/OS XL C/C++ Language Reference describes the #include directive. Its syntax is:

Read syntax diagramSkip visual syntax diagram
>>-#include--+-<--+----+--filename-->-+------------------------><
             |    '-//-'              |   
             '-"--+----+--filename--"-'   
                  '-//-'                  

The angle brackets specify system include files, and double quotation marks specify user include files.

When you use the #include directive, you must be aware of the following:
  • The library search sequence, the search order that XL C/C++ uses to locate the file. See Search sequences for include files for more information on the library search sequence.
  • The file-naming conversions that the XL C/C++ compiler performs.
  • The area of the input record that contains sequence numbers when you are including files with different record formats. See z/OS XL C/C++ Language Reference for more information on #pragma sequence.