![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS/C C++ Development System User's Guide, Release 6.50 |
Before running the translator, compiler, COOL, or any C++ program, ensure
that the transient library is allocated to the CTRANS DDname or that it is
installed in the system link list. Consult your SAS Software Representative
to determine if this has been done for you.
The LCXX CLIST invokes the translator and compiler. Optionally, you can also invoke the OMD370 object module disassembler utility. The LCXX CLIST has the following format:
| LCXX dsname<options> |
where dsname is the name of the data set containing the C++ program to be translated and compiled. Follow standard TSO data set naming conventions. If the data set belongs to another user, specify the full data set name enclosed in apostrophes. If the program is a member of a partitioned data set (PDS), specify the member name in parentheses following the data set name. Here are two examples of invoking LCXX to translate and compile a program in a data set belonging to another user:
LCXX 'FRIEND.PROJ.CXX' LCXX 'LEADER.APPL.CXX(SUBRTN)' |
If the data set belongs to you and you do not enclose the data set name in apostrophes, LCXX assumes that the final qualifier of the data set name is CXX. If you do not specify CXX, the CLIST adds it for you. Here are two examples of invoking LCXX to translate and compile a program in a data set belonging to you:
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)) |
In this final example, the savec option causes the translator and compiler to be invoked. The intermediate C code is saved in LEADER.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.
To include a header file from your personal files (as opposed to header files from system files), surround the filename with double quotes, as shown here:
#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" |
For this statement, the translator includes member PROJECT from the
file associated with the DDname H. If the file is not found, the translator
also searches the system header files.
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.
The COOL CLIST invokes COOL to preprocess your object code and then calls the linkage editor to create a load module. The format of the COOL CLIST is
| COOL dsname CXX <options> |
where dsname is the name of the primary input data set and it is required. The data set must contain either object code or control statements or both. Follow standard TSO data set naming conventions when specifying this name. If the data set belongs to another user, specify the full data set name enclosed in apostrophes. If the program is a member of a PDS, specify the member name in parentheses following the data set name. The following two examples invoke COOL to link a program in a data set belonging to another user:
COOL 'FRIEND.PROJ.OBJ' CXX COOL 'LEADER.APPL.OBJ(SUBRTN)' CXX |
If the data set belongs to you and you do not enclose the data set name in apostrophes, COOL assumes that the final qualifier of the data set name is OBJ. If you do not specify OBJ, the CLIST adds it for you. The following two examples invoke COOL to link a program in a data set belonging to you:
COOL PROJ.OBJ CXX COOL APPL(SUBRTN) CXX |
In the second example, the CLIST assumes that the program is in userid.APPL.OBJ(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.
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 also accepts input from AR370 archives. For information on this type of file, refer to the SAS/C Compiler and Library User's Guide.
COOL input files can contain control statements instead of, or in addition to, object code. Refer to COOL Control Statements for more information.
More detailed information about the COOL utility and the COOL CLIST
is available in the SAS/C Compiler and Library User's Guide.
C++ programs can be called under TSO via the TSO CALL command. Depending on how the SAS/C C++ Development System has been installed at your site, you may have a higher level of support available. The optional methods are
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 |
Also, if your site supports calling C programs as standard TSO commands, you can call your program using this command line:
CXXPROG <INPUT -Z =48K |
This method also requires that your program library userid.APPL.LOAD be allocated to the DDname CPLIB.
Support for program invocation other than via the TSO CALL command is optional. Consult your SAS Software Representative to determine if this support is available at your site.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © Tue Feb 10 12:11:23 EST 1998 by SAS Institute Inc., Cary, NC, USA. All rights reserved.