Chapter Contents |
Previous |
Next |
Using the SAS/C C++ Development System under TSO, CMS, OS/390 Batch, and UNIX System Services |
Translating and Compiling Your Program under TSO |
LCXX dsname<options> |
LCXX 'FRIEND.PROJ.CXX' LCXX 'LEADER.APPL.CXX(SUBRTN)'
LCXX PROJ.CXX LCXX APPL(SUBRTN)
In the second example, the CLIST assumes that the program
is in userid.APPL.CXX(SUBRTN). If the data set belongs to you
but is not named according to the CLIST assumptions, you must enclose the
data set name in apostrophes, as if the data set belonged to someone else. dsname must be the first item on the command line. options
are any translator, compiler, and, if the OMD option is used to invoke the
OMD370 utility, OMD370 options. Separate the options with one or more blanks,
commas, or tabs. See Option Summary for the options that are available for use with the translator. The LCXX CLIST
executes the compiler if no errors occur during translation. LCXX allocates
a temporary data set to contain the translator output.(footnote 1)
The LCXX CLIST supports three options that enable you to save
intermediate code produced by the translator:
pponly
,
tronly
, and
savec
. These
options require you to specify the name of an output data set, using standard
TSO conventions. Unlike the input data set name, LCXX does not assume a final
qualifier for the name of the output data set. Also, if the data set name
is fully qualified, use three apostrophes on each end. Here is a brief description
of each of the
pponly
,
tronly
, and
savec
options:
For detailed information on these three options, see Option Descriptions.
Note:
Because both
tronly
and
savec
save the intermediate C code
data set, you should use only one of them. For example, if you use
tronly
, you
do not need to also specify
savec
.
Here are some examples of specifying an output data
set. In this first example, the
pponly
option causes only the preprocessing
phase to be executed and the C++ code to be saved in userid.PROJ.PP(MAIN).
The C++ code is not translated or compiled.
LCXX PROJ(MAIN) PPONLY(PROJ.PP(MAIN))
In this next example, the
tronly
option causes the translator
to be invoked and the resulting C code to be saved in userid.PROJ.C(MAIN);
however, the C code is not compiled.
LCXX 'userid.PROJ.PP(MAIN)' TRONLY(PROJ.C(MAIN))
LCXX 'userid.PROJ.PP(MAIN)' SAVEC('''LEADER.PROJ.C(MAIN)''')
When a header
filename is surrounded by angle brackets in a
#include
statement, the translator
searches for the header file in standard C and C++ header files supplied by
SAS Institute and in any library specified via the LCXX CLIST
LIB
option.
The syntax for this form of the
#include
statement is
#include <member.ext>
The .ext part can be omitted. Here is an example of including a standard header file:
#include <new.h>
For this statement, the translator includes the file named NEW from the standard C++ header files.
When you use the LCXX CLIST, the data sets that contain
the standard C++ and C library header files are automatically available. You
can add your own data sets to this concatenation via the LCXX CLIST
LIB
option.
#include "member.ext"
The translator assumes that the header file is
member
in a PDS allocated to the
ext
DDname. You must allocate this DDname to the
member
file data set before invoking the LCXX CLIST. The
.ext
part can be omitted, in which case it defaults
to
.h
. Here is an example:
#include "project.h"
Linking Your Program under TSO |
All
C++ programs must be preprocessed by the COOL object code preprocessor because
COOL automatically creates object code used during the initialization and
termination of
static
objects. In addition, COOL supports linking
object files that contain mixed case external names longer than eight characters,
such as those created by the compiler for source code generated by the translator.
Such external names cannot be handled by the linkage editor unless the object
code has been preprocessed by COOL.
COOL dsname CXX <options> |
COOL 'FRIEND.PROJ.OBJ' CXX COOL 'LEADER.APPL.OBJ(SUBRTN)' CXX
COOL PROJ.OBJ CXX COOL APPL(SUBRTN) CXX
CXX is the only required option.
This option makes the
standard C++ object library SASC.LIBCXX.A, as well as the standard C object
libraries, available to COOL. You can add your own data sets to this concatenation
via the COOL
LIB
option. options are any COOL or linkage editor options.
Separate the options with one or more blanks, commas, or tabs. Refer to COOL Options for more
information.
COOL input files can contain control statements instead of, or in addition to, object code. Refer to COOL Control Statements for more information.
Running Your Program under TSO |
Here are some examples. Suppose that the load module
for your program is member CXXPROG in the data set userid.APPL.LOAD.
Suppose that you want to redirect
stdin
to the data set allocated to the DDname INPUT and pass the program
option
-z
. Finally, suppose that you want to override the default initial
stack allocation using the run-time option
=48k
. You can call the program using
the CALL command as shown here:
CALL APPL(CXXPROG) '<INPUT -Z =48K'
The CALL command automatically translates program arguments
to uppercase. If your program requires lowercase arguments, you can use the
ASIS
option of the CALL command
to suppress uppercasing of arguments. Here is an example using the
ASIS
option:
CALL APPL(CXXPROG) '<INPUT -z =48k' ASIS
Some older versions of TSO do not support the ASIS option.
If you want to run your program with the SAS/C Debugger,
use the
=D
option when
you call your program, as in the following example:
CALL APPL(CXXPROG) '=D'
For more information on debugging C++ programs, refer to Debugging C++ Programs Using the SAS/C Debugger.
Note:
Programs called via the CALL command cannot access
their name via the pointer in
argv[0]
.
If the C command has been installed at your site, allocate
your program library userid.APPL.LOAD to the DDname CPLIB and
call the program using this command line:
C CXXPROG <INPUT -Z =48K
CXXPROG <INPUT -Z =48K
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.