Chapter Contents |
Previous |
Next |
Executing C Programs |
CMSEXAM =w <input.file -z
In the example, the library option
=w
suppresses the
quiet
function.
<input.file
redirects
stdin
from the file INPUT FILE.
-z
is a program argument
that is to be passed to the
main
function via the
argv
vector. See Run-Time Argument Processing for information
about the types of program parameters.
C programs in TEXT files can be invoked with the LOAD and START commands, as follows:
LOAD CMSEXAM START * =w <input.file -z
The program parameters follow the asterisk (
*
) in the START command.
Using the Debugger |
Before
using the SAS/C Debugger, it is recommended
that you compile with the
debug
option. Debugger access to program source
and variables is permitted only if the C program was compiled with
debug
. Note that if you
compile with
dbhook
rather than with
debug
, debugging is limited to commands that do not
involve source or variable access. If you compile without specifying either
debug
or
dbhook
, use of the debugger is limited to tracing or stopping execution
at subroutine call and return. For information on running the debugger under
CMS, refer to the
SAS/C Debugger User's Guide and Reference.
CMS Parameter Lists |
As with any C program, the program parameters are transferred
to the
main
function via the
argv
vector. C programs under CMS generally use
the untokenized parameter list to create the
argv
vector. (See Run-Time Argument Processing for more information on
the
argv
vector.) The untokenized parameter list does not alter the program
parameters, in case or in length. For example:
cmsexam three very-long parameters
In this invocation of a C program, the
main
function receives
pointers to these strings:
three very-long parameters
In some cases, however, CMS provides only a tokenized
parameter list. If this occurs, the C program parameters are converted to
uppercase, and each token is truncated to eight characters. Given the command
line above, provided as a tokenized parameter list, the
main
function receives
pointers to the following strings:
THREE VERY-LON PARAMETE
Under CMS, the standard files
stdin
and
stdout
can be redirected to nonterminal files. (See Run-Time Argument Processing for more information.)
A typical redirection of
stdin
from a disk file might look like the following:
cmsexam <data.file.b
If only the tokenized parameter list is available, the
redirection parameter is truncated to <DATA.FI, which probably causes an
error to occur when
stdin
is opened. Therefore, the library accepts
the following alternate redirection form:
cmsexam <(data file b)
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.