Overview of the SAS/C® Cross-Platform Compiler and C++ Development System

Introduction

The SAS/C Cross-Platform Compiler and the SAS/C Cross-Platform C++ Development
System run on a workstation and produces pre-linked output files that can be transferred to an IBM System/370 mainframe. On the IBM System/370 mainframe, the files can be linked to produce an executable load module.

Like the SAS/C Compiler, the SAS/C Cross-Platform Compiler and C++ Development System is a portable implementation of the high-level C and C++ languages. It provides the same functionality under a UNIX operating system as the SAS/C C and C++ Development System does under the MVS or CMS operating systems. This includes the following:

Note: In this release, COOL replaces CLINK as the default SAS/C pre-linker on MVS and CMS systems. Similarly, the program cool replaces clink as the default pre-linker for the SAS/C Cross-Platform Compiler and C++ Development System. For details on this and other changes in Release 6.0, see Appendix E, "Compatibility Notes".
Figure 1 below illustrates the application development process using the SAS/C Cross-Platform Compiler and C++ Development System.

FIGURE 1: Application Development Process

Why Use the SAS/C Cross-Platform Compiler and C++ Development System

There are several benefits to using the SAS/C Cross-Platform Compiler and C++ Development System to generate code for the mainframe.

System Requirements

Before using the SAS/C Cross-Platform Compiler and C++ Development System, you must consider the system requirements of both the host workstation that runs the cross-platform development system and the target mainframe that runs the applications developed with the cross-platform development system.

Workstation (Host)

The host workstation provides the development platform used to run the cross-platform development system. Release 6.00 of the SAS/C Cross-Platform Compiler and C++ Development System runs under a UNIX operating system on either a Sun-4, RS/6000, or HP workstation. Future releases of the cross-platform development system may support additional platforms or other operating systems.

Mainframe (Target)

The intended target for applications developed with the cross-platform development system is an IBM System/370 mainframe running either MVS or CMS. Your applications can be redistributed in accordance with the restrictions described in Appendix D, "SAS/C® Redistribution Package" on page 111.

File Transfer

In addition to the host and target system requirements, you must also consider the file transfer system that will be used to move your pre-linked output files from the host to the target. One of the most effective methods of transferring files between systems is file transfer protocol (FTP).

FTP uses the Transmission Control Protocol/Internet Protocol (TCP/IP) as the network mechanism for communicating between the host and target machines. Both FTP and TCP/IP are available at most mainframe sites. However, if this method of file transfer is not available at your site, you can use any file transfer method that enables you to transfer binary files between your workstation and the mainframe. The pre-linked output file is already in binary form and does not require conversion from text to binary. Also, if you copy object files from the workstation to the mainframe, be sure the destination data set has a logical record length of 80 (LRECL=80) and a fixed record format (RECFM=F or FB).

Note: The SAS/C Connectivity Support Library (CSL) provides the capability of using Network File System (NFS) to copy files between the workstation and the mainframe using example utilities that are provided with that product. See "Manipulating Files and Directories" on page 96 for additional information.

SAS/C Cross-Platform Architecture

Figure 2 below illustrates the architecture of SAS/C Cross-Platform Software by showing the executable files that comprise the SAS/C Compiler and C++ Development System and their relationship to library, header, input, and output files. It also illustrates the relationship of the compiler to the host workstation and target mainframe.

FIGURE 2 Cross-Platform Compiler Architecture

Executable Files

The SAS/C Cross-Platform system is composed of the executable files shown in the following table.

TABLE 1. Names of Executable Files

-------------------------------------------
| Functional Name             | Filename  |
===========================================
| CICS command preprocessor   | ccp       |
-------------------------------------------
| C compiler driver           | sascc370  |
-------------------------------------------
| C++ driver                  | sasCC370  |
-------------------------------------------
| C++ translator              | cxx       |
-------------------------------------------
| parser                      | lc1       |
-------------------------------------------
| code generator              | lc2       |
-------------------------------------------
| global optimizer            | go        |
-------------------------------------------
| object module disassembler  | omd       |
-------------------------------------------
| ar370 archive manager       | ar370     |
-------------------------------------------
| pre-linker (default)        | cool      |
-------------------------------------------
| pre-linker                  | clink     |
-------------------------------------------

Note: There are several additional executable files for the utility programs provided with the SAS/C Cross-Platform Compiler.

Using the Executable Files

Like most compilers, the SAS/C Cross-Platform Compiler and C++ Development System performs the compilation in a series of phases.

The compiler drivers, sascc370 and sasCC370, control the compilation, invoking the other executable files and passing them options during the various phases.

The CICS command preprocessor recognizes CICS command embedded in your C and C++ source. The preprocessor translates these commands into appropriate function calls for communication with CICS.

The global optimizer, pre-linker, and object module disassembler are enabled by compiler options and, like the parser and code generator, their execution is controlled by the compiler driver.

The global optimizer, go, performs advanced optimizations such as merging common subexpressions and eliminating code that is never executed, constant propagation, and strength reduction. The global optimizer also allocates registers, placing the most highly used variables for each section of code in registers. This eliminates any need for you to select and specify register variables.

The object module disassembler, omd, is a useful debugging tool that provides a copy of the assembler code generated for a C or C++ program. In addition to running the object module disassembler at compile time, it can also be invoked independent of the driver.

The pre-linker, cool, is an object code preprocessor that merges CSECTs based on references to external variables. It provides the same functionality as the SAS/C COOL utility on the mainframe.

The C++ translator, cxx, parser, lc1, and code generator, lc2, are called by the compiler and C++ drivers to perform the actual compilation of the source code. Together, they handle the parsing, semantics analysis, instruction selection, and code emission phases of compilation.

The ar370 archive utility is used to generate groups of files that are combined into a single archive file.

See Chapter 5, "Using the Global Optimizer and the Object Module Disassembler" on page 49 for more information about go and omd.

Library and Header Files

The SAS/C Cross-Platform Compiler and C++ Development Systems require that the resident portions of the SAS/C and C++ libraries be located on the host workstation. The standard C and C++ header files must also be located on the host workstation. Optionally, you can specify additional header files as described in Chapter 2, "Using the SAS/C® Cross-Platform Compiler and C++ Development System" on page 9. The transient portion of the SAS/C and C++ Libraries is located on the target mainframe.

Input and Output Files

Input to the SAS/C Cross-Platform Compiler and C++ Development System is provided as C source code, C++ source code, or previously compiled object files. The output is either in the form of unlinked or pre-linked object files. Output files for the object module disassembler and the debugger may also be generated. The input and output files are described in greater detail in Chapter 2 on page 9.

Installation Considerations

The location of the executable files that compose the SAS/C cross-platform software is site-specific, and you should contact your on-site SAS/C software representative if you are not sure where these files are located on your workstation.

man Pages

The unformatted man pages listed in the following table are supplied with the SAS/C Cross-Platform Compiler and should be located in the man1 subdirectory.

TABLE 2. Available man Pages

--------------------------------------------------------------------
| man Page  | Provides information for...                          |
====================================================================
| ar370     | ar370 archive utility                                |
--------------------------------------------------------------------
| atoe      | ASCII-to-EBCDIC translation utility                  |
--------------------------------------------------------------------
| ccp       | CICS command preprocessor                            |
--------------------------------------------------------------------
| cool      | cool pre-linker                                      |
--------------------------------------------------------------------
| clink     | clink pre-linker                                     |
--------------------------------------------------------------------
| dset      | display license information                          |
--------------------------------------------------------------------
| etoa      | EBCDIC-to-ASCII translation utility                  |
--------------------------------------------------------------------
| mf2unix   | mainframe-to-UNIX C source code translation utility  |
--------------------------------------------------------------------
| objdump   | SAS/C 370 object file dump utility                   |
--------------------------------------------------------------------
| omd       | describes the object module disassembler             |
--------------------------------------------------------------------
| sascc370  | sascc370 C compiler driver                           |
--------------------------------------------------------------------
| sasCC370  | sasCC370 C++ driver                                  |
--------------------------------------------------------------------
| spatch    | SAS/C binary patching application                    |
--------------------------------------------------------------------
| unix2mf   | UNIX-to-mainframe C source code translation utility  |
--------------------------------------------------------------------
| update    | SAS/C update utility                                 |
--------------------------------------------------------------------
| zap       | SAS/C zap utility, used with license information     |
--------------------------------------------------------------------

To use these man pages, you must add install_location to your MANPATH environment variable, and install_location/host/hostname/bin to your PATH environment variable. The install_location and hostname are specific to your site.

Relationship to the Mainframe SAS/C C and C++ Development Systems

The SAS/C Cross-Platform Compiler and C++ Development System is a direct descendent of the mainframe system. Your mainframe C and C++ source code can be compiled by either product without modification.

Because of different maintenance structures, the SAS/C Cross-Platform Compiler and C++ Development System and the mainframe SAS/C C and C++ Development System do not always produce identical object code. However, the performance of applications compiled with either compiler will be essentially identical.

Debugging Considerations

To take complete advantage of a cross-development environment, it is preferable to retain the source code on the host workstation. This avoids the added burden of maintaining two copies of the source on two platforms.

You can use the SAS/C Debugger running on the mainframe to debug source code located on your workstation. The SAS/C Debugger has the ability to access source code and debugging information located on the workstation. The debugger uses the SAS/C CSL run-time transients that are provided with the SAS/C Cross-Platform Compiler to establish client/server connectivity between the workstation and the mainframe. This capability is described in Chapter 9, "Cross-Debugging" on page 71, Appendix A, "Installing and Administering the NFS Client", and Appendix B, "Using the NFS Client" on page 91. SAS/C CSL provides many additional features, which are described in SAS Technical Report C-113, SAS/C Connectivity Support Library, Release 1.00.