Scroll to navigation

COBC(1) User Commands COBC(1)

NAME

cobc - manual page for cobc 3.1.2.0

SYNOPSIS

cobc [options]... file...

DESCRIPTION

GnuCOBOL compiler for most COBOL dialects with lots of extensions

OPTIONS

display this help and exit
display compiler version and exit
display compiler information (build/environment) and exit
verbose mode, display additional information; multiple -v options 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
reduced displays, commands invoked not shown
-###
like -v but commands not executed
build an executable program
build a dynamically loadable module (default)
run program after build, passing <args>
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; see configuration files in directory config
use free source format
use fixed source format (default)
enable optimization
disable optimization
enable C compiler debug and stack check
enable all run-time error checking, equal to -fstack-check -fec=EC-ALL
sets -fsource-location
disable code generation for <exception-name>
place the output into <file>
combine all input files into a single dynamically loadable module
preprocess only; do not compile or link
translation only; convert COBOL to C
compile only; output assembly file
compile and assemble, but do not link
generate and place a wide program listing into <file>
generate and place a program listing into <file>
specify lines per page in listing, default = 55
generate preprocessed program listing (.lst)
generate cross reference through 'cobxref' (V. Coen's 'cobxref' must be in path)
add <directory> to copy/include search path
add <directory> to library search path
link the library <lib>
add <options> to the C compile phase
add <options> to the C link phase
define <define> for COBOL compilation
generate CALL to <entry> as static
user-defined dialect configuration; see -std
display reserved words
display intrinsic functions
display mnemonic names
display system routines
save intermediate files * default: current directory
add file extension for resolving COPY

Warning options:

enable most warnings (all except as noted below)
like -Wall but enable some extra warning flags
disable all warnings
disable warning enabled by default, -Wall or -Wextra
additional warnings only raised with -Wall
do not warn if unfinished features are used * ALWAYS active
do not warn if pending features are mentioned * ALWAYS active
do not warn about errors in unreachable code parts and so normally ignored * ALWAYS active
warn if obsolete features are used
warn if archaic features are used
warn about non-referenced ambiguous data items
warn about field truncation from constant assignments
warn about possible field truncation * NOT set with -Wall
warn about overlapping MOVE of items
warn about MOVE of items that may overlap depending on variables * NOT set with -Wall
warn about lack of parentheses around AND within OR
warn strictly about type mismatch
warn about implicitly defined data items * NOT set with -Wall
do not warn about CORRESPONDING with no matching items * ALWAYS active
warn if initial VALUE clause is ignored
warn about missing FUNCTION prototypes/definitions
warn if arithmetic expression precision has changed
warn about non 01/77 items for CALL parameters * NOT set with -Wall
warn about expressions that always resolve to true/false
warn about text after program-text area, FIXED format * NOT set with -Wall
warn about lack of scope terminator END-XXX * NOT set with -Wall
warn about dangling LINKAGE items * NOT set with -Wall
warn about likely unreachable statements * NOT set with -Wall
do not warn about dialect specific issues * ALWAYS active
warn source text after program-area * NOT set with -Wall
do not warn about different issues * ALWAYS active
treat all warnings as errors
don't treat warnings as errors
treat specified <warning> as error
don't treat specified <warning> as error

Compiler options:

* default: machine native
fold COPY subject to value * default: no transformation
fold PROGRAM-ID, CALL, CANCEL subject to value * default: no transformation
* decimal 0..255 or any quoted character * default: initialize to picture
compilation is aborted * default: 128
intrinsics to be used without FUNCTION keyword
dump data fields on abort, <scope> may be a combination of: ALL, WS, LS, RD, FD, SC, LO
specifies <name> to be used for I/O as external provided EXTFH interface module
disable remove of unreachable code * turned off by -g
generate trace code * scope: executed SECTION/PARAGRAPH
generate trace code * scope: executed SECTION/PARAGRAPH/STATEMENTS
syntax error checking only; don't emit any output
enable debugging lines * 'D' in indicator column or floating >>D
generate source location code * turned on by -debug/-g/-ftraceall/-fec
automatic initialization of the COBOL runtime system
disable check of recursive program call; effectively compiling as RECURSIVE program
PERFORM stack checking * turned on by -debug or -g
use AFTER 1 for WRITE of LINE SEQUENTIAL * default: BEFORE 1
'*' or '/' in column 1 treated as comment * FIXED format only
'$' in indicator area treated as '*', '|' treated as floating comment
allow numeric field overflow * non-ANSI behaviour
adjust items following OCCURS DEPENDING * implies -fcomplex-odo
use a single quote (apostrophe) for QUOTE * default: double quote
treat all files as OPTIONAL * unless NOT OPTIONAL specified
output static function calls for the CALL statement
disable generation of C function declations for subroutines with static CALL
generate source location directives in C code; * turned on by -g
generate extra labels in C sources; * turned on by -g
suppress all headers and output of compilation options from listing while keeping page breaks
suppress source from listing
suppress warning and error summary from listing
specify symbols in listing
suppress output of option that directly controls the diagnostic

Compiler dialect configuration options:

use of complete/fixed reserved words
set number of spaces that are assumed for tabs
set right margin for source (fixed format only)
maximum number of characters allowed in the PICTURE character-string
maximum word-length for COBOL (= programmer defined) words
maximum literal size in general
maximum numeric literal size
binary byte size - defines the allocated bytes according to PIC, may be one of: 2-4-8, 1-2-4-8, 1--8
binary byte order, may be one of: native, big-endian
how to interpret 'ASSIGN word': as 'ASSIGN EXTERNAL word' or 'ASSIGN DYNAMIC word', may be one of: dynamic, external, ibm (= external), mf (= dynamic)
which compiler's rules to apply to SCREEN SECTION item clauses, may be one of: acu, gc, mf, rm, std, xopen
whether DECIMAL-POINT IS COMMA has effect in XML/JSON GENERATE, may be one of: none, xml, json, all
resolve file names at run time using environment variables
alternate formatting of numeric fields
numeric truncation according to ANSI
allow complex OCCURS DEPENDING ON
allow REDEFINES to other than last equal level number
allow larger REDEFINES items
allow certain syntax variations (e.g. REDEFINES position)
allow zero length reference-modification (only changed with EC-BOUND-REF-MOD active)
allow non-matching level numbers
require ASSIGN USING items to be in WORKING-STORAGE
LOCAL-STORAGE SECTION implies RECURSIVE attribute
LINKAGE SECTION items remain allocated between invocations
MOVE operates as on IBM (left to right, byte by byte)
exit point of any currently executing perform is recognized if reached
limit precision in intermediate results to precision of final result (less accurate)
evaluate constant expressions at compile time
allow hexadecimal value 'F' for NUMERIC test of signed PACKED DECIMAL field
program names don't lead to a reserved identifier
set WITH UPDATE clause as default for ACCEPT dest-item, instead of WITH NO UPDATE
set WITH AUTO clause as default for ACCEPT dest-item, instead of WITH TAB
assume CONSOLE IS CRT if not set otherwise
NO-ECHO hides input with asterisks like SECURE
assume a field DISPLAY starts at LINE 0 COL 0 (i.e. at the cursor), not LINE 1 COL 1
special behaviour of DISPLAY SPACE/ALL X'01'/ALL X'02'/ALL X'07'
COMP-1 is a 16-bit signed integer
POINTER is a 64-bit unsigned integer
imply zero in move of non-numeric literal to numeric items

-fimplicit-assign-dynamic-var implicitly define a variable if an ASSIGN DYNAMIC does not match any data item

comment paragraphs in IDENTIFICATION DIVISION (AUTHOR, DATE-WRITTEN, ...)
MEMORY-SIZE clause

-fmultiple-file-tape-clause=<support> MULTIPLE-FILE-TAPE clause

LABEL-RECORDS clause
VALUE-OF clause
DATA-RECORDS clause
OCCURS clause on top-level
SAME AS clause
TYPE TO clause
USAGE type-name
SYNCHRONIZED clause
SPECIAL-NAMES clause
GOTO statement without name
STOP-literal statement

-fstop-identifier-statement=<support> STOP-identifier statement

DEBUGGING MODE and debugging indicator

-fuse-for-debugging=<support> USE FOR DEBUGGING

PADDING CHARACTER clause
NEXT SENTENCE phrase
listing-directive statements EJECT, SKIP1, SKIP2, SKIP3
listing-directive statement TITLE
ENTRY statement
move noninteger to alphanumeric
move figurative constants to numeric
move figurative constant SPACE to numeric
move figurative constant QUOTE to numeric
OCCURS DEPENDING ON without to
section segments
ALTER statement
OVERFLOW clause for CALL
boolean literals (B'1010')
hexadecimal-boolean literals (BX'A')

-fnational-literals=<support> national literals (N'UTF-16 string')

hexadecimal-national literals (NX'265E')
non-standard national literals (NC'UTF-16 string')

-fhp-octal-literals=<support> HP COBOL octal literals (%377)

ACUCOBOL-GT literals (#B #O #H #X)

-fword-continuation=<support> continuation of COBOL words

NOT ON EXCEPTION before ON EXCEPTION

-faccept-display-extensions=<support> extensions to ACCEPT and DISPLAY

RENAMES of 01-, 66- and 77-level items

-fsymbolic-constant=<support> constants defined in SPECIAL-NAMES

constant with level 78 item (note: has left to right precedence in expressions)
constant with level 01 CONSTANT AS/FROM item
PERFORM VARYING without BY phrase (implies BY 1)
references to sections not in DECLARATIVES from within DECLARATIVES
CALL/CANCEL with program-prototype-name
specifying call-convention by mnemonic
specifying call-convention by WITH ... LINKAGE
numeric literals in VALUE clause of numeric-edited items
incorrect order of CONFIGURATION SECTION paragraphs

-fdefine-constant-directive=<support> allow >> DEFINE CONSTANT var AS literal

REDEFINES clause not following entry-name in definition
record sizes does not match RECORD clause
RECORD DELIMITER clause
BINARY-SEQUENTIAL and LINE-SEQUENTIAL phrases in RECORD DELIMITER
RECORD DELIMITER clause on file with fixed-length records

-fmissing-statement=<support> missing statement (e.g. empty IF / PERFORM)

zero-length literals, e.g. '' and ""
XML GENERATE's phrases other than COUNT IN
AFTER phrase in CONTINUE statement
ENTRY FOR GOTO and GOTO ENTRY statements
ASSIGN [TO] variable in SELECT
ASSIGN USING/VARYING variable in SELECT
ASSIGN EXTERNAL/DYNAMIC in SELECT
ASSIGN DISK FROM variable in SELECT
VSAM status in FILE STATUS
where <support> is one of the following: 'ok', 'warning', 'archaic', 'obsolete', 'skip', 'ignore', 'error', 'unconformable'
word to be taken out of the reserved words list
word to be added to reserved words list
word to be added to reserved words list as alias
special register to disable
special register to enable

AUTHOR

Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart Built Sep 19 2022 04:27:09 Packaged Dec 23 2020 12:04:58 UTC C version "12.2.0"

REPORTING BUGS

Report bugs to: bug-gnucobol@gnu.org or (preferably) use the issue tracker via the home page.
GnuCOBOL home page: <https://www.gnu.org/software/gnucobol/>
General help using GNU software: <https://www.gnu.org/gethelp/>

COPYRIGHT

Copyright © 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO

The full documentation for cobc is maintained as a Texinfo manual. If the info and cobc programs are properly installed at your site, the command

info gnucobol

should give you access to the complete manual.

September 2022 GnuCOBOL 3.1.2.0