Compiler cobc options
The following list of options was extracted from
cobc --help and shows all available compiler options
with a short description.
Common Options
-h, --helpdisplay this help and exit
-V, --versiondisplay compiler version information and exit
-dumpversiondisplay compiler version and exit
-i, --infodisplay compiler information (build/environment) and exit
-v, --verboseverbose mode, display additional information; multiple
-voptions increase the verbosity, the maximum is 3 as follows: (1) display compiler version and the commands invoked by the compiler, (2) pass verbose option to assembler/compiler (3) pass verbose option to linker-q, --briefreduced displays, commands invoked not shown
-###like -v but commands not executed
-xbuild an executable program
-mbuild a dynamically loadable module (default)
-j [<args>], --job[=<args>]run program after build, passing <args>
-std=<dialect>warnings/features for a specific dialect <dialect> can be one of: default, cobol2014, cobol2002, cobol85, xopen, ibm-strict, ibm, mvs-strict, mvs, mf-strict, mf, bs2000-strict, bs2000, acu-strict, acu, rm-strict, rm, gcos-strict, gcos; see configuration files in directory config
-F, --freeuse free source format (alias for -fformat=free)
--fixeduse fixed source format (default; alias for
-fformat=fixed)-O, -O2, -O3, -Osenable optimization
-O0disable optimization
-genable C compiler debug and stack check
-d, --debugenable all run-time error checking, equal to
-fstack-check-fec=EC-ALL-fec=<exception-name>enable code generation for <exception-name>, see –list-exceptions for the possible values, sets
-fsource-location-fno-ec=<exception-name>disable code generation for <exception-name>
-o <file>place the output into <file>
-bcombine all input files into a single dynamically loadable module
-Epreprocess only; do not compile or link
-Ctranslation only; convert COBOL to C
-Scompile only; output assembly file
-ccompile and assemble, but do not link
-T <file>generate and place a wide program listing into <file>
-t <file>generate and place a program listing into <file>
--tlines=<lines>specify lines per page in listing, default = 55
-P[=<dir or file>]generate preprocessed program listing (.lst)
-X, --Xrefspecify cross reference in listing
-I <directory>add <directory> to copy/include search path
-L <directory>add <directory> to library search path
-l <lib>link the library <lib>
-K <entry>generate
CALLto <entry> as static-D <define>define <define> for COBOL compilation
-A <options>add <options> to the C compile phase
-Q <options>add <options> to the C link phase
--coverageinstrument generated binaries for coverage
--conf=<file>user-defined dialect configuration; see -std
--list-reserveddisplay reserved words
--list-intrinsicsdisplay intrinsic functions
--list-mnemonicsdisplay mnemonic names
--list-exceptionsdisplay exception names
--list-systemdisplay system routines
--save-temps[=<dir>]save intermediate files; default: current directory
-MT <target>set/add target file used in dependency list
-MF <file>place dependency list into <file>
-ext <extension>add file extension for resolving
COPY
Warning options
-Wallenable most warnings (all except as noted below)
-Wextralike -Wall but enable some extra warning flags
-wdisable all warnings
-Wno-<warning>disable warning enabled by default, -Wall or -Wextra
-Wadditionaladditional warnings only raised with -Wall
-Wno-unfinisheddo not warn if unfinished features are used; always active
-Wno-pendingdo not warn if pending features are used; always active
-Wno-repository-checksdo not warn/check for program/function/external signature mismatch; always active
-Wno-ignored-errordo not warn about errors in code parts which are unreachable and so normally ignored; always active
-Wobsoletewarn if obsolete features are used
-Warchaicwarn if archaic features are used
-Wredefinitionwarn about non-referenced ambiguous data items
-Wtruncatewarn about field truncation from constant assignments
-Wpossible-truncatewarn about possible field truncation; not set with
-Wall-Woverlapwarn about overlapping
MOVEof items-Wpossible-overlapwarn about
MOVEof items that may overlap depending on variables; not set with-Wall-Wparentheseswarn if parentheses are omitted around
ANDwithinOR-Wstrict-typingwarn strictly about type mismatch, even when same size; not set with
-Wall-Wtypingwarn about type mismatch
-Wimplicit-definewarn whenever data items are implicitly defined; not set with
-Wall-Wno-correspondingdo not warn about
CORRESPONDINGwith no matching items; always active-Winitial-valuewarn if initial
VALUEclause is ignored-Wprototypeswarn about missing
FUNCTIONprototypes/definitions-Warithmetic-osvswarn if arithmetic expression precision has changed
-Wcall-paramswarn about non 01/77 items for
CALLparameters; not set with-Wall-Wconstant-expressionwarn about expressions that always resolve to true/false
-Wconstant-numlit-expressionwarn about numeric expressions that always resolve to true/false
-Wlarger-01-redefineswarn about larger redefines allowed by COBOL standards
-Wcolumn-overflowwarn about text after program-text area,
FIXEDformat; not set with-Wall-Wterminatorwarn about lack of scope terminator
END-XXX; not set with-Wall-Wlinkagewarn about dangling
LINKAGEitems; not set with-Wall-Wunreachablewarn about likely unreachable statements; not set with
-Wall-Wno-dialectdo not warn about dialect specific issues; always active
-Wno-goto-sectiondo not warn about
GOTOsection-name; always active-Wgoto-different-sectionwarn about
GOTOa praragraph defined in a different section-Wsuspicious-perform-thruwarn if
PERFORMTHRUreferences procedures not in ascending order or multiple sections; always active-Wdangling-textwarn about source text after program-area; not set with
-Wall-Wno-missing-newlinedo not warn about missing newlines; always active
-Wno-othersdo not warn about different issues; always active
-Wno-unsupporteddo not warn if runtime does not support a feature used
-fdiagnostics-plain-outputmake diagnostic output as plain as possible
-Werrortreat all warnings as errors
-Wno-errordon’t treat warnings as errors
-Werror=<warning>treat specified <warning> as error
-Wno-error=<warning>don’t treat specified <warning> as error
Compiler options
-fsign=[ASCII|EBCDIC]define display sign representation; default: machine native
-ffold-copy=[UPPER|LOWER]fold
COPYsubject to value; default: no transformation-ffold-call=[UPPER|LOWER]fold
PROGRAM-ID,CALL,CANCELsubject to value; default: no transformation-fmax-errors=<number>maximum number of errors to report before compilation is aborted; default: 128
-fintrinsics=[ALL|intrinsic function name(,name,...)]intrinsics to be used without
FUNCTIONkeyword-fdump=<scope>dump data fields on abort, <scope> may be a combination of:
ALL,WS,LS,RD,FD,SC,LO-fcallfh=<name>specifies <name> to be used for I/O as external provided EXTFH interface module
-febcdic-table=<cconv-table>/<file>EBCDIC/ASCIItranslation table; e.g. default, ebcdic500_latin1…-fdefault-colseq=[ASCII|EBCDIC|NATIVE]define default collating sequence; default:
NATIVE-fstack-extendedstore origin of entrypoints and
PERFORM; turned on by --debug/-fdump-fno-remove-unreachabledisable remove of unreachable code; turned off by
-g-ftracegenerate trace code; scope: executed
SECTION/PARAGRAPH-ftraceallgenerate trace code; scope: executed
SECTION/PARAGRAPH/STATEMENTS-fsyntax-onlysyntax error checking only; don’t emit any output
-fdebugging-lineenable debugging lines; ‘
D‘ in indicator column or floating>>D-fsource-locationgenerate source location code; turned on by -
-debug/-ftraceall/-fec/-fdump-fimplicit-initautomatic initialization of the COBOL runtime system
-fno-recursive-checkdisable check of recursive program call; effectively compiling as
RECURSIVEprogram-fstack-checkPERFORMstack checking; turned on by --debug/-g-fmemory-check=<scope>checks for invalid writes to internal storage, <scope> may be one of: all, pointer, using, none; default: none, set to all by -
-debug-fsection-exit-checkcheck that code execution does not leave the scope of
SECTIONs-fimplicit-goback-checkcheck that code execution does not end implicit at end of
PROCEDUREDIVISION-fwrite-afteruse
AFTER 1forWRITEofLINESEQUENTIAL; default:BEFORE 1-fmfcomment‘
\*‘ in column 1 treated as comment with listing suppression; FIXED/COBOL85/VARIABLE format only-facucomment‘
$‘ in indicator area treated as ‘\*‘, ‘|‘ treated as floating comment-fno-truncallow numeric field overflow; non-ANSI behaviour
-fsingle-quoteuse a single quote (apostrophe) for
QUOTE; default: double quote-foptional-filetreat all files as
OPTIONAL; unlessNOTOPTIONALspecified-fstatic-calloutput static function calls for the
CALLstatement-fno-gen-c-decl-static-calldisable generation of C function declarations for subroutines with static
CALL-fgen-c-line-directivesgenerate source location directives in C code;; turned on by
-g/–coverage-fgen-c-labelsgenerate extra labels in C sources;; turned on by
-g-fno-theaderssuppress all headers from listing while keeping page breaks
-fno-tsourcesuppress source from listing
-fno-tmessagessuppress warning and error summary from listing
-ftsymbolsspecify symbols in listing
-ftcmdspecify command line in listing
-fno-ttimestampsuppress timestamp in listing headers
-fttitle=<title>set listing title with ‘
_‘ replaced by spaces; defaults to package name and version-fno-diagnostics-show-optionsuppress output of option that directly controls the diagnostic
-fno-diagnostics-show-caretdo not display source context on warning/error diagnostic
-fno-diagnostics-show-line-numberssuppress display of line numbers in diagnostics
-fdiagnostics-absolute-pathdisplay paths with absolute paths
Compiler dialect configuration options
-freserved-words=<value>use of complete/fixed reserved words
-ftab-width=1..12number of spaces that are assumed for tabs
-ftext-column=72..255right margin column number for fixed-form reference-format
-fpic-length=<number>maximum number of characters allowed in the
PICTUREcharacter-string-fword-length=1..63maximum word-length for COBOL (= programmer defined) words
-fliteral-length=<number>maximum literal size in general
-fnumeric-literal-length=1..38maximum numeric literal size
-fdefaultbyte=<value>default initialization for fields without
VALUE, may be one of; character in quotes; decimal 0..255 representing a character; “init” to initialize toPICTURE/USAGE; “none” to do no explicit initialization; default: “init”-fformat=<value>default reference-format, may be one of:
FIXED,FREE, COBOL85,VARIABLE,XOPEN,XCARD,CRT,TERMINAL, COBOLX-fbinary-size=<value>binary byte size - defines the allocated bytes according to
PIC, may be one of: 2-4-8, 1-2-4-8, 1–8-fbinary-byteorder=<value>binary byte order, may be one of: native, big-endian
-fassign-clause=<value>how to interpret
ASSIGN <word>: as ASSIGN EXTERNAL <word> or ASSIGN DYNAMIC <word>, may be one of:dynamic,external,ibm(= external),mf(= dynamic)-fscreen-section-rules=<value>which compiler’s rules to apply to
SCREENSECTIONitem clauses, may be one of: acu, gc, mf, rm, std, xopen-fdpc-in-data=<value>whether
DECIMAL-POINTISCOMMAhas effect inXML/JSONGENERATE, may be one of: none, xml, json, all-fsubscript-check=<value>checking for subscript (only done with
EC-BOUND-SUBSCRIPTactive), may be one of: full, max, record-ffilename-mappingresolve file names at run time using environment variables
-fpretty-displayalternate formatting of numeric fields
-fbinary-truncatenumeric truncation according to ANSI
-fcomplex-odoallow non-standard
OCCURSDEPENDINGONsyntax-fodoslideadjust items following
OCCURSDEPENDING(implies complex-odo)-finit-justifyapplies
JUSTIFYwithVALUEclause-findirect-redefinesallow
REDEFINESto other than last equal level number-frelax-syntax-checksallow certain syntax variations (e.g.
REDEFINESposition)-fref-mod-zero-lengthallow zero length reference-modification (only changed with
EC-BOUND-REF-MODactive)-frelax-level-hierarchyallow non-matching level numbers
-fselect-workingrequire
ASSIGNUSINGitems to be inWORKING-STORAGE-flocal-implies-recursiveLOCAL-STORAGESECTIONimpliesRECURSIVEattribute-fsticky-linkageLINKAGESECTIONitems remain allocated between invocations-fmove-ibmMOVEoperates as on IBM (left to right, byte by byte)-fperform-osvsexit point of any currently executing perform is recognized if reached
-farithmetic-osvslimit precision in intermediate results to precision of final result (less accurate)
-fconstant-foldingevaluate constant expressions at compile time
-fhostsignallow hexadecimal value ‘
F‘ forNUMERICtest of signedPACKEDDECIMALfield-fprogram-name-redefinitionprogram names don’t lead to a reserved identifier
-faccept-updateset
WITHUPDATEclause as default forACCEPTdest-item, instead ofWITHNOUPDATE-faccept-autoset
WITHAUTOclause as default forACCEPTdest-item, instead ofWITHTAB-fconsole-is-crtassume
CONSOLEISCRTif not set otherwise-fno-echo-means-secureNO-ECHOhides input with asterisks likeSECURE-fline-col-zero-defaultassume a field
DISPLAYstarts atLINE 0COL 0(i.e. at the cursor), notLINE 1COL 1-fdisplay-special-fig-constsspecial behaviour of
DISPLAYSPACE/ALLX'01'/ALLX'02'/ALLX'07'-fbinary-comp-1COMP-1is a 16-bit signed integer-fnumeric-pointerPOINTERis a 64-bit unsigned integer-fmove-non-numeric-lit-to-numeric-is-zeroimply zero in move of non-numeric literal to numeric items
-fimplicit-assign-dynamic-varimplicitly define a variable if an
ASSIGNDYNAMICdoes not match any data item-fdevice-mnemonicsspecifying device by mnemonic
-fxml-parse-xmlssXMLPARSEXMLSS-fareacheckcheck contents of Area A (when reference format supports Area A enforcement), enabled checks include:; division, section, paragraph names, level indicators (
FD,SD,RD, andCD), and toplevel numbers (01 and 77) must start in Area A;; statements must not start in Area A; and; separator periods must not be within Area A-fcomment-paragraphs=<support>comment paragraphs in
IDENTIFICATIONDIVISION(AUTHOR,DATE-WRITTEN, …)-fcontrol-division=<support>CONTROLDIVISION-fpartial-replace-when-literal-src=<support>apply partial replacing with literal source operand even when it replaces with spaces only;; “skip” prevents such replacements
-fmemory-size-clause=<support>MEMORY-SIZEclause-fmultiple-file-tape-clause=<support>MULTIPLE-FILE-TAPEclause-flabel-records-clause=<support>LABEL-RECORDSclause-fvalue-of-clause=<support>VALUE-OFclause-fdata-records-clause=<support>DATA-RECORDSclause-ftop-level-occurs-clause=<support>OCCURSclause on top-level-fsame-as-clause=<support>SAMEASclause-ftype-to-clause=<support>TYPETOclause-fusage-type=<support>USAGEtype-name-fsynchronized-clause=<support>SYNCHRONIZEDclause-fsync-left-right=<support>LEFT/RIGHTphrases inSYNCHRONIZEDclause-fspecial-names-clause=<support>SPECIAL-NAMESclause-fgoto-statement-without-name=<support>GOTOstatement without name-fstop-literal-statement=<support>STOP-literal statement-fstop-identifier-statement=<support>STOP-identifier statement-fstop-error-statement=<support>STOPERRORstatement-fdebugging-mode=<support>DEBUGGINGMODEand debugging indicator-fuse-for-debugging=<support>USEFORDEBUGGING-fpadding-character-clause=<support>PADDINGCHARACTERclause-fnext-sentence-phrase=<support>NEXTSENTENCEphrase-flisting-statements=<support>listing-directive statements
EJECT,SKIP1,SKIP2,SKIP3-ftitle-statement=<support>listing-directive statement
TITLE-fentry-statement=<support>ENTRYstatement-fmove-noninteger-to-alphanumeric=<support>move noninteger to alphanumeric
-fmove-figurative-constant-to-numeric=<support>move figurative constants to numeric
-fmove-figurative-space-to-numeric=<support>move figurative constant
SPACEto numeric-fmove-figurative-quote-to-numeric=<support>move figurative constant
QUOTEto numeric-fodo-without-to=<support>OCCURSDEPENDINGONwithout to-fsection-segments=<support>section segments
-falter-statement=<support>ALTERstatement-fcall-overflow=<support>OVERFLOWclause forCALL-fnumeric-boolean=<support>boolean literals (
B'1010')-fhexadecimal-boolean=<support>hexadecimal-boolean literals (
BX'A')-fnational-literals=<support>national literals (
N'UTF-16 <string>')-fhexadecimal-national-literals=<support>hexadecimal-national literals (
NX'265E')-fnational-character-literals=<support>non-standard national literals (
NC'UTF-16 <string>')-fhp-octal-literals=<support>HPCOBOL octal literals (%377)-facu-literals=<support>ACUCOBOL-GT literals (
#B#O#H#X)-febcdic-symbolic-charactersEBCDICsymbolic characters in literals (” “135,151,151”bar”195, 194”Z” for ” foobarBAZ“)-fword-continuation=<support>continuation of COBOL words
-fnot-exception-before-exception=<support>NOTONEXCEPTIONbeforeONEXCEPTION-faccept-display-extensions=<support>extensions to
ACCEPTandDISPLAY-frenames-uncommon-levels=<support>RENAMESof 01-, 66- and 77-level items-flarger-redefines=<support>allow larger
REDEFINESitems-fsymbolic-constant=<support>constants defined in
SPECIAL-NAMES-fconstant-78=<support>constant with level 78 item (note: has left to right precedence in expressions)
-fconstant-01=<support>constant with level 01
CONSTANTAS/FROMitem-fperform-varying-without-by=<support>PERFORMVARYINGwithoutBYphrase (impliesBY 1)-freference-out-of-declaratives=<support>references to sections not in
DECLARATIVESfrom withinDECLARATIVES-fprogram-prototypes=<support>CALL/CANCELwith program-prototype-name-fcall-convention-mnemonic=<support>specifying call-convention by mnemonic
-fcall-convention-linkage=<support>specifying call-convention by
WITH…LINKAGE-fusing-optional=<support>support for
PROCEDUREDIVISIONUSINGOPTIONAL-fnumeric-value-for-edited-item=<support>numeric literals in
VALUEclause of numeric-edited items-fincorrect-conf-sec-order=<support>incorrect order of
CONFIGURATIONSECTIONparagraphs-fdefine-constant-directive=<support>allow >>
DEFINECONSTANTvarASliteral-ffree-redefines-position=<support>REDEFINESclause not following entry-name in definition-frecords-mismatch-record-clause=<support>record sizes does not match
RECORDclause-frecord-delimiter=<support>RECORDDELIMITERclause-fsequential-delimiters=<support>BINARY-SEQUENTIALandLINE-SEQUENTIALphrases inRECORDDELIMITER-frecord-delim-with-fixed-recs=<support>RECORDDELIMITERclause on file with fixed-length records-fmissing-statement=<support>missing statement (e.g. empty
IF/PERFORM)-fmissing-period=<support>missing period in
PROCEDUREDIVISION(when reference format supports Area A enforcement)-fzero-length-literals=<support>zero-length literals, e.g. ‘’ and “”
-fxml-generate-extra-phrases=<support>XMLGENERATE's phrases other thanCOUNTIN-fcontinue-after=<support>AFTERphrase inCONTINUEstatement-fgoto-entry=<support>ENTRYFORGOTOandGOTOENTRYstatements-fassign-variable=<support>ASSIGN[TO]variable inSELECT-fassign-using-variable=<support>ASSIGNUSING/VARYINGvariable inSELECT-fassign-ext-dyn=<support>ASSIGNEXTERNAL/DYNAMICinSELECT-fassign-disk-from=<support>ASSIGNDISKFROMvariable inSELECT-fvsam-status=<support>VSAMstatus inFILESTATUS-fself-call-recursive=<support>CALLto ownPROGRAM-IDimpliesRECURSIVEattribute-frecord-contains-depending-clause=<support>DEPENDINGclause inRECORDCONTAINS-fpicture-l=<support>PICTUREstring with ‘L‘ characterwhere <support> is one of:
ok, warning, archaic, obsolete, skip, ignore, error, unconformable
-fnot-reserved=<word><word> to be taken out of the reserved words list
-freserved=<word><word> to be added to reserved words list
-freserved=<word>:<alias><word> to be added to reserved words list as <alias>
-fnot-register=<word>special register to disable
-fregister=<word> or <word>:<definition>, where definition uses backslash escaspecial register to enable