Follow

Compiler Directives / Options

Elastic COBOL supports a number of compile-time options and runtime-options. Runtime options affect the behavior of a program while it is running, either in a stand-alone (command-line) environment, under control of the Elastic Batch Platform (batch) environment, or within the Elastic Transaction Platform (online) environment.  Other configurations and settings also affect the operation of programs.  Different file protocols affect the way COBOL files are stored and accessed and SQL properties affect database interactions.  Also, when calling subprograms other than those written in COBOL or Java calling convention settings may be required.

Compile-time options are those passed to the ecobol command invokes the compiler from a command-line environment. It accepts the same options that may be set in the Elastic COBOL Eclipse IDE under COBOL Compiler Settings. Compiler directives can be set on the compiler command line, in the Additional Parameters field of the COBOL Compile Settings for the project or within the program itself with the "$SET DIRECTIVE" or "$SET PGM-DIRECTIVE" statements ('$' in column 7 on fixed-format source files). Run-time option name can be specified with a value as environment variables set before the program starts, as a Java property (-Dname=value in a VM argument to the Java command), as command-line options (name=value after the class name) or set programmatically with the SET CONFIGURATION COBOL statement. Run-time options may also be compiled into the generated Java program with the "-run name=value" compiler directive, the "$SET RUNTIME 'name=value'" statement or $SET DIRECTIVE '-run name=value'" statement.

A variation of "$SET DIRECTIVE" is "$SET PGM-DIRECTIVE myprog.cbl directive". This is best used in an ecobol.dir file as an alternative to inserting directives into the application source. In this case, the "directive" is only applied to "myprog.cbl" - it will not be applied to any other source files.

See EBP Configuration options or ETP Configuration options for information on runtime options of those systems.

Elastic COBOL Compiler Options

The compiler options are available by typing:

ecobol -?

The ecobol.exe compiler executable and its support files (etrans.jar, ecobol.jar, ECERR.txt) are distributed with the Elastic COBOL IDE. They are contained in the Eclipse installation directory in the following subdirectories

You may copy all of these files to another location, such as your home directory's "bin" directory (xx.yy.zz is the ECOBOL version) or create symbolic links on Linux in a well -known directory to them:

  • ./com.heirloomcomputing.ecd.core_xx.yy.zz/elastic_cobol/bin/win64/x86_64/ecobol.exe or
  • ./com.heirloomcomputing.ecd.core_xx.yy.zz/elastic_cobol/bin/linux/x86_64/ecobol
  • ./com.heirloomcomputing.ecd.core_xx.yy.zz/elastic_cobol/etrans.jar
  • ./com.heirloomcomputing.ecd.core_xx.yy.zz/elastic_cobol/ecobol.jar
  • ./com.heirloomcomputing.ecd.core_xx.yy.zz/elastic_cobol/ECERR.txt

Elastic COBOL uses runtime Gnu C and C++ libraries that should already be installed on your system. If you experience errors (e.g., "Missing GLIB 2.14") you need to install these dependent libraries before running. On Linux, install with these commands

sudo yum install libglib2.0-0 libstdc++

or

sudo apt-get install libglib2.0-0 libstdc++

Option

Description/Option Value

-?

Help on Elastic COBOL Options

-help

Help on Elastic COBOL Options

-help:old

Help on Elastic COBOL Deprecated Options

-help:acu

Help on Elastic COBOL Acu-Style Options

-h

Help on Elastic COBOL Simple-Style Options

-cc

Transpile COBOL to Java

-ccj

Transpile COBOL to Java, then compile Java to class files (default)

-ccjx

Transpile COBOL to Java, then compile Java to class files, then execute the main class

-dt n

Data type compatibility with various environments (n: 0=EC, 2=Acu, 4=MPE, 5=MF, 6=RM, 7=IBMA, 8=IBME)

IBMA = IBM ASCII (e.g., IBM Power Series, AIX)

IBME = IBM EBCDIC (e.g., IBM Z, z/OS)

-dt:ec

Datatype Compatible with Elastic COBOL (default)

-dt:ibma

Datatype Compatible with IBM ASCII

-dt:ibm

-dt:ibme

Datatype and file storage Compatible with IBM Enterprise COBOL ("native EBCDIC" mode)

-dt:mf

Datatype Compatible with Micro Focus

-dt:acu

Datatype Compatible with AcuCOBOL

-dt:mpe

Datatype Compatible with HP MPE/iX COBOL-II

-dt:rm

Datatype Compatible with Liant RM/COBOL 7

-dt:bin

BINARY is BINARY-REV

-dt:truncbin

BINARY byte truncation rather than PIC truncation

-dt:compbin

COMPUTATIONAL is BINARY

-dt:aix

Datatypes Compatible with IBM AIX

-dt:os2

Datatypes Compatible with IBM OS/2

-dt:apost

Use ' for QUOTE(S) and ALL QUOTE(S)

-dt:quote

-dt:q

Use " for QUOTE(S) and ALL QUOTE(S)

-source:auto

Auto-detect source format (default)

-source:free

Free-form source code

-source:fixed

Fixed-form source code

-source:variable

Variable-form source code

-source:utf8

UTF-8 encoding

-source:copypath pathname

Set COPY library path to parameter pathname

-source:CBLasCPY

Allow .CBL(.cbl) file extension for copybooks (default)

-source:noCBLasCPY

Don't allow .CBL(.cbl) files as copybooks

-source:suppress name

Suppress parameter name from being reserved word

-source:ignore name

Ignore parameter name as a reserved word

-source:wordlist filename

File filename contains reserved word suppress list

-source:ansikey

Use only ANSI keywords

-source:basednumeric

Based Literals are Numeric (Hex,Decimal,Octal,Binary)

-source:hp

Prefer HP semantics when in conflict.

-source:path pathname

Add parameter to front of PATH

-source:tabsize

Set tab size in spaces

-source:pause

Pause after compilation

-source:dbcs

Activate SHIFT-IN/SHIFT-OUT DBCS 0x0e, 0x0f

-source:dbcsso char

Activate parameter char as DBCS SHIFT-OUT

-source:dbcssi char

Activate parameter char as DBCS SHIFT-IN

-source:obsx

Flag Syntax Obsolete in COBOL 2002 or X/Open

-source:archaic

Flag Syntax Archaic in COBOL 2002

-source:assignenv

ASSIGN TO name is environment, not variable

-source:assignvar

ASSIGN TO name is variable, not environment

-source:errorifbom

Force error on non-ASCII characters

-out:ecoboldir pathname

pathname to directory containing ecobol.dir

-out:java

Generate .java files from COBOL source, but do not generate .class files afterwards

-out:javaversion n

Compile COBOL to specified Java version and use javac -source 1.n and -target 1.n options (also see -script:javac option)

-out:class

Compile COBOL to .java, then executable .class (default)

-out:execute

Compile COBOL to .java, .class, then execute

-out:cobolinjava

Include COBOL statements in .java

-out:nocobolinjava

Do not include COBOL statements in .java (default)

-out:manyfields

Each 01 level in own constructor in .java

-out:movenumericspaceiszero

Spaces in an alphanumeric field are treated as zero when moved to a numeric field

-out:name name

Use parameter as name for applet/application

-out:subprogram

Designate as subprogram

-out:package name

Use parameter as generate Java package name causing Java output to contain the package statement and be placed in a corresponding directory hierarchy

-out:html

Generate template HTML file

-out:nohtml

Do not generate template HTML file

-out:bean

Create CobolBean interface

-out:servlet

Create Servlet interface

-out:nobean

Do not create CobolBean interface

-out:nothreadlock

Disable ThreadQueue suspension

-out:dir dirname

Set output directory to parameter

-out:omapdir dirname

Set output directory of .omap files used by Eclipse Elastic COBOL IDE to parameter

-out:japplet

Inherit from JApplet by default

-out:applet

Inherit from Applet by default

-out:suppress

Suppress generated output (check only)

-out:filter n

Set output filter (n: 0=native, 1=EBC-to-ASC, 2=ASC-to-EBC, 3=breakup large classes)

-out:noarrayprops

No Array GET|SET Properties

-out:assert

Enable ASSERT functionality

-out:staticinvoke

Statically bind OO invokes where possible

-out:notransient

Do not produce transient modifiers

-out:smap

Generate .smap file

-out:nopretty

Do not create pretty java code

-out:transaction

Allow EXEC TRANSACTION capabilities

-out:importjava name

Generate a Java import statement with the given parameter class specification (e.g., javax.servlet.*).

-out:indexcheck

-out:ssr

Protect against table index out of bounds (default)

-out:noindexcheck

-out:nossr

Do NOT protect against table index out of bounds

-out:indexsize

Set INDEX byte size to param

-out:cicsmsg

Set transaction message level

-out:transactionmsg

Set transaction message level

-out:odoslide

Generate OCCURS arrays exactly the size specifies in the DEPENDING ON variable within enclosing groups

-out:noodoslide

Generate OCCURS arrays such that they allocate the maximum size within enclosing groups (default)

-out:usesourceodosize

Moves between Groups containing OCCUR DEPENDING ON VAR use the source VAR size.

Note that -dt:ibma and -dt:odoslide should be used for this directive to be effective

-out:translate

Generate shorter Java names for groups and elements, do not generate shared string constants, implies -out:cobolinjava

-out:linkage

DFHEIBLK and DFHCOMMAREA variables creation (NO or YES 'default')

-out:mergeduplicateconditions

Merge the values of duplicate Level 88 conditions into a single condition

-out:nomergeduplicateconditions

Generate an "ambiguous identifier" error when duplicate Level 88 condition names are referenced (default)

-out:[no]converthex

Convert the value of hex strings "in the wild" from EBCDIC to ASCII.

-err:file filename

Set error filename to parameter

-err:limitwarnings n

Limit unique Warning and Information messages to n. n = 0 unlimited 

-err:none

No error output

-err:stdout

Send errors to stdout

-err:stderr

Send errors to stderr

-err:max n

Set maximum reported errors to parameter

-err:level

Minimum error Level (0=All, 1=Warning, 2=Error)

-err:pedantic

Pedantic error messages

-err:optinfo

Generate informational messages for optimizations

-err:nooptinfo

Do not generate informational messages for optimizations (default)

-script:execute

Execute scriptfile upon completion

-script:append parameter

Append parameter to end of scriptfile

-script:format

Format each line of scriptfile according to parameter

-script:javac javaccommand

Use parameter as Java Compiler string

-script:java javacommand

Use parameter as Java Runtime string

-run:defaultbyte

Fill initial memory with byte number or 'space'

-run no_pageline=ddname1,ddname2,.......

-run no_pageline

Specified files(ddnames) will not increment a line when a page advance is invoked on the file

Not specifying ddnames will imply the same for all output files

-run:noprogressbar

Do not generate runtime progress bar during download

-run:nocheckversion

Do not generate runtime code to verify Java version

-run:performrecurse

Use MF style perform

-run:noperformrecurse

Use ANSI style perform

-run:novisiblecallfail

Disable Visible Call Failure

-run:console

ACCEPT and DISPLAY statements (without an explicit UPON clause) default to CONSOLE ( graphical user interface window or ASCII terminal) rather than SYSIN/SYSOUT (standard in / standard out).

The default is -run:system

-run:system

ACCEPT and DISPLAY statements (without an explicit UPON clause) default to SYSIN/SYSOUT (standard in / standard out) rather than
CONSOLE (graphical user interface window or ASCII terminal).

-run:visiblecallfail

Enable Visible Call Failure

-run:dynvisiblecallfail

Allow runtime to enable/disable Visible Call Failure

-run:novisibleopenfail

Disable Visible Open Failure

-run:visibleopenfail

Enable Visible Open Failure

-run:dynvisibleopenfail

Allow runtime to enable/disable Visible Open Failure

-run:redefinesinfo

Preserve REDEFINES info at runtime for Datatype

-run:trace

Produce tracing messages for PARAGRAPH/SECTION, CALL, GOTO, PERFORM, FILE I/O operations & SQL I/O operations

-run:tracecall

Produce tracing messages for each CALL.

-run:tracegoto

Product tracing messages for each GOTO.

-run:traceio

Produce tracing messages for each FILE I/O operation.

-run:tracepara

Produce tracing messages for each PARAGRAPH/SECTION.

-run:traceperf

Produce tracing messages for each PERFORM.

-run:tracesql

Produce tracing messages for each SQL I/O operation.

-run:tracestack

Produce a COBOL stack trace if exception occurs.

-run:tracefullsrcpath

Emit full source path for program source location in trace output (not default).

-run:notrace

Turn off all tracing messages.

-run:notracecall

Turn off tracing messages for each CALL.

-run:notracegoto

Turn off tracing messages for each GOTO.

-run:notraceio

Turn off tracing messages for each FILE I/O operation.

-run:notracepara

Turn off tracing messages for each PARAGRAPH/SECTION.

-run:notraceperf

Turn off tracing messages for each PERFORM.

-run:notracesql

Turn off tracing messages for each SQL I/O operation.

-run:wdm

Enable WITH DEBUGGING MODE, allowing lines with 'D' in the indicator column to be executed.

-run:nowdm

Disable WITH DEBUGGING MODE, preventing lines with 'D' in the indicator column to be executed.

-run name=value

Generate code that sets the run-time option name to value as if -Dname=value was specified on the Java command line, as an environment variable, or in the cblconfig or etp_deploy_settings.properties run-time configurations files.

-run ebcdic_codepage=<number>

Adds a run-time parameter for the EBCDIC codepage that will be used if the 'collateAsEBCDIC' flag (can be seen below) is up. 

<number> can be either 037 or 277. 

These numbers match exactly collation sequences:

  • SQL_EBCDIC037_CP1_CS_AS
  • SQL_EBCDIC277_CP1_CS_AS

If a different codepage number is provided, 037 will be used as default.

Note that there is a slight difference between  Codepage037  and SQL_EBCDIC037_CP1_CS_AS.

This is true for codepage 277 as well.

-file:shareallothers

Default share: SHARING ALL OTHER

-file:sharenoother

Default share: SHARING NO OTHER

-file:sharereadonly

Default share: SHARING READ ONLY

-file:sharenone

Default share: no default/explicit sharing

-file:$infilename

dollar symbol ($) may be part of file name

-cache:auto | enable | disable | forbid | smart | external

-cache:0 | 1 | 2 | 3 | 4 | 5

-cache:external:section-type

Enable or disable various forms of group and element value caching. Disable cache is the default which means element values are fetched from the COBOL section memory (e.g., working storage, linkage section, etc.) when referenced and saved when changed. Other settings will cache those values in Java objects and invalidate/flush the values when necessary. Based on the usage and frequency of REDEFINES, OCCURS, OCCURS DEPENDING ON and access/modification of groups and elements within groups you may find that different caching algorithms (enable 1, forbid 3, smart 4) may perform better in certain instances. Using external 5 will cause memory allocation to be performed outside the Java heap. This has two effects, larger programs may benefit by having their working-storage and other sections allocated in the non-JVM garbage-collected heap usually reserved for OS malloc() and free() memory allocation and, when used with UNSAFE calling convention, it allows for persistent (non changing) pointers to COBOL variables to be passed to C-libraries invoked from COBOL. Setting auto attempts to determine the best for your program. Indicating a :section-name will enable that cache setting only for that section-type (wrk, lnk, fil, etc.).

-sql:extendedset

Add support for SET :hostvar = ...  
For Postgres this has the effect of making SET :hostvar = CURRENT TIMESTAMP an instance value not the transaction TIMESTAMP

-sql:off

Disable SQL Support. Abends on SQL statements

-sql:len

Set SQL VARYING stub len to param (len)

-sql:txt

Set SQL VARYING stub txt to param (arr)

-sql:next

SQL JDBC/DB2 next() workaround

-sql:db2

SQL IBM JDBC/DB2 workarounds

-sql:postgres

SQL workarounds for Postgres. Automatically converting statements where possible from DB2 syntax to Postgres syntax.

-sql:mssql

SQL workarounds for Microsoft SQL Server, specifically define cursors as scroll type SENSITIVE if they are also UPDATABLE because MS SQL Server disallows the combination of INSENSITIVE and UPDATABLE.

-sql:cro

Use JDBC CONCUR_READ_ONLY for the concurrency setting when defining cursors (default UPDATABLE cursors)

-sql:ta

SQL Transaction Adjust

-sql:sc

SQL Server handles Concat (||)

-sql:it

SQL Ignore Right Truncation

-sql:jdbc level

JDBC level to which to generate JDBC API methods (level: 1, 23, 4)

-sql:sp name

Generate SQL Stored Procedure of type name. db2 only supported at this time.

-sql:spschema name

Schema of the stored procedure. Used at compile time stored procedure validation against the database. This parameter is optional, as the -sql:user will be used as the default.

-sql:spname name

Name of the stored procedure. Used at compile time stored procedure validation against the database. This parameter is required for COBOL stored procedure compiles.

-sql:logmode NO|YES

SQL Logging (NO, YES)

-sql:groupmode

SQL group items treated as single item

-sql:nogroupmode

SQL group items treated as multiple items

-sql:nowarn

SQL Warning not obtained from JDBC

-sql:declarestatic

SQL DECLARE CURSOR always static

-sql:declaredynamic

SQL DECLARE CURSOR dynamic when possible (default)

-sql:opt

Pass SQL option, -sql:opt ? for dump

-sql:mode ANSI|ORACLE|DB2

SQL Process statements and return results in given parameter mode (ANSI, ORACLE, DB2). DB2 mode simulates DB2 for z/OS on other databases such that error DB2 SQLCODEs are translated from SQLSTATEs and SAVEPOINT-protected INSERT/UPDATE/DELETE statements do not abort transactions upon error

-sql:cc NO|YES

SQL Close on Commit to parameter (YES, NO)

-sql:eof

SQL END OF FETCH value (100,1403)

-sql:unsafenull NO|YES

SQL Unsafe Null (NO,YES)

-sql:picx

SQL PICX type (CHARF,VARCHAR2)

-sql:url

Check SQL syntax against database URL (e.g., jdbc:postgresql://localhost/mydb)

-sql:user

Check SQL syntax against database USER (e.g.,  postgres)

-sql:password

Check SQL syntax against database PASSWORD (e.g.,  mypw)

-sql:driver

Check SQL syntax against database DRIVER (e.g.,  org.postgresql.Driver)

-sql:optindextimestamp <param>

 

Optimize Oracle TIMESTAMPs that are INDEXED. The parameter is a comma separated list of TIMESTAMP col to be optimized

-sql:protect_include <param>

Protect SQL with an autosave and rollback in case of exception. Param values can be 

  • ALL
  • Specific types of SQL Query such as SELECT|DELETE|UPDATE
  • Identifiers for the SQL statement in a program which can take the following forms:

ProgramName,SectionName,ParaName,SQL statement sequence #

SectionName,ParaName,SQL statement sequence #

ParaName,SQL statement sequence #

For e.g.: 

-sql:protect_include ALL

-sql:protect_include UPDATE

-sql:protect_include DROP

-sql:protect_include program1,sectionA,paraB,4

-sql:protect_include paraC,4

 

-sql:protect_exclude <param>

Protect SQL with an autosave and rollback in case of exception except for the indicated params

Its supports the following params:

  • Specific types of SQL Query such as SELECT|DELETE|UPDATE
  • Identifiers for the SQL statement in a program similar to -sql:protect_include as shown above
  • SQLCODES n1,n2,n3,.....

For e.g.: 

-sql:protect_exclude SQLCODES  -204,305

Do not allow rollback for sqlcodes -204 and 305

e.g:

-sql:protect_include ALL

-sql:protect_exclude SQLCODES -305,456

 The above two directives will ensure rollback for all sql exceptions except for -304 and 456

Note that one can specify the directive at the environment level by passing the following vm args
-Dsqlcode_norollback=n1,n2,n3.....
However the compiler directive has precedence and will overwrite any SQLCODES passed thru VM args

-sql:statemapperclass <param>

 

The parameter is a classname of a class that implements the mapping of SQLCODE/SQLSTATE and Messages between DB.

e.g. Oracle and DB2 when migrating from DB2 though the Oracle code/states/messages need to be DB2

This can be a sparse mapping such that only specific mappings need be specified

com.heirloomcomputing.ecs.exec.SqlStatesFileMapper is an implementation of this class that supports the mappings via a TSV input file

-sql:hourglass

Instruct compiler to use Intrinsic functions when CURRENT TIME/DATE/TIMESTAMP is used

 -sql:identityinfo

Specify Tables and corresponding Identity Columns

For e.g.:

 -sql:identityinfo tableA:colA

 -sql:identityinfo tableB:colB

 -sql:identityinfo tableA:colA,tableB:colB,tableC:colC

-sql:dateformat <param>

where param is of the various date formats such as 

dd/mm/yyyy

Used to specify date format for IBM DB2 CHAR function during compilation

-sql:returncodezero

Setting this flag will cause the compiler to generate code that will

set the COBOL RETURN-CODE to 0 after a non error SQL statement execution.

-listing:xml

Listing file XML form to programid.xml

-listing:body

Listing file XML includes source body

-listing:define

Listing file XML includes 'define' tag

-listing:file

Listing file set to mainfile.list

-listing:cross

Listing file includes cross-reference

-listing:vbref

Listing file cross-reference includes verbs

-listing:info

Listing file cross-reference includes info lines

-listing:all

Listing file cross-reference includes all options

-listing:dir

Listing files output directory

-cp pathlist

Use parameter as classpath during Java compile

-opt:large

Optimize for extremely large (> 100KLOC) input files

-opt:break n

Implies -opt:large. Break up output Java classes every n lines instead of the default 10000

-opt:break para

Implies -opt:large. Break up output Java classes every COBOL paragraph. Output classes are also named after the paragraph name.

-opt:break section

Implies -opt:large. Break up output Java classes  every COBOL procedure division section. Output classes  are also named after the section name.

-opt:initialize

(Default) Generates a optimized version of the initialize statement. A single java initialize statement is created corresponding to each COBOL initialize statement for group fields

-opt:noinitialize

Generates a non optimized version of the initialize statement. Multiple java initialize statements is created corresponding to each COBOL initialize statement for group fields

-opt:staticconstantcount

 

Fine tune the number of static initializer per java class.  The default is 5000. This option allows adjustment of that number.  Alternatively -opt:large will provide a fix that will scale with program growth.  Static initialize java elements are used for constants, level 88s and other constant data types

-opt:nostaticconstantcount

Reset the maximum number of static initializers to 5000, the default.

-opt:occurs

Optimize OCCURS arrays (tables) such that no Java array is actually generated, but simulated  as an object with getters and setters. This is faster for sparse arrays, i.e., large OCCURS x TIMES where x is large but only a few of the elements are actually used. Also required when redefining a table and subsequent indexes are out-of-bounds.

-opt:nooccurs

Generate COBOL OCCURS arrays (tables) as Java arrays (default).

-opt:keepunusedvars

Do generate unused group and element variables in the Java output

-opt:deleteunusedvars

Do not generate unused group and element variables in the Java source code (default)

-collateAsEBCDIC

By default COBOL programs use the ASCII collating sequence to do string comparisons, in this mode "1" < "a". This flag sets the compiled program to use the EBCDIC collating sequence which means that "1" > "a". 

Alternatively it is possible to use the COBOL configuration section to set this collating sequence, this also gives more options to provide custom collating sequences.

configuration section.
object-computer.
heirloom-pc
program collating sequence is mainframe.
special-names.
alphabet mainframe is ebcdic.

 

Elastic COBOL Runtime Options

These have been moved to their own article Heirloom COBOL Runtime Options

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk