Compiling and binding in the z/OS UNIX System Services environment
z/OS® UNIX C/C++ programs with source code in z/OS UNIX files or data sets must be compiled to create output object files residing either in z/OS UNIX files or data sets.
Both the SCEERUN and the SCEERUN2 libraries must be available when compiling in the z/OS UNIX System Services environment.
You can compile and bind application source code at one time, or compile the source and then bind at another time with other application source files or compiled objects.
- xlc utility uses the c89 utility to invoke the binder and the assembler and it has no direct interface to them
- xlc does not require that lp64 and xplink be explicitly specified as options on the command line for both the compile and the bind step; it uses the _64 and _x command name suffixes to ensure 64-bit and XPLINK compiles and binds
- xlc utility supports -q options syntax as the primary method of specifying options on the command line
- xlc utility is unaffected by the value assigned to the STEPLIB environment variable in the z/OS UNIX Systems Services session; it obtains the STEPLIB from the configuration file
- xlc utility supports the same command names as the c89 utility
(cc, c89, c++,
and cxx), so the PATH environment variable must
contain the path to the xlc
bindirectory ahead of the/bindirectory if the xlc version of cc, c89, c++, and cxx is required - xlc utility does not support -WI for invoking IPA; it uses -O4 and -O5 or -qipa as the mechanism for invoking IPA
The c89 utility and xlc utility invoke the binder by default, unless the output file of the link-editing phase (-o option) is a PDS, in which case the prelinker is used.
For information on customizing your environment to compile and bind in the z/OS UNIX System Services environment, see Environment variables or Setting up a configuration file.
c89 [-options …] [file.c …] [file.a …] [file.o …] [-l libname]- options
- are c89 or xlc options.
- file.c
- is a source file. Note that C source files have a file extension of lowercase c.
- file.o
- is an object file.
- file.a
- is an archive file.
- libname
- is an archive library.
The c89 and xlc utilities support IPA. For information on how to invoke the IPA compile step using c89 or xlc, refer to Invoking IPA using the c89 or xlc utilities.
You can also use the cc command to compile a C application program from the z/OS shell. For more information, see c89 - Compiler invocation using host environment variables or the xlc command names described in xlc — Compiler invocation using a customizable configuration file.
c++ [-options …] [file.C …] [file.a …] [file.o …] [-l libname]- options
- are C++ options.
- file.C
- is a source file. Note that C++ files have a file extension of
uppercase C. The _CXX_CXXSUFFIX environment variable or
cxxsuffixconfiguration file attribute can also be used to control which extensions are recognized as C++ file source extensions. - file.o
- is an object file.
- file.a
- is an archive file.
- libname
- is an archive library.
Another name for the c++ command is cxx. The cxx command and the c++ command are identical. You can use cxx instead of c++ in all the examples that are shown in this topic. If you are using the xlc utility, you can also use the xlc and the xlc++ commands, which are identical to c++ and cxx.
For a complete list of c++ options, and for more information on cxx, see c89 - Compiler invocation using host environment variables and xlc — Compiler invocation using a customizable configuration file.
For more information on using the make utility, see Archive and make utilities and z/OS UNIX System Services Programming Tools.