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:
- If the z/OS® XL C/C++ source
module is a z/OS UNIX file, the object file
is created in the working directory.
- If the z/OS XL C/C++ source
module is a data set, the object file is created as a data set. The
object file is placed in a data set with the qualified name of the
source and identified as an object.
For example, if the z/OS XL C/C++ source
is in the sequential data set LANE.APPROG.USERSRC.C,
the object is placed in the data set LANE.APPROG.USERSRC.OBJ.
If the source is in the partitioned data set (PDS) member OLSEN.IPROGS.C(FILSER),
the object is placed in the PDS member OLSEN.IPROGS.OBJ(FILSER).
Note: When
the
z/OS XL C/C++ source
is located in a PDS member, you should specify double quotation marks
around the qualified data set name. For example:
c89 -c "//'OLSEN.IPROGS.C(FILSER)'"
If
the file name is not bracketed by quotation marks, the parentheses
around the member name in the fully qualified PDS name would be subject
to special shell parsing rules.
Since the data set name
is always converted to uppercase, you can specify it in lowercase
or mixed case.
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)'"