Chapter Contents |
Previous |
Next |
Compiling C Programs |
The LC370C Cataloged Procedure |
The procedure LC370C runs the compiler and, optionally, runs the object module disassembler. The object module disassembler can be used as an aid in debugging at the machine-code level. If you want to execute the OMD by itself, refer to The LC370D cataloged procedure. See Sample JCL for Compiling with Procedure LC370C for typical JCL to run LC370C.
Sample JCL for Compiling with Procedure LC370C
//COMPILE JOB job card information //*------------------------------------------------------------- //* COMPILE A C PROGRAM //* REPLACE GENERIC NAMES AS APPROPRIATE //*------------------------------------------------------------- //STEP1 EXEC LC370C,PARM.C='options' //C.SYSLIN DD DISP=OLD,DSN=your.object.library(member) //C.SYSIN DD DISP=SHR,DSN=your.source.library(member) //C.libddn DD DISP=SHR,DSN=your.macro.library //
When you use LC370C, you only need to provide DD cards
for SYSIN (your source data set) and SYSLIN (your object data set). Use the
DD statement C.libddn to identify the macro library
for any
#include
'member.libddn' statements in your source code. Refer to Include-File Processing for
detailed information
on
#include
files.
The LC370C procedure contains the JCL shown in Expanded JCL for LC370C. This JCL is correct as of the publication of this guide. However, it may be subject to change.
Expanded JCL for LC370C
//LC370C PROC //**************************************************************** //* PRODUCT: SAS/C *** //* PROCEDURE: COMPILATION *** //* DOCUMENTATION: SAS/C COMPILER AND LIBRARY USER'S GUIDE *** //* FROM: SAS INSTITUTE INC., SAS CAMPUS DRIVE, CARY, NC *** //**************************************************************** //* //C EXEC PGM=LC370B //STEPLIB DD DSN=SASC.LOAD, // DISP=SHR COMPILER LIBRARY // DD DSN=SASC.LINKLIB // DISP=SHR RUNTIME LIBRARY //SYSTERM DD SYSOUT=A //SYSPRINT DD SYSOUT=A //SYSUT1 DD UNIT=SYSDA,SPACE=(TRK,(10,10)) //SYSUT2 DD UNIT=SYSDA,SPACE=(TRK,(10,10)) //SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(10,10)) //SYSLIN DD DSN=&&OBJECT,SPACE=(3200,(10,10)),DISP=(MOD,PASS), // UNIT=SYSDA //SYSLIB DD DSN=&MACLIB, // DISP=SHR STANDARD MACRO LIBRARY //SYSDBLIB DD DSN=&&DBGLIB,SPACE=(4080,(20,20,1)),DISP=(,PASS), // UNIT=SYSDA,DCB=(RECFM=U,BLKSIZE=4080) //SYSTMP01 DD UNIT=SYSDA,SPACE=(TRK,25) VS1 ONLY //SYSTMP02 DD UNIT=SYSDA,SPACE=(TRK,25) VS1 ONLY /*
Note the following about this JCL:
// EXEC LC370C,PARM.C='COMNEST,NOTRANS,PRINT,NOXREF'
Compiler Options (Short Forms) |
The option string is case insensitive and has the following format:
c: compiler-options p: listing-options x: xref-options o: optimizer-options
where compiler-options, listing-options, xref-options, and optimizer-options
are any or none of the options listed in Compiler Option Equivalents. Options must be separated by blanks. You
can suppress the production of a source listing by using
!p:
instead of
p:
. Similarly, you can
suppress the cross-reference by using
!x:
instead of
x:
. (Note that the not
sign (¬) can be used instead of the exclamation point (
!
). This has the advantage
that
¬
prints in your JCL listing even on a printer without the full
C character set.) To suppress global optimization, you omit the LCGO step
and specify the quad file produced by phase 1 as input to LC2370. Following
are two examples of an options string.
The first example is as follows:
// EXEC PGM=LC1370,PARM='p: !t -i -h !x:'
This is equivalent to the following LC370C specification to the LC370B front end:
// EXEC LC370C,PARM.C='NOTRANS,ILIST,HLIST,NOXREF'
The second example uses uppercase characters and the
¬
instead of
!"
:
// EXEC PGM=LC1370,PARM='C: -RX -SXYZ ¬P: O: -L'
This parameter string is equivalent to the following:
// EXEC LC370C,PARM.C='RENTEXT,SNAME(XYZ),NOPRINT,OPTIMIZE,LOOP'
Options for the global optimization phase should be
supplied both to phase 1 and to the global optimizer. When passing them to
phase 1, they should be preceded with
o:
. For example, suppose the following
EXEC statement is issued:
// EXEC PGM=LC1370,PARM='o: -il !l'
This is equivalent to the following LC370C specification to the LC370B front end:
// EXEC LC370C,PARM.C='OPTIMIZE,INLOCAL,NOLOOP'
However, omit the
o:
when you pass the options to the
global optimization phase. Remember that phase 1 just prints the global optimization
options on the listing. You must pass them as parms to the global optimization
phase for them to take effect.
Compiler Option Equivalents lists the short-form
equivalents for the compiler, listing, cross-reference,
and optimizer options. In general, each option is one or two characters. Precede
the short form of a compiler option with a hyphen (-) for the positive
form and with an exclamation point (!) or not sign (¬) for the negative
form. (The negative form is the equivalent of a long form with the
NO
prefix.) For simplicity, only the positive form of each option is shown,
even if the default value is negative. For example,
-r
is given for
rent
, even though the default
value is
norent
. See Compiler Options for a complete explanation of each option.
Compiler JCL Requirements |
This section
discusses the data definition
statements needed to run the compiler under OS/390 if you are writing your
own JCL. The short forms of the compiler options, used when invoking the
compiler without using the LC370B front end, are given. The compiler runs
in three phases. The first phase, LC1370, reads the source file and produces
an intermediate file (called the quad file) and the optional source listing.
The second phase, LCGO, reads the quad file and produces a new, optimized
quad file. LCGO is the global optimization phase referred to elsewhere in
this manual. This phase is optional (unless you are compiling with
debug
, in which case it
cannot be used because
debug
and
optimize
are not compatible). If
LCGO is not used, the quad file produced by LC1370 can be input directly to
the third phase. The third phase, LC2370, reads the quad file and generates
the object module.
In summary, you can choose to run the compiler with
or without the global optimization phase. If you run the compiler without
the global optimization phase, you can also use the
debug
option. Sample JCL
for each of these approaches is provided following Data Definition Statements for Program Compilation. You need the data definition (DD) statements
shown in Data Definition Statements for Program Compilation to invoke the compiler.
Note:
All of the DDnames shown
in Data Definition Statements for Program Compilation can be specified as either an OS/390 data set or an HFS filename, with the
exceptions of SYSLIB, H, SYSTERM, and SYSDBLIB. SYSLIB and H can be specified
as either an OS/390 PDS or an HFS directory, whereas, SYSTERM and SYSDBLIB
must not be HFS files or directories.
All files other
than SYSTERM can be USS HFS files.
The sample JCL in Sample JCL for Running the Compiler under OS/390 with the Global Optimization Phase illustrates how to run the compiler under OS/390 while including the global optimization phase.
Sample JCL for Running the Compiler under OS/390 with the Global Optimization Phase
//COMPILE JOB job card information //*------------------------------------------------------------ //* EXAMPLE JCL FOR COMPILATION. //* REPLACE GENERIC NAMES AS APPROPRIATE. //*------------------------------------------------------------ //* SYNTAX ANALYSIS PHASE //*------------------------------------------------------------ //STEP1 EXEC PGM=LC1370,REGION=1024K, // PARM='-R P: -M !X: O: -IN -IL -IC8' //STEPLIB DD DISP=SHR,DSN=compiler.library // DD DISP=SHR,DSN=runtime.library //SYSLIB DD DISP=SHR,DSN=standard.macro.library //H DD DISP=SHR,DSN=your.macro.library //SYSPRINT DD SYSOUT=class //SYSTERM DD SYSOUT=class //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(1,1)), // DISP=(NEW,PASS), // DSN=&&QUADS //SYSIN DD DISP=SHR,DSN=your.source.library(member) //* /* //*------------------------------------------------------------ //* GLOBAL OPTIMIZATION PHASE //*------------------------------------------------------------ //STEP2 EXEC PGM=LCGO,REGION=2048K,COND=(4,LT), // PARM='-IN -IL -IC8' //STEPLIB DD DISP=SHR,DSN=compiler.library // DD DISP=SHR,DSN=runtime.library //SYSPRINT DD SYSOUT=class //SYSTERM DD SYSOUT=class //SYSUT1 DD DSN=&&QUADS,DISP=(OLD,PASS) //SYSUT3 DD UNIT=SYSDA,SPACE=(CYL,(1,1)), // DISP=(NEW,PASS),DSN=&&NEWQ //* /* //*------------------------------------------------------------ //* CODE GENERATION PHASE //*------------------------------------------------------------ //STEP3 EXEC PGM=LC2370,REGION=1024K,COND=(4,LT) //STEPLIB DD DISP=SHR,DSN=compiler.library // DD DISP=SHR,DSN=runtime.library //SYSPRINT DD SYSOUT=class //SYSTERM DD SYSOUT=class //SYSUT1 DD DISP=(OLD,PASS),DSN=&&NEWQ //SYSLIN DD DISP=OLD,DSN=your.object.library(member) //
The sample JCL in Sample JCL for Running the Compiler under OS/390 without the Global Optimization Phase illustrates how to run the compiler under OS/390 without the global optimization phase.
Sample JCL for Running the Compiler under OS/390 without the Global Optimization Phase
//COMPILE JOB job card information //*------------------------------------------------------------ //* EXAMPLE JCL FOR COMPILATION. //* REPLACE GENERIC NAMES AS APPROPRIATE. //*------------------------------------------------------------ //* SYNTAX ANALYSIS PHASE //*------------------------------------------------------------ //STEP1 EXEC PGM=LC1370,REGION=1024K, // PARM='-R P: -M !X:' //STEPLIB DD DISP=SHR,DSN=compiler.library // DD DISP=SHR,DSN=runtime.library //SYSLIB DD DISP=SHR,DSN=standard.macro.library //H DD DISP=SHR,DSN=your.macro.library //SYSPRINT DD SYSOUT=class //SYSTERM DD SYSOUT=class //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(1,1)), // DISP=(NEW,PASS), // DSN=&&QUADS //SYSIN DD DISP=SHR,DSN=your.source.library(member) //* /* //*------------------------------------------------------------ //* CODE GENERATION PHASE //*------------------------------------------------------------ //STEP2 EXEC PGM=LC2370,REGION=1024K,COND=(4,LT) //STEPLIB DD DISP=SHR,DSN=compiler.library // DD DISP=SHR,DSN=runtime.library //SYSPRINT DD SYSOUT=class //SYSTERM DD SYSOUT=class //SYSUT1 DD DISP=(OLD,PASS),DSN=&&QUADS //SYSLIN DD DISP=OLD,DSN=your.object.library(member) //
The sample JCL in
Sample JCL for Running the Compiler under OS/390 with debug option illustrates how to run the compiler under OS/390 using the
debug
option. For more
information see the
SAS/C Debugger User's Guide and Reference.
Sample JCL for Running the Compiler under OS/390 with debug option
//COMPILE JOB job card information //*------------------------------------------------------------ //* EXAMPLE JCL FOR COMPILATION. //* REPLACE GENERIC NAMES AS APPROPRIATE. //*------------------------------------------------------------ //* SYNTAX ANALYSIS PHASE //*------------------------------------------------------------ //STEP1 EXEC PGM=LC1370,REGION=1024K, // PARM='-D -R P: -M !X:' //STEPLIB DD DISP=SHR,DSN=compiler.library // DD DISP=SHR,DSN=runtime.library //SYSLIB DD DISP=SHR,DSN=standard.macro.library //H DD DISP=SHR,DSN=your.macro.library //SYSPRINT DD SYSOUT=class //SYSTERM DD SYSOUT=class //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(1,1)), // DISP=(NEW,PASS), // DSN=&&QUADS //SYSUT2 DD UNIT=SYSDA,SPACE=(CYL,(1,1)), // DISP=(NEW,PASS), // DSN=&&SDIF //SYSIN DD DISP=SHR,DSN=your.source.library(member) //* /* //*------------------------------------------------------------ //* CODE GENERATION PHASE //*------------------------------------------------------------ //STEP2 EXEC PGM=LC2370,REGION=1024K,COND=(4,LT) //STEPLIB DD DISP=SHR,DSN=compiler.library // DD DISP=SHR,DSN=runtime.library //SYSPRINT DD SYSOUT=class //SYSTERM DD SYSOUT=class //SYSUT1 DD DISP=(OLD,PASS),DSN=&&QUADS //SYSUT2 DD DISP=(OLD,PASS),DSN=&&SDIF //SYSDBLIB DD DISP=OLD,DSN=your.debugger.library //SYSLIN DD DISP=OLD,DSN=your.object.library(member) //
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.