Compiling without binding using compiler invocation command names supported by c89 and xlc

To compile source files without binding them, enter one of the supported command names (for example, c89 or c++) with the -c option to create object file output. Use the -o option to specify placement of the application program executable file to be generated. The placement of the intermediate object file output depends on the location of the source file:

Compiling z/OS XL C application source to produce only object files

c89 and xlc recognize that a file is a C source file by the .c suffix for z/OS UNIX files, and the .C low-level qualifier for data sets. They recognize that a file is an object file by the .o suffix for z/OS UNIX files, and the .OBJ low-level qualifier for data sets.

To compile z/OS XL C source to create the default 32-bit object file usersource.o in your working z/OS UNIX directory, specify:
c89 -c usersource.c
To compile z/OS XL C source to create the default 64-bit object file usersource.o in your working z/OS UNIX directory, specify the following using the c89 utility:
c89 -c -Wc,lp64 usersource.c
The following shows the same example using the xlc utility:
c89_64 -c usersource.c
To compile z/OS XL C source to create an object file as a member in the PDS KENT.APPROG.OBJ, specify:
c89 -c "//'kent.approg.c(usersrc)'"

Compiling z/OS XL C++ application source to produce only object files

c89 and xlc recognize that a file is a C++ source file by the .C suffix for z/OS UNIX files, and the .CXX low-level qualifier for data sets. They recognize that a file is an object file by the .o suffix for z/OS UNIX files, and the .OBJ low-level qualifier for data sets.

To compile z/OS XL C++ source to create the default 32-bit object file usersource.o in your working z/OS UNIX directory, specify the following:
c++ -c usersource.C
To compile z/OS XL C++ source to create the default 64-bit object file usersource.o in your working z/OS UNIX directory, using the c89 utility specify:
c++ -c -Wc,lp64 usersource.C
The following shows the same example using the xlc utility:
c++_64 usersource.C 
To compile z/OS XL C++ source to create an object file as a member in the PDS JONATHAN.APPROG.OBJ, specify:
 c++ -c "//'jonathan.approg.CXX(usersrc)'"
Note:
To use the TSO utility OGET to copy a C++ z/OS UNIX listing file to a VBA data set, you must add a blank to any null records in the listing file. Use the awk command as follows if you are using the c89 utility:
c++ -cV mypgm.C | awk '/^[^$]/ {print} /^$/
   {printf "%s \n", $0}' > mypgm.lst
The following shows the same example using the xlc utility:
xlC -c -qsource mypgm.C | awk '/^[^$]/ {print} /^$/
   {printf "%s \n", $0}' > mypgm.lst

Compiling and binding application source to produce an application executable file

To compile an application source file to create the 32-bit object file usersource.o in the z/OS UNIX System Services working directory and the executable file mymod.out in the /app/bin directory, specify:
c89 -o /app/bin/mymod.out usersource.c
To compile an application source file, to create the 64-bit object file usersource.o in the z/OS UNIX working directory and the executable file mymod.out in the /app/bin directory, specify the following using the c89 utility
 c89 -Wc,lp64 -Wl,lp64 -o /app/bin/mymod.out usersource.c
The following shows the same example using the xlc utility:
c89_64 -o /app/bin/mymod.out usersource.c
To compile the z/OS XL C source member MAINBAL in the PDS CLAUDIO.PGMS.C, and bind it to produce the application executable file /u/claudio/myappls/bin/mainbal.out, specify:
c89 -o /u/claudio/myappls/bin/mainbal.out "//'claudio.pgms.C(MAINBAL)'"