Resources

More about This Product

Feedback

SAS/C

The SAS/C® Tour


General Reference

Compile and Link Reference for Supported Platforms
  > Detailed Compiler Documentation
> Detailed Compiler Option Documentation
> Pre-Linking (COOL) Information
> Quick Start Examples by Platform:
Pre-Linking (COOL) Information

When any one of the conditions specified in When to Use COOL applies, you must use COOL to preprocess your object code. For more information, see The COOL Object Code Processor.

Notes:

  • The pre-linker program COOLB automatically executes the linkage editor after pre-linking.
  • It never hurts to pre-link, even if you don’t meet any of the required conditions to pre-link.
  • You can not pre-link a module twice.

For detailed information on linking C programs, including COOL options, see Linking C Programs.


OS/390

The product installation process creates a PDS called <your.installation.prefix>.PROCLIB. Contained in the PDS are various procedures for compiling, linking, and executing C, C++ and CICS applications.

Below are various samples using the cataloged procedures and JCL requirements necessary for executing the compiler under OS/390 batch.

The following JCL demonstrates compile, pre-Link, link, and execution for a C program:

********************************* Top of Data **************************
//CRG     JOB …
// JCLLIB ORDER=your.prefix.PROCLIB
//CLG   EXEC PROC=LC370CRG,
//          PARM.C='OMD',
//          PARM.GO='=V',
//C.STEPLIB DD DISP=SHR,DSN=your.LOAD
//C.SYSIN  DD DISP=SHR,DSN=your.source.C(HELLO)
//C.SYSLIN DD DISP=SHR,DSN=your.OBJ(HELLO)
******************************** Bottom of Data ************************
  

The following JCL demonstrates executing individual procedures used for each step:

********************************* Top of Data **************************
//HELLO JOB … 
// JCLLIB ORDER=your.prefix.PROCLIB
//********************
//* COMPILE
//********************
//C       EXEC PROC=LC370C,PARM.C='OMD'
//C.SYSIN      DD DSN=your.source.C(HELLO),DISP=SHR
//C.SYSLIN     DD DSN=your.OBJ(HELLO),DISP=SHR
//*
//********************
//* PRE-LINK and LINK
//********************
//LKED    EXEC PROC=LC370LR,COND=(4,LT)
//LKED.SYSIN   DD DSN=your.OBJ(HELLO),DISP=SHR
//LKED.SYSLMOD DD DSN=your.LOAD(HELLO),DISP=SHR
//LKED.SYSTERM DD SYSOUT=*
//*
//********************
//* GO
//********************
//GO       EXEC PGM=HELLO,COND=(4,LT)
//STEPLIB  DD DSN=your.LOAD,DISP=SHR
//SYSTERM  DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//*
//
******************************** Bottom of Data ************************
  

For C++ programs, the procedures start with LCXX. To compile, pre-link, link, and go, use procedure LCXXCLG.

For CICS C programs, use procedure LCCCPCLR to invoke the CICS translator, and to compile, pre-link, and link.

For CICS C++ programs, use procedure LCCPCXXL to invoke the CICS translator and C++ translator and to compile, pre-link, and link.


CMS/ESA

The following steps demonstrate compile, pre-link, link, and execution for a C program:

  1. GLOBAL MACLIB LC370
  2. LC370 HELLO (OMD
  3. GLOBAL TXTLIB LC370BAS LC370STD
  4. COOL HELLO
  5. HELLO

The following steps demonstrate compile, pre-link, link, and execution for a C++ program:

  1. GLOBAL MACLIB LCXX370 LC370
  2. LCXX370 HELLO
  3. GLOBAL TXTLIB LC370BAS LC370STD
  4. COOL HELLO (CXX GENMOD
  5. HELLO

WIN/NT

When using the Cross-Platform compiler, you can compile and pre-link on the cross-platform and then you must transfer the resulting object file to the mainframe for the final linking and execution.

Getting Started with the SAS/C Cross-Platform Compiler under Windows

This Programmer’s Report is intended to help you get started as quickly as possible with the SAS/C Cross-Platform Compiler under the Windows operating system. It provides a simple tutorial that demonstrates how to build the ftoc.c and ftoc.cxx sample p rograms from both the DOS shell and Microsoft’s Developer Studio.

Using SAS/C and C++ from the DOS Shell

This exercise shows you how to compile and prelink C and C++ applications from the DOS shell. It also demonstrates how to use NMAKE to build your applications.

Using SAS/C and C++ with Developer Studio

This exercise walks you through the steps of setting up two simple projects with the Microsoft Developer Studio using the SAS/C Cross-Platform compiler. It builds the ftoc.c and ftoc.cxx sample applications that are distributed with the SAS/C product.< /p>

UNIX

When using the Cross-Platform compiler, you can compile and pre-link on the cross-platform and then you must transfer the resulting object file to the mainframe for the final linking and execution.

Notes:

  • If CMS is the final destination add the –Tcms370 option.
  • The pre-linked object code created by COOL will be written to "a.out" by default unless you specify the –o compiler option to direct the output to another file.

  • For C, to compile and pre-link for a final destination of OS/390, use the following command:

    sascc370 –v –o hello.obj hello.c

    (The resulting object file to transfer to the mainframe will be "hello.obj" because the –o option was used.)

  • For C++, to compile and pre-link for a final destination of OS/390, use the following command:

    sasCC370 –v hello.cxx

    (The resulting object file to transfer to the mainframe will be "a.out" because the –o option was not used.)

For more information on compiling C and C++ programs using the Cross-Platform compiler, click here.


  • For C, to compile and pre-link a CICS program for a final destination of OS/390, use the following command:

    sascc370 –Krent –Tcics370 –o hello.obj hello.ccp

  • For C++, to compile and prelink a CICS program for a final destination of OS/390, use the following command:

    sasCC370 –Krent –Tcics370 –o hello.obj hello.ccp

Notes for CICS applications:

  • You can use sascc370 (for C programs) or sasCC370 (for C++ programs) if your source file suffix is .ccp. The compiler driver will invoke the CICS Command Preprocessor (ccp).
  • You can invoke ccp directly by specifying: ccp –o hello.c hello.ccp. The resulting output will be a C code and have a .c extension. You can then compile and link-edit the resulting output from the ccp command as you would an y SAS/C program.
  • If VSE is the targeted system, use –Tcicsvse instead of –Tcics370.
  • When you use COOL to link a CICS application, you will receive warnings about unresolved references to the following: DFHEI1, DFHEAI and DFHAIO. These warning messages are expected and will be resolved when the object file is linked on the mainframe with the CICS Execution Interface stubs.

For more detailed information on how to pre-process and compile CICS applications using the Cross-Platform compiler, see Using the SAS/C CICS Command Preprocessor.


  •