Saturday, July 28, 2012

COBOL Tutorial 9 (Compiler Options)



Compiler Options

The default options that were set up when your compiler was installed are in effect for your program unless you override them with other options. To check the default compiler options of your installation, do a compile and check in the compilation listing.

Ways of overriding the default options


1.Compiler options can be passed to COBOL Compiler Program (IGYCRCTL) through the PARM in JCL.
2.PROCESS or CBL statement with compiler options, can be placed before the identification division.
3.If the organization uses any third party product or its own utility then these options can be coded in the pre-defined line of the utility panel.

Precedence of Compiler Options

  1. (Highest precedence). Installation defaults, fixed by the installation.
  2. Options coded on PROCESS /CBL statement
  3. Options coded on JCL PARM parameters
  4. (Lowest Precedence). Installation defaults, but not fixed.

The complete list of compiler option is in the table:

Aspect
Compiler Option
Source Language
APOST, CMPR2, CURRENCY, DBCS, LIB, NUMBER,
QUOTE, SEQUENCE, WORD
Date Processing
DATEPROC, INTDATE, YEARWINDOW
Maps and Listing
LANGUAGE, LINECOUNT, LIST, MAP, OFFSET, SOURCE, SPACE, TERMINAL, VBREF, XREF
Object Deck generation
COMPILE, DECK, NAME, OBJECT, PGMNAME
Object Code Control
ADV, AWO, DLL, EXPORTALL, FASTSRT, OPTIMIZE, NUMPROC, OUTDD, TRUNC, ZWB
Debugging
DUMP, FLAG, FLAGMIG, FLAGSTD, SSRANGE, TYPECHK
Other
ADATA, ANALYZE, EXIT, IDLGEN


ADV: It is meaningful if your program has any printer files with WRITE..ADVANCING keyword. The compiler adds one byte prefix to the original LRECL of printer files for printing control purpose. If you are manually populating printing control character in the program, then you can compile your program with NOADV.

DYNAM: Use DYNAM to cause separately compiled programs invoked through the CALL literal statement to be loaded dynamically at run time. DYNAM causes dynamic loads (for CALL) and deletes (for CANCEL) of separately compiled programs at object time. Any CALL identifier statements that cannot be resolved in your program are also treated as dynamic calls. When you specify DYNAM, RESIDENT is also put into effect.




LIST/OFFSET: LIST and OFFSET are mutually exclusive.  If you use both, LIST will be ignored. LIST is used to produce listing a listing of the assembler language expansion of your code. OFFSET is used to produce a condensed Procedure Division listing. 
With OFFSET, the procedure portion of the listing will contain line numbers, statement references, and the location of the first instruction generated for each statement.  These options are useful for solving system ABENDS. Refer JCL session for more details.

MAP:   Use MAP to produce a listing of the items you defined in the Data Division.

SSRANGE:   If the program is compiled with SSRANGE option, then any attempt to refer an area outside the region of the table will abnormally terminate with protection exception, usually S0C4.It also avoids any meaningless operation on reference modification like negative number in the starting position of reference modification expression. If the program is compiled with NOSSRANGE, then the program may proceed further with junk or irrelevant data. So usually the programs are compiled with SSRANGE during development and testing.

RENT: A program compiled as RENT is generated as a reentrant object module. CICS programs should be compiled with RENT option to share the same copy of the program by multiple transactions (Multithreading)

RESIDENT:   Use the RESIDENT option to request the COBOL Library Management Feature. (The COBOL Library Management Feature causes most COBOL library routines to be located dynamically at run time, instead of being link-edited with the COBOL program.).CICS Programs should be compiled with RESIENT option.

XREF: Use XREF to get a sorted cross-reference listing.  EBCDIC data-names and procedure-names will be listed in alphanumeric order.   It also includes listing, where all the data-names that are referenced within your program and the line number where they are defined. This is useful for identifying the fields that are defined but not used anywhere after the development of new program.



COMPILATION JCL:
//SMSXL86B JOB ,'COMPILATION JCL', MSGCLASS=Q,MSGLEVEL=(1,1),CLASS=C  
//COMPILE1  EXEC  PGM=IGYCRCTL, PARM=’XREF,APO,ADV,MAP,LIST),REGION=0M
//STEPLIB      DD  DSN=SYS1.COB2LIB,DISP=SHR
//SYSIN         DD  DSN=SMSXL86.TEST.COBOL(SAMPGM01),DISP=SHR
//SYSLIB       DD  DSN=SMSXL86.COPYLIB,DISP=SHR
//SYSPRINT    DD  SYSOUT=*
//SYSLIN       DD  DSN=&&LOADSET, DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200),
//                 DISP=(NEW,PASS),UNIT=SYSDA,SPACE=(CYL,(5,10),RLSE),
//SYSUT1       DD UNIT=&SYSDA,SPACE=(CYL,(1,10))  => Code SYSUT2 to UT7
//LINKEDT1    EXEC  PGM=IEWL,COND=(4,LT)
//SYSLIN       DD  DSN=&&LOADSET, DISP=(OLD,DELETE)
//SYSLMOD    DD  DSN=&&GOSET(SAMPGM01),DISP=(NEW,PASS),UNIT=SYSDA
//                 SPACE=(CYL,1,1,1))
//SYSLIB       DD  DSN=SMSXL86.LOADLIB,DISP=SHR
//SYSUT1       DD  UNIT=SYSDA,SPACE=(CYL,(1,10))
//SYSPRINT    DD SYSOUT=*

//*** EXECUTE THE PROGRAM ***
//EXECUTE1  EXEC  PGM=*.LINKEDT1.SYSLMOD,COND=(4,LT),REGION=0M
//STEPLIB      DD  DSN=SMSXL86.LOADLIB,DISP=SHR
//                 DD  DSN=SYS1.SCEERUN,DISP=SHR
//SYSOUT      DD  SYSOUT=*
//SYSPRINT    DD  SYSOUT=*

No comments:

Post a Comment