Chapter Contents

Previous

Next
Compiling C Programs

Compiling C Programs from the USS Shell

This section explains how to invoke the SAS/C Compiler from the MVS/ESA USS shell. As explained in Developing Applications for Use with UNIX System Services OS/390, the shell provides an operating system interface with commands and features that are very similar to a UNIX operating system.

The following syntax is used to compile and/or link a program from the USS shell:

sascc370 [options] [filename1 [filename2 ... ]]

The options argument is a list of compiler options (see Compiler Options), COOL options and/or OS/390 linkage editor options (see Linking C Programs). The filename arguments may contain any combination of C source files, object modules, and AR370 archives. Any input source files are compiled and then linked with the object files and the archives.

sascc370 invokes the compiler if there are any input sources files and then invokes the COOL processor followed by the linkage editor to link the object files. The COOL and link-edit steps will be bypassed if you specify the -c option. Note that this behavior is different from the TSO and CMS behavior, where separate commands are required to compile and link.

The input files to be compiled may reside either in the USS hierarchical file system (HFS) or in a standard OS/390 partitioned data set. The use of an HFS file is illustrated in the following example:

sascc370 proj/sort.c

If the program was located in the OS/390 PDS member named YOURLOG.PROJ4.C(SORT), the compiler could be invoked from the USS shell as follows:

sascc370 '//dsn:yourlog.proj4.c(sort)'

Alternately, assuming the initial qualifier YOURLOG is also your userid, the command could be shortened to:

sascc370 '//proj4.c(sort)'

In either case, the compiled and linked output module is stored in the file a.out in your current directory. To specify another file, use the -o option. For instance, the following command stores the output module in the file ./proj5/sort .

sascc370 -o ./proj5/sort ./proj5/sort.c

Here is an example of compiling a source program and linking it into an OS/390 PDS. The compiler options -Kcomnest and -Krent are used. Also, the linkage editor option -Brent is specified:

sascc370 -Kcomnest -Krent -Brent -o '//proj5.load(sort)' ./proj5/sort.c

Note that in order to invoke the sascc370 command, you must include the directory where SAS/C was installed in your PATH environment variable. Probably, your site will define PATH appropriately for you when you start up the shell. If your site does not do this, contact your SAS Installation Representative for C compiler products to obtain the correct directory name and add it to your PATH.


Chapter Contents

Previous

Next

Top of Page

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