Chapter Contents

Previous

Next
Executing C Programs

Executing C Programs from the USS Shell

To run a SAS/C program under the USS shell, the program must reside in an executable HFS file, and its directory must be included in the value of the PATH environment variable. If these conditions are satisfied, you can execute the program simply by typing the name and any options at the shell prompt. If the program's directory is not in your PATH, you can still run it, but you must give the full pathname. You can also call a program in a PDS from the shell by using the pdscall utility. See Using pdscall for details.

The following is an example of calling a program from the shell.

shlexam =w -z <input

In the example, the library option =w overrides the program's use of the quiet function to suppress warnings, and -z is a program option. The redirection, <input , is processed by the shell, not by the SAS/C Library, and causes the standard input file to be redirected from the file named INPUT in the current directory.

Note:    Because redirections are interpreted by the shell rather than by the library, you cannot redirect files to nonstandard filenames, such as ones whose names start with // .  [cautionend]

Before you can run any SAS/C program under the shell, the SAS/C Transient Library must be available. Your site may make the library available automatically, by installing it into the system link list, or by using /etc/profile to make it available when you use the omvs command to startup the shell. If your site does not make the SAS/C Library available, then you must do one of the following prior to invoking a SAS/C program:

For example, if your site installed the transient library as VDR.SASC.LINKLIB, then you could specify either of the following:

export ddn_CTRANS=vdr.sasc.linklib
export STEPLIB='vdr.sasc.linklib:sys1.favorite.linklib'

The latter command defines SYS1.FAVORITE.LINKLIB as a STEPLIB in addition to the SAS/C Library.

Note that using ddn_CTRANS may improve performance, particularly if you frequently invoke the standard utilities, which are not written using SAS/C and therefore do not require transient library access.


Using pdscall

pdscall is an USS shell command that can be used to run SAS/C programs stored in a PDS. The programs are called using USS exec -linkage, so that their behavior should be the same as if the program were copied to the hierarchical file system and invoked as a shell command.

The syntax of pdscall is as follows:

pdscall pgmname
options

The pgmname should be a fully qualified OS/390 data set name followed by a member name in parentheses. If no member name is specified, the member TEMPNAME is assumed. The pgmname may be specified in either uppercase or lowercase, and it should be enclosed in quotes to prevent shell interpretation of the parentheses around the member name. Following the program name may optionally appear one or more program options. These are passed to the program unmodified.

The exit status of pdscall is the same as that of the invoked program.

Note that pdscall may produce successful results with programs that are not written in SAS/C, but that correct results are not guaranteed.


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 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 function call and return.

You should use the set search command in your profile to inform the debugger of the locations of debugger symbol tables. See SAS/C Software: Changes and Enhancements, Release 7.00 for information on set search .

Note that use of the sascdbg command is required to debug a program running under the shell. The run-time option =debug will be ignored if specified for a program running under the shell.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.