Input to the z/OS XL C/C++ compiler

The following information describes how to specify input to the z/OS® XL C/C++ compiler for a regular compilation, or the IPA compile step. For more information about input for IPA, refer to Using the IPA link step with z/OS XL C/C++ programs.

If you are compiling a C or C++ program, input for the compiler consists of the following:
When you invoke the z/OS XL C/C++ compiler, the operating system locates and runs the compiler. To run the compiler, you need the following default data sets, which are supplied by IBM®: The locations of the compiler and the runtime library were determined by the system programmer who installed the product. The compiler and library should be in the STEPLIB, JOBLIB, LPA, or LNKLST concatenations. LPA can be from either specific modules (IEALPAxx) or a list (LPALSTxx). See the cataloged procedures shipped with the product in Cataloged procedures and REXX EXECs.
Note: For z/OS UNIX System Services file names, unless they appear in JCL, file names, which contain the special characters blank, backslash, and double quotation mark, must escape these characters. The escape character is backslash (\).

Primary input

For a C or C++ program, the primary input to the compiler is the data set that contains your XL C/C++ source program. If you are running the compiler in batch, identify the input source program with the SYSIN DD statement. You can do this by either defining the data set that contains the source code or by placing your source code directly in the JCL stream. In TSO or in z/OS UNIX System Services, identify the input source program by name as a command line argument. The primary input source file can be any one of the following:
  • A sequential data set
  • A member of a partitioned data set
  • All members of a partitioned data set
  • A z/OS UNIX file
  • All files in a z/OS UNIX directory

Secondary input

For a C or C++ program, secondary input to the compiler consists of data sets or directories that contain include files. Use the LSEARCH and SEARCH compiler options, or the SYSLIB DD statement when compiling in batch, to specify the location of the include files.

For more information on the use of these compiler options, see LSEARCH | NOLSEARCH and SEARCH | NOSEARCH. For more information on naming include files, see Specifying include file names. For information on how the compiler searches for include files, see Search sequences for include files. For more information on include files, refer to Using include files.

Note: The LRECL for the SCLBH.H data set has changed from 80 to 120. You should ensure that SCLBH.H is the first data set in your SYSLIB concatenation. Do not use the SYSLIB concatenation to search for C++ header files with the compiler because searching the SYSLIB concatenation cannot distinguish between the old UNIX System Laboratories header files and new ISO Standard Library header files. For example, #include <iostream.h> (old USL) and #include <iostream> (ISO Standard) are indistinguishable using the SYSLIB concatenation. Use the SEARCH compiler option so that the correct header files are included.