Gnucobol
Gnucobol
Gnucobol
GnuCOBOL (formerly OpenCOBOL) is a free COBOL compiler and runtime. cobc translates
COBOL source to executable using intermediate C together with a designated C compiler and
linker. cobcrun is a module loader to run generated modules, libcob provides the necessary
runtime.
Permission is granted to copy and distribute modified versions of this manual under the condi-
tions for verbatim copying, provided that the entire resulting derived work is distributed under
the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language,
under the above conditions for modified versions, except that this permission notice may be
stated in a translation approved by the Free Software Foundation.
i
Table of Contents
1 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Hello, world! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Compile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 Compiler options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.1 Help options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.2 Build target. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.3 Source format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.4 Warning options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.5 Configuration options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.6 Listing options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.7 Debug switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.8 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2 Multiple sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2.1 Static linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2.2 Dynamic linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.2.1 Driver program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.2.2 Compiling programs separately . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.3 Building library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.4 Using library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3 C interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.1 Writing Main Program in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.2 Static linking with COBOL programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.3 Dynamic linking with COBOL programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.4 Static linking with C programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3.5 Dynamic linking with C programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.3.6 Redirecting output to a (FILE *). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3 Customize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1 Customizing compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 Customizing library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4 Optimize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.1 Optimize options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.2 Optimize call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.3 Optimize binary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5 Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.1 Debug options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.2 Source Level Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.3 Memory Dumps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.4 Tracing execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6 Non-standard extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.1 SELECT ASSIGN TO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.1.1 Literal file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
ii
6.1.2 <variable> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.1.3 <environment variable> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.2 Indexed file packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.3 Extended ACCEPT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.3.1 LINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.2 COLUMN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.3 AUTO-SKIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.4 BACKGROUND-COLOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.5 BELL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.6 BLINK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.7 FOREGROUND-COLOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.8 LOWLIGHT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.9 PROMPT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.10 PROTECTED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3.11 SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.3.12 UPDATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.3.13 ON EXCEPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.3.14 NOT ON EXCEPTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.4 ACCEPT special keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.4.1 Arrow keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.4.2 Backspace key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.4.3 Delete keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.4.4 End key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.4.5 Home key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.4.6 Insert key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.4.7 Tab keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.5 Extended DISPLAY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.5.1 BELL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.5.2 BLANK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.5.3 ERASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.5.4 SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.5.5 Figurative Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.6 CONTENT-LENGTH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.7 CONTENT-OF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
7 System Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.1 CBL GC GETOPT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.2 CBL GC HOSTED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7.3 CBL GC NANOSLEEP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
7.4 CBL GC FORK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
7.5 CBL GC WAITPID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
1 Getting started
The executable file name (hello in this case) is determined by removing the extension from the
source file name.
You can specify the executable file name by specifying the compiler option -o as follows:
$ cobc -x -o hello-world hello.cob
$ ./hello-world
Hello, world!
The program can be written in a more modern style, with free format code, inline comments,
the GOBACK verb and an optional END-DISPLAY terminator:
---- hellonew.cob ----------------
*> Sample GnuCOBOL program
identification division.
program-id. hellonew.
procedure division.
display
"Hello, new world!"
end-display
goback.
----------------------------------
To compile free-format code, you must use the compiler option -free.
$ cobc -x -free hellonew.cob
$ ./hellonew
Hello, new world!
2
2 Compile
This chapter describes how to compile COBOL programs using GnuCOBOL.
1
Support may be partial or complete.
Chapter 2: Compile 3
-fixed, -fformat=fixed
Fixed format. Source code is divided into: columns 1-6, the sequence number area;
column 7, the indicator area; columns 8-72, the program-text area; and columns
72-80 as the reference area.3
-fformat=cobol85
Fixed format with enforcements on the use of Area A.
-fformat=variable
Micro Focus’ Variable format. Identical to the fixed format above except for the
program-text area which extends up to column 250 instead of 72.
-fformat=xopen
X/Open Free-form format. The program-text area may start in column 1 unless
an indicator is present, and lines may contain up to 80 characters. Indicator for
debugging lines is D instead of D or d.
-fformat=xcard
ICOBOL xCard format. Variable format with right margin set at column 255 instead
of 250.
-fformat=crt
ICOBOL Free-form format (CRT). Similar to the X/Open format above, with lines
containing up to 320 characters and single-character debugging line indicators (D or
d).
-fformat=terminal
ACUCOBOL-GT Terminal format. Similar to the CRT format above, with indicator
for debugging lines being \D instead of D or d. This format is mostly compatible
with VAX COBOL terminal source format.
-fformat=cobolx
COBOLX format. This format is similar to the CRT format above, except that the
indicator area is always present in column 1; the program-text area starts in column
2 and extends up to the end of the record. Lines may contain up to 255 characters.
Note that with source formats XOPEN, CRT, TERMINAL, and COBOLX, missing spaces are not
inserted within continued alphanumeric literals that are truncated before the right margin.
Area A denotes the source code that spans between margin A and margin B, and Area B
spans from the latter to the end of the record. Area A enforcement checks the contents of
Area A, and reports any item that does not belong to the correct Area: this feature helps in
developping COBOL programs that are portable to actual mainframe environments.
In general, division, section, and paragraph names must start in Area A. In the DATA
DIVISION, level numbers 01 and 77, must also start in Area A. In the PROCEDURE DIVISIONs,
statements and separator periods must fit within Area B. Every source format listed above may
be subject to Area A enforcement, except FIXED and FREE.
Note that Area A enforcement enables recovery from missing periods between paragraphs
and sections.
3
Historically, fixed format was based on 80-character punch cards.
Chapter 2: Compile 5
The following options do not enable specific warnings but control the kinds of diagnostics
produced by cobc.
-fsyntax-only
Check Check the code for syntax errors, but don’t do anything beyond that.
-fmax-errors=n
Limits the maximum number of error messages to n, at which point cobc bails out
rather than attempting to continue processing the source code. If n is 0, there is
no limit on the number of error messages produced. If -Wfatal-errors is also
specified, then -Wfatal-errors takes precedence over this option.
-w Inhibit all warning messages.
-Werror Make all warnings into errors.
-Werror=warning
Make the specified warning into an error. The specifier for a warning is appended;
for example -Werror=obsolete turns the warnings controlled by -Wobsolete into
errors. This switch takes a negative form, to be used to negate -Werror for specific
warnings; for example -Wno-error=obsolete makes -Wobsolete warnings not be
errors, even when -Werror is in effect.
The warning message for each controllable warning includes the option that controls
the warning. That option can then be used with -Werror= and -Wno-error= as
described above. (Printing of the option in the warning message can be disabled
using the -fno-diagnostics-show-option flag.)
Note that specifying -Werror=foo automatically implies -Wfoo. However, -Wno-
error=foo does not imply anything.
-Wfatal-errors
This option causes the compiler to abort compilation on the first error occurred
rather than trying to keep going and printing further error messages.
You can request many specific warnings with options beginning with ’-W’, for example
-Wimplicit-define to request warnings on implicit declarations. Each of these specific warn-
ing options also has a negative form beginning ’-Wno’ to turn off warnings; for example, -Wno-
implicit-define. This manual lists only one of the two forms, whichever is not the default.
Some options, such as -Wall and -Wextra, turn on other options, such as -Wtruncate. The
combined effect of positive and negative forms is that more specific options have priority over
less specific ones, independently of their position in the command-line. For options of the same
specificity, the last one takes effect.
-Wall Enable all the warnings about constructions that some users consider questionable,
and that are easy to avoid (or modify to prevent the warning).
The list of warning flags turned on by this option is shown in --help.
-Wextra, -W
Enable every possible warning that is not dialect specific. This includes more infor-
mation than -Wall would normally provide.
(This option used to be called -W. The older name is still supported, but the newer
name is more descriptive.)
-Wwarning
Enable single warning warning.
-Wno-warning
Disable single warning warning.
Chapter 2: Compile 6
-Warchaic
Warn if archaic features are used, such as continuation lines or the NEXT SENTENCE
statement.
-Wcall-params
Warn if non-01/77-level items are used as arguments in a CALL statement. This is
not set with -Wall.
-Wcolumn-overflow
Warn if text after column 72 in FIXED format. This is not set with -Wall.
-Wconstant
Warn inconsistent constant
-Wimplicit-define
Warn if implicitly defined data items are used.
-Wlinkage
Warn dangling LINKAGE items. This is not set with -Wall.
-Wobsolete
Warn if obsolete features are used.
-Wparentheses
Warn about any lack of parentheses around AND within OR.
-Wredefinition
Warn about incompatible redefinitions of data items.
-Wstrict-typing
Warn about type mismatch strictly.
-Wterminator
Warn about the lack of scope terminator END-XXX. This is not set with -Wall.
-Wtruncate
Warn on possible field truncation. This is not set with -Wall.
-Wunreachable
Warn if statements are unreachable. This is not set with -Wall.
-Wadditional
Enable warnings that don’t have an own warning flag.
The dialects COBOL-85, X/Open COBOL, COBOL 2002 and COBOL 2014 are always
"strict".
-std=dialect
Compiler uses the given dialect to determine certain compiler features and warnings.
-std=default
GnuCOBOL dialect, supporting many of the COBOL 2002 and COBOL 2014 fea-
tures, many extensions found in other dialects and its own feature-set
-std=cobol85
COBOL-85 without any extensions other than the amendment Intrinsic Function
Module (1989), source compiled with this dialect is likely to compile with most
COBOL compilers
-std=xopen
X/Open COBOL (based on COBOL-85) without any vendor extensions, source
compiled with this dialect is likely to compile with most COBOL compilers; will warn
items that "should not be used in a conforming X/Open COBOL source program"
-std=cobol2002, -std=cobol2014
COBOL 2002 / COBOL 2014 without any vendor extensions, use -Warchaic and
-Wobsolete if archaic/obsolete features should be flagged
-std=ibm-strict, -std=ibm
IBM compatible
-std=mvs-strict, -std=mvs
MVS compatible
-std=mf-strict, -std=mf
Micro Focus compatible
-std=bs2000-strict, -std=bs2000
BS2000 compatible
-std=acu-strict, -std=acu
ACUCOBOL-GT compatible
-std=rm-strict, -std=rm
RM/COBOL compatible
-std=realia-strict, -std=realia
CA Realia II compatible
-std=gcos-strict, -std=gcos
GCOS compatible
-freserved-words=dialect
Compiler uses the given dialect to determine the reserved words.
-conf=<file>
User-defined dialect configuration.
You can override each single configuration entry by using compiler configuration options on
the command line.
Examples:
-frelax-syntax-checks
-frenames-uncommon-levels=warning
-fnot-reserved=CHAIN,SCREEN
-ftab-width=4
See Appendix A [Compiler cobc options], page 34.
Chapter 2: Compile 8
-O Enable optimization of code size and execution speed. See your C compiler docu-
mentation, for example man gcc for details.
-O2 Optimize even more.
-Os Optimize for size. Optimizer will favour code size over execution speed.
-fnotrunc
Do not truncate binary fields according to PICTURE.
2.1.8 Miscellaneous
-ext <extension>
Add default file extension.
-fmfcomment
Treat lines with * or / in column 1 as comment (fixed-form reference-format only).
-acucomment
Treat | as an inline comment marker.
-fsign=ASCII
Numeric display sign ASCII (default on ASCII machines).
-fsign=EBCDIC
Numeric display sign EBCDIC (default on EBCDIC machines).
-fintrinsics=[ALL|intrinsic function name(,name,...)]
Allow use of all or specific intrinsic functions without FUNCTION keyword.
Note: defining this within your source with CONFIGURATION SECTION. REPOSITORY.
is preferred.
-ffold-copy=LOWER
Fold COPY subject to lower case (default no transformation).
-ffold-copy=UPPER
Fold COPY subject to upper case (default no transformation).
-save-temps(=<dir>)
Save intermediate files (by default, in current directory).
-fimplicit-init
Do automatic initialization of the COBOL runtime system.
$ cobc -c -x main.cob
$ cobc -x -o prog main.o subr1.o subr2.o
You can link C routines as well using either method:
$ cobc -o prog main.cob subrs.c
or
$ cobc -c subrs.c
$ cobc -c -x main.cob
$ cobc -x -o prog main.o subrs.o
Any number of functions can be contained in a single C file.
The linked programs will be called dynamically; that is, the symbol will be resolved at run
time. For example, the following COBOL statement
CALL "subr" USING X.
will be converted into equivalent C code like this:
int (*func)() = cob_resolve("subr");
if (func != NULL)
func (X);
With the compiler option -fstatic-call, more efficient code will be generated:
subr(X);
Please notice that this option only takes effect when the called program name is in a literal
(like CALL "subr"). With a data name (like CALL SUBR), the program is still called dynamically.
4
The extension used depends on your operating system.
Chapter 2: Compile 12
2.3 C interface
This chapter describes how to combine C programs with COBOL programs.
int
main (int argc, char **argv)
{
/* initialize your program */
5
The extension used depends on your operating system.
Chapter 2: Compile 13
...
int
main()
{
int ret;
char hello[8] = "Hello, ";
char world[7] = "world!";
return ret;
}
----------------------------------------
Compile and run these programs as follows:
$ cobc -x hello.c say.cob
$ ./hello
Hello, world!
or, more split and directly using the C compiler:
$ cc -c ‘cob-config --cflags‘ hello.c
$ cobc -c -static say.cob
$ cobc -x -o hello hello.o say.o
$ ./hello
Hello, world!
Note: The biggest benefits of static linking are that all programs are verified to be available
in the resulting binary. Furthermore there is a slightly performance benefit in this type of CALL
(not visible for "normal" programs).
int main()
{
int ret;
char hello[8] = "Hello, ";
Chapter 2: Compile 15
int main()
{
int ret;
char hello[8] = "Hello, ";
char world[7] = "world!";
void *cob_argv[2];
cob_argv[0] = hello;
cob_argv[1] = world;
----------------------------------------
In any case be aware that all errors that happen within COBOL will exit your program, as
same as a STOP RUN will do.
Depending on the application you possibly want to register C signal handlers; error and/or
exit handlers in C and/or COBOL to do cleanups, logging or anything else.
There is one way to handle all these scenarios with a call, too, using cob_call_with_
exception_check instead of cob_call as follows:
---- hello-dynamic3.c ------------------
#include <libcob.h>
int main()
{
int ret;
char hello[8] = "Hello, ";
char world[7] = "world!";
void *cob_argv[2];
cob_argv[0] = hello;
cob_argv[1] = world;
switch (ret) {
case 0: /* program coming back */
default:
cob_runtime_hint("unexpected return from cob_call_with_exception_check,"
" last exit code %d, last error \"%s\"",
cob_last_exit_code (), cob_last_runtime_error ());
break;
}
or separate:
$ cc -c say.c
$ cobc -c -static -x hello.cob
$ cobc -x -o hello hello.o say.o
$ ./hello
Hello, world!
3 Customize
4 Optimize
5 Debug
6 Non-standard extensions
6.1.2 <variable>
Assign to a file which name is read from a variable.
Select file assign to my-file.
6.3.1 LINE
The line number of variable-2 or literal-1 to accept the field.
6.3.2 COLUMN
The column number of variable-3 or literal-2 to accept the field.
6.3.3 AUTO-SKIP
The word AUTO may be used for AUTO-SKIP.
With this option the ACCEPT statement returns after the last character is typed at the end
of the field. This is the same as if the Enter key were pressed.
Without this option the cursor remains at the end of the field and waits for the user to press
Enter.
The Right-Arrow key returns from the end of the field. The Left-Arrow key returns from the
beginning. See Section 6.4 [ACCEPT special], page 24.
The Alt-Right-Arrow and Alt-Left-Arrow keys never AUTO-SKIP.
6.3.4 BACKGROUND-COLOR
The background color is the color used behind the characters.
Variable-4 or literal-3 must be numeric. See file screenio.cpy for the color assignments to
variable-4 or literal-3.
6.3.5 BELL
The word BEEP may be used for BELL.
The system beeps when the cursor moves to accept from this field. On some systems, there
is no sound. Some other method may indicate a beep, such a flashing screen or pop up window.
6.3.6 BLINK
The field blinks while the user enters the data. This can help small menu selection fields to
stand out.
6.3.7 FOREGROUND-COLOR
The foreground color is the color used for the characters.
Variable-5 or literal-4 must be numeric. See file screenio.cpy for the color assignments to
variable-5 or literal-4.
6.3.8 LOWLIGHT
The LOWLIGHT and HIGHLIGHT phrases vary the intensity of the field.
LOWLIGHT displays with lower intensity and HIGHLIGHT displays with higher intensity. Having
neither LOWLIGHT nor HIGHLIGHT displays at normal intensity.
These may have different levels of intensity, if at all, depending on the make and model of
the screens.
6.3.9 PROMPT
Display the field with prompt characters as the cursor moves to accept from this field.
6.3.10 PROTECTED
PROTECTED is ignored.
Chapter 6: Non-standard extensions 24
6.3.11 SIZE
The size of variable-1 to accept from the screen.
Variable-6 or literal-5 must be numeric.
SIZE <greater than zero>
If variable-6 or literal-5 is less than the length of variable-1 then only the SIZE
number of characters accept into the field. Variable-1 pads with spaces after SIZE
to the end of the field.
If variable-6 or literal-5 is greater than variable-1, then the screen pads with spaces
after variable-1 to the SIZE length.
SIZE ZERO
<SIZE option not specified>
The variable-1 accepts to its field length.
6.3.12 UPDATE
The contents of variable-1 displays on the screen as the ACCEPT begins. This allows the user to
update the field without having to type it all again.
Without this option, the ACCEPT field is always blank.
6.3.13 ON EXCEPTION
Check the special register cob-crt-status for the special key that was pressed. This includes
Escape, Tab, Back-Tab, F-keys, arrows, etc... See screenio.cpy for the values.
6.5.1 BELL
Ring the bell. It is optional.
6.5.2 BLANK
Clear the whole line or screen. It is optional.
BLANK LINE
Clear the line from the beginning of the line to the end of the line.
BLANK SCREEN
Clear the whole screen.
Chapter 6: Non-standard extensions 26
6.5.3 ERASE
Clear the line or screen from LINE and COLUMN. It is optional.
ERASE EOL
Clear the line from LINE and COLUMN to the end of the line.
ERASE EOS
Clear the screen from LINE and COLUMN to the end of the screen.
6.5.4 SIZE
The size of variable-1, literal-1, or figurative-constant to display onto the screen. It is optional.
SIZE positive-integer
If SIZE is less than the length of variable-1 or literal-1 then only the SIZE number
of characters display.
If SIZE is greater than the length of variable-1 or literal-1, then the screen pads
with spaces after the field to the SIZE length.
Figurative constants display repeatedly the number of times in SIZE. Except that
LOW-VALUES always positions the cursor (see SIZE ZERO below).
SIZE ZERO
<SIZE option not specified>
Variable-1 or literal-1 displays with the field length.
6.6 CONTENT-LENGTH
FUNCTION CONTENT-LENGTH returns the length of NUL byte terminated data given a pointer:
identification division.
program-id. zlen.
data division.
working-storage section.
01 ptr usage pointer.
01 str pic x(4) value z"abc".
procedure division.
goback.
end program hosted.
6.7 CONTENT-OF
FUNCTION CONTENT-OF returns an alphanumeric field given a pointer and optional length:
Data from pointer is returned as a COBOL field either by scanning for a NUL byte or using
the optional length. Reference modification of result allowed.
identification division.
program-id. contents.
data division.
working-storage section.
01 ptr usage pointer.
01 str pic x(4) value z"abc".
goback.
end program hosted.
28
7 System Routines
For a complete list of supported system routines, see Appendix D [System routines], page 69.
data division.
working-storage section.
78 shortoptions value "jkl".
01 longoptions.
05 optionrecord occurs 2 times.
10 optionname pic x(25).
10 has-value pic 9.
10 valpoint pointer value NULL.
10 return-value pic x(4).
The example shows how we initialize all parameters and call the routine until CBL_GC_GETOPT
runs out of options and returns -1.
If the option is recognized, return-char contains the option character. Otherwise,
return-char will contain one of the following:
? undefined or ambiguous option
1 non-option (only if first byte of so is ‘-’)
0 valpoint != NULL and we are writing the return value to the specified address
-1 no more options (or reached the first non-option if first byte of so is ‘+’)
The return-code of CBL_GC_GETOPT is one of:
1 a non-option (only if first byte of so is ‘-’)
0 valpoint != NULL and we are writing the return value to the specified address
-1 no more options (or reach the first non-option if first byte of so is ‘+’)
2 truncated option value in opt-val (because opt-val was too small)
3 regular answer from getopt
System will need to HAVE_TIMEZONE defined for these to return anything meaningful. At-
tempts made when they are not available return 1 from CBL_GC_HOSTED.
It returns 0 when match, 1 on failure, case matters as does length, arg won’t match.
The usage of this system routine is described by the following example.
HOSTED identification division.
program-id. hosted.
data division.
working-storage section.
01 argc usage binary-long.
01 argv usage pointer.
*> the following only returns zero if the system has HAVE_TIMEZONE set
if return-code not = 0
display "system doesn’t has timezone"
else
end-if
goback.
end program hosted.
Chapter 7: System Routines 32
*> Waiting five seconds using compiler string catenation for readability
call "CBL_GC_NANOSLEEP" using "500" & "0000000" end-call
STOP RUN.
Chapter 7: System Routines 33
CHILD-CODE.
CALL "C$SLEEP" USING 1 END-CALL
DISPLAY "Hello, I am the child"
END-DISPLAY
MOVE 2 TO RETURN-CODE
CONTINUE.
PARENT-CODE.
DISPLAY "Hello, I am the parent"
END-DISPLAY
CALL "CBL_GC_WAITPID" USING CHILD-PID RETURNING WAIT-STS
END-CALL
MOVE 0 TO RETURN-CODE
EVALUATE TRUE
WHEN WAIT-STS >= 0
DISPLAY ’Child ended with status: ’
WAIT-STS
END-DISPLAY
WHEN WAIT-STS = -1
DISPLAY ’CBL_GC_WAITPID is not available ’
’on the current system!’
END-DISPLAY
WHEN WAIT-STS < -1
MULTIPLY -1 BY WAIT-STS END-MULTIPLY
DISPLAY ’CBL_GC_WAITPID returned system error: ’ WAIT-STS
END-DISPLAY
END-EVALUATE
CONTINUE.
-fno-ec=exception-name
disable code generation for exception-name
-o file place the output into file
-b combine all input files into a single dynamically loadable module
-E preprocess only; do not compile or link
-C translation only; convert COBOL to C
-S compile only; output assembly file
-c compile 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, --Xref
generate cross reference through ’cobxref’ (V. Coen’s ’cobxref’ must be in path)
-I directory
add directory to copy/include search path
-L directory
add directory to library search path
-l lib link the library lib
-A options
add options to the C compile phase
-Q options
add options to the C link phase
-D define define define for COBOL compilation
-K entry generate CALL to entry as static
--conf=file
user-defined dialect configuration; see -std
--list-reserved
display reserved words
--list-intrinsics
display intrinsic functions
--list-mnemonics
display mnemonic names
--list-exceptions
display exception names
--list-system
display system routines
--save-temps[=dir]
save intermediate files; default: current directory
-ext extension
add file extension for resolving COPY
Appendix A: Compiler cobc options 36
-Wprototypes
warn about missing FUNCTION prototypes/definitions
-Warithmetic-osvs
warn if arithmetic expression precision has changed
-Wcall-params
warn about non 01/77 items for CALL parameters; not set with -Wall
-Wconstant-expression
warn about expressions that always resolve to true/false
-Wconstant-numlit-expression
warn about numeric expressions that always resolve to true/false
-Wlarger-01-redefines
warn about larger redefines allowed by COBOL standards
-Wcolumn-overflow
warn about text after program-text area, FIXED format; not set with -Wall
-Wterminator
warn about lack of scope terminator END-XXX; not set with -Wall
-Wlinkage
warn about dangling LINKAGE items; not set with -Wall
-Wunreachable
warn about likely unreachable statements; not set with -Wall
-Wno-dialect
do not warn about dialect specific issues; always active
-Wdangling-text
warn about source text after program-area; not set with -Wall
-Wno-missing-newline
do not warn about missing newlines; always active
-Wno-others
do not warn about different issues; always active
-Wno-unsupported
do not warn if runtime does not support a feature used
-Werror treat all warnings as errors
-Wno-error
don’t treat warnings as errors
-Werror=warning
treat specified warning as error
-Wno-error=warning
don’t treat specified warning as error
-ffold-call=[UPPER|LOWER]
fold PROGRAM-ID, CALL, CANCEL subject 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 FUNCTION keyword
-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=[DEFAULT|RESTRICTED-GC|IBM|GCOS]
define EBCDIC translation table:; default: translation to extended ASCII as per MF;
restricted-gc: translation from restricted ASCII only; ibm: translation to restricted
ASCII as per IBM; gcos: translation to extended ASCII as per GCOS7
-fstack-extended
store origin of entrypoints and PERFORM; turned on by -debug/-dump
-fno-remove-unreachable
disable remove of unreachable code; turned off by -g
-ftrace generate trace code; scope: executed SECTION/PARAGRAPH
-ftraceall
generate trace code; scope: executed SECTION/PARAGRAPH/STATEMENTS
-fsyntax-only
syntax error checking only; don’t emit any output
-fdebugging-line
enable debugging lines; ‘D’ in indicator column or floating >>D
-fsource-location
generate source location code; turned on by -debug/-ftraceall/-fec/-dump
-fimplicit-init
automatic initialization of the COBOL runtime system
-fno-recursive-check
disable check of recursive program call; effectively compiling as RECURSIVE program
-fstack-check
PERFORM stack checking; turned on by -debug/-g
-fwrite-after
use AFTER 1 for WRITE of LINE SEQUENTIAL; default: BEFORE 1
-fmfcomment
‘*’ or ‘/’ in column 1 treated as comment; FIXED format only
-facucomment
‘$’ in indicator area treated as ‘*’, ‘|’ treated as floating comment
-fno-trunc
allow numeric field overflow; non-ANSI behaviour
-fsingle-quote
use a single quote (apostrophe) for QUOTE; default: double quote
Appendix A: Compiler cobc options 39
-foptional-file
treat all files as OPTIONAL; unless NOT OPTIONAL specified
-fstatic-call
output static function calls for the CALL statement
-fno-gen-c-decl-static-call
disable generation of C function declations for subroutines with static CALL
-fgen-c-line-directives
generate source location directives in C code;; turned on by -g
-fgen-c-labels
generate extra labels in C sources;; turned on by -g
-fno-theaders
suppress all headers and output of compilation options from listing while keeping
page breaks
-fno-tsource
suppress source from listing
-fno-tmessages
suppress warning and error summary from listing
-ftsymbols
specify symbols in listing
-fno-diagnostics-show-option
suppress output of option that directly controls the diagnostic
-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 SCREEN SECTION item clauses, may be one of:
acu, gc, mf, rm, std, xopen
-fdpc-in-data=value
whether DECIMAL-POINT IS COMMA has effect in XML/JSON GENERATE, may be one of:
none, xml, json, all
-ffilename-mapping
resolve file names at run time using environment variables
-fpretty-display
alternate formatting of numeric fields
-fbinary-truncate
numeric truncation according to ANSI
-fcomplex-odo
allow complex OCCURS DEPENDING ON
-fodoslide
adjust items following OCCURS DEPENDING (implies complex-odo)
-findirect-redefines
allow REDEFINES to other than last equal level number
-frelax-syntax-checks
allow certain syntax variations (e.g. REDEFINES position)
-fref-mod-zero-length
allow zero length reference-modification (only changed with EC-BOUND-REF-MOD ac-
tive)
-frelax-level-hierarchy
allow non-matching level numbers
-fselect-working
require ASSIGN USING items to be in WORKING-STORAGE
-flocal-implies-recursive
LOCAL-STORAGE SECTION implies RECURSIVE attribute
-fsticky-linkage
LINKAGE SECTION items remain allocated between invocations
-fmove-ibm
MOVE operates as on IBM (left to right, byte by byte)
-fperform-osvs
exit point of any currently executing perform is recognized if reached
Appendix A: Compiler cobc options 41
-farithmetic-osvs
limit precision in intermediate results to precision of final result (less accurate)
-fconstant-folding
evaluate constant expressions at compile time
-fhostsign
allow hexadecimal value ‘F’ for NUMERIC test of signed PACKED DECIMAL field
-fprogram-name-redefinition
program names don’t lead to a reserved identifier
-faccept-update
set WITH UPDATE clause as default for ACCEPT dest-item, instead of WITH NO UPDATE
-faccept-auto
set WITH AUTO clause as default for ACCEPT dest-item, instead of WITH TAB
-fconsole-is-crt
assume CONSOLE IS CRT if not set otherwise
-fno-echo-means-secure
NO-ECHO hides input with asterisks like SECURE
-fline-col-zero-default
assume a field DISPLAY starts at LINE 0 COL 0 (i.e. at the cursor), not LINE 1 COL 1
-fdisplay-special-fig-consts
special behaviour of DISPLAY SPACE/ALL X’01’/ALL X’02’/ALL X’07’
-fbinary-comp-1
COMP-1 is a 16-bit signed integer
-fnumeric-pointer
POINTER is a 64-bit unsigned integer
-fmove-non-numeric-lit-to-numeric-is-zero
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
-fdevice-mnemonics
specifying device by mnemonic
-fxml-parse-xmlss
XML PARSE XMLSS
-fareacheck
check contents of Area A (when reference format supports Area A enforcement),
enabled checks include:; division, section, paragraph names, level indicators (FD, SD,
RD, and CD), 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 IDENTIFICATION DIVISION (AUTHOR, DATE-WRITTEN, ...)
-fcontrol-division=support
CONTROL DIVISION
-fpartial-replacing-with-literal=support
partial replacing with literal
Appendix A: Compiler cobc options 42
-fmemory-size-clause=support
MEMORY-SIZE clause
-fmultiple-file-tape-clause=support
MULTIPLE-FILE-TAPE clause
-flabel-records-clause=support
LABEL-RECORDS clause
-fvalue-of-clause=support
VALUE-OF clause
-fdata-records-clause=support
DATA-RECORDS clause
-ftop-level-occurs-clause=support
OCCURS clause on top-level
-fsame-as-clause=support
SAME AS clause
-ftype-to-clause=support
TYPE TO clause
-fusage-type=support
USAGE type-name
-fsynchronized-clause=support
SYNCHRONIZED clause
-fsync-left-right=support
LEFT/RIGHT phrases in SYNCHRONIZED clause
-fspecial-names-clause=support
SPECIAL-NAMES clause
-fgoto-statement-without-name=support
GOTO statement without name
-fstop-literal-statement=support
STOP-literal statement
-fstop-identifier-statement=support
STOP-identifier statement
-fstop-error-statement=support
STOP ERROR statement
-fdebugging-mode=support
DEBUGGING MODE and debugging indicator
-fuse-for-debugging=support
USE FOR DEBUGGING
-fpadding-character-clause=support
PADDING CHARACTER clause
-fnext-sentence-phrase=support
NEXT SENTENCE phrase
-flisting-statements=support
listing-directive statements EJECT, SKIP1, SKIP2, SKIP3
Appendix A: Compiler cobc options 43
-ftitle-statement=support
listing-directive statement TITLE
-fentry-statement=support
ENTRY statement
-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 SPACE to numeric
-fmove-figurative-quote-to-numeric=support
move figurative constant QUOTE to numeric
-fodo-without-to=support
OCCURS DEPENDING ON without to
-fsection-segments=support
section segments
-falter-statement=support
ALTER statement
-fcall-overflow=support
OVERFLOW clause for CALL
-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
HP COBOL octal literals (%377)
-facu-literals=support
ACUCOBOL-GT literals (#B #O #H #X)
-fword-continuation=support
continuation of COBOL words
-fnot-exception-before-exception=support
NOT ON EXCEPTION before ON EXCEPTION
-faccept-display-extensions=support
extensions to ACCEPT and DISPLAY
-frenames-uncommon-levels=support
RENAMES of 01-, 66- and 77-level items
Appendix A: Compiler cobc options 44
-flarger-redefines=support
allow larger REDEFINES items
-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 CONSTANT AS/FROM item
-fperform-varying-without-by=support
PERFORM VARYING without BY phrase (implies BY 1)
-freference-out-of-declaratives=support
references to sections not in DECLARATIVES from within DECLARATIVES
-fprogram-prototypes=support
CALL/CANCEL with program-prototype-name
-fcall-convention-mnemonic=support
specifying call-convention by mnemonic
-fcall-convention-linkage=support
specifying call-convention by WITH ... LINKAGE
-fnumeric-value-for-edited-item=support
numeric literals in VALUE clause of numeric-edited items
-fincorrect-conf-sec-order=support
incorrect order of CONFIGURATION SECTION paragraphs
-fdefine-constant-directive=support
allow >> DEFINE CONSTANT var AS literal
-ffree-redefines-position=support
REDEFINES clause not following entry-name in definition
-frecords-mismatch-record-clause=support
record sizes does not match RECORD clause
-frecord-delimiter=support
RECORD DELIMITER clause
-fsequential-delimiters=support
BINARY-SEQUENTIAL and LINE-SEQUENTIAL phrases in RECORD DELIMITER
-frecord-delim-with-fixed-recs=support
RECORD DELIMITER clause on file with fixed-length records
-fmissing-statement=support
missing statement (e.g. empty IF / PERFORM)
-fmissing-period=support
missing period in PROCEDURE DIVISION (when reference format supports Area A
enforcement)
-fzero-length-literals=support
zero-length literals, e.g. ” and ""
-fxml-generate-extra-phrases=support
XML GENERATE’s phrases other than COUNT IN
Appendix A: Compiler cobc options 45
-fcontinue-after=support
AFTER phrase in CONTINUE statement
-fgoto-entry=support
ENTRY FOR GOTO and GOTO ENTRY statements
-fassign-variable=support
ASSIGN [TO] variable in SELECT
-fassign-using-variable=support
ASSIGN USING/VARYING variable in SELECT
-fassign-ext-dyn=support
ASSIGN EXTERNAL/DYNAMIC in SELECT
-fassign-disk-from=support
ASSIGN DISK FROM variable in SELECT
-fvsam-status=support
VSAM status in FILE STATUS
-fself-call-recursive=support
CALL to own PROGRAM-ID implies RECURSIVE attribute
-frecord-contains-depending-clause=support
DEPENDING clause in RECORD CONTAINS
-fpicture-l=support
PICTURE string with ‘L’ character where 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 esca
special register to enable
46
ASCENDING Yes
ASCII Yes (C/S)
ASSIGN Yes
AT Yes
ATTRIBUTE Yes (C/S)
ATTRIBUTES Yes (C/S)
AUTHOR Yes (C/S)
AUTO Yes (C/S) AUTO-SKIP, AUTOTERMINATE
AUTO-DECIMAL Yes (C/S)
AUTO-SKIP Yes AUTO, AUTOTERMINATE
AUTO-SPIN Yes (C/S)
AUTOMATIC Yes
AUTOTERMINATE Yes AUTO, AUTO-SKIP
AWAY-FROM-ZERO Yes (C/S)
B-AND Yes
B-NOT Yes
B-OR Yes
B-SHIFT-L Yes
B-SHIFT-LC Yes
B-SHIFT-R Yes
B-SHIFT-RC Yes
B-XOR Yes
BACKGROUND-COLOR Yes (C/S) BACKGROUND-COLOUR
BACKGROUND-COLOUR Yes BACKGROUND-COLOR
BACKGROUND-HIGH Yes
BACKGROUND-LOW Yes
BACKGROUND-STANDARD Yes
BACKWARD Yes (C/S)
BAR Yes (C/S)
BASED Yes
BEEP Yes BELL
BEFORE Yes
BELL Yes (C/S) BEEP
BINARY Yes
BINARY-C-LONG Yes
BINARY-CHAR Yes
BINARY-DOUBLE Yes BINARY-LONG-LONG
BINARY-INT Yes BINARY-LONG
BINARY-LONG Yes BINARY-INT
BINARY-LONG-LONG Yes BINARY-DOUBLE
BINARY-SEQUENTIAL Yes (C/S)
BINARY-SHORT Yes
BIT Yes
BITMAP Yes (C/S)
BITMAP-END Yes (C/S)
BITMAP-HANDLE Yes (C/S)
BITMAP-NUMBER Yes (C/S)
BITMAP-START Yes (C/S)
BITMAP-TIMER Yes (C/S)
BITMAP-TRAILING Yes (C/S)
BITMAP-TRANSPARENT-COLOR Yes (C/S)
BITMAP-WIDTH Yes (C/S)
Appendix B: Reserved Words 48
BLANK Yes
BLINK Yes (C/S)
BLOCK Yes
BOOLEAN No
BOTTOM Yes
BOX Yes (C/S)
BOXED Yes (C/S)
BULK-ADDITION Yes (C/S)
BUSY Yes (C/S)
BUTTONS Yes (C/S)
BY Yes
BYTE No (C/S)
BYTE-LENGTH Yes (C/S)
BYTES No
C Yes (C/S)
CALENDAR-FONT Yes (C/S)
CALL Yes
CANCEL Yes
CANCEL-BUTTON Yes (C/S)
CAPACITY Yes (C/S)
CARD-PUNCH Yes (C/S)
CARD-READER Yes (C/S)
CASSETTE Yes (C/S)
CCOL Yes (C/S)
CD Yes
CELL Yes (C/S) CELLS
CELL-COLOR Yes (C/S)
CELL-DATA Yes (C/S)
CELL-FONT Yes (C/S)
CELL-PROTECTION Yes (C/S)
CELLS Yes CELL
CENTER Yes (C/S)
CENTERED Yes (C/S)
CENTERED-HEADINGS Yes (C/S)
CENTURY-DATE Yes (C/S)
CF Yes
CH Yes
CHAIN No
CHAINING Yes
CHANGED Yes (C/S)
CHARACTER Yes
CHARACTERS Yes
CHECK-BOX Yes (C/S)
CLASS Yes
CLASS-ID No
CLASSIFICATION Yes (C/S)
CLEAR-SELECTION Yes (C/S)
CLINE Yes (C/S)
CLINES Yes (C/S)
CLOSE Yes
COBOL Yes (C/S)
CODE Yes
Appendix B: Reserved Words 49
CODE-SET Yes
COL Yes
COLLATING Yes
COLOR Yes
COLORS Yes (C/S) COLOURS
COLOURS Yes COLORS
COLS Yes
COLUMN Yes
COLUMN-COLOR Yes (C/S)
COLUMN-DIVIDERS Yes (C/S)
COLUMN-FONT Yes (C/S)
COLUMN-HEADINGS Yes (C/S)
COLUMN-PROTECTION Yes (C/S)
COLUMNS Yes
COMBO-BOX Yes (C/S)
COMMA Yes
COMMAND-LINE Yes
COMMIT Yes
COMMON Yes
COMMUNICATION Yes
COMP Yes COMPUTATIONAL
COMP-0 Yes COMPUTATIONAL-0
COMP-1 Yes COMPUTATIONAL-1
COMP-10 Yes COMP-15, DOUBLE, FLOAT-LONG
COMP-15 Yes COMP-10, DOUBLE, FLOAT-LONG
COMP-2 Yes COMPUTATIONAL-2
COMP-3 Yes COMPUTATIONAL-3
COMP-4 Yes COMPUTATIONAL-4
COMP-5 Yes COMPUTATIONAL-5
COMP-6 Yes COMPUTATIONAL-6
COMP-9 Yes FLOAT, FLOAT-SHORT
COMP-N Yes COMPUTATIONAL-N
COMP-X Yes COMPUTATIONAL-X
COMPUTATIONAL Yes COMP
COMPUTATIONAL-0 Yes COMP-0
COMPUTATIONAL-1 Yes COMP-1
COMPUTATIONAL-2 Yes COMP-2
COMPUTATIONAL-3 Yes COMP-3
COMPUTATIONAL-4 Yes COMP-4
COMPUTATIONAL-5 Yes COMP-5
COMPUTATIONAL-6 Yes COMP-6
COMPUTATIONAL-N Yes COMP-N
COMPUTATIONAL-X Yes COMP-X
COMPUTE Yes
CONDITION Yes
CONFIGURATION Yes
CONSTANT Yes
CONTAINS Yes
CONTENT Yes
CONTINUE Yes
CONTROL Yes
CONTROLS Yes
Appendix B: Reserved Words 50
END-SEARCH Yes
END-SEND Yes
END-START Yes
END-STRING Yes
END-SUBTRACT Yes
END-UNSTRING Yes
END-WRITE Yes
END-XML Yes
ENGRAVED Yes (C/S)
ENSURE-VISIBLE Yes (C/S)
ENTRY Yes
ENTRY-CONVENTION Yes (C/S)
ENTRY-FIELD Yes (C/S)
ENTRY-REASON Yes (C/S)
ENVIRONMENT Yes
ENVIRONMENT-NAME Yes
ENVIRONMENT-VALUE Yes
EO No
EOL Yes (C/S)
EOP Yes END-OF-PAGE
EOS Yes (C/S)
EQUAL Yes EQUALS
EQUALS Yes EQUAL
ERASE Yes (C/S)
ERROR Yes
ESCAPE Yes
ESCAPE-BUTTON Yes (C/S)
ESI Yes
EVALUATE Yes
EVENT Yes
EVENT-LIST Yes (C/S)
EVERY Yes (C/S)
EXCEPTION Yes
EXCEPTION-OBJECT No
EXCEPTION-VALUE Yes (C/S)
EXCLUSIVE Yes
EXCLUSIVE-OR No
EXHIBIT Yes
EXIT Yes
EXPAND Yes (C/S)
EXPANDS No (C/S)
EXTEND Yes
EXTENDED-SEARCH Yes (C/S)
EXTERN Yes (C/S)
EXTERNAL Yes
EXTERNAL-FORM Yes
F Yes (C/S)
FACTORY No
FALSE Yes
FD Yes
FH--FCD Yes (C/S)
FH--KEYDEF Yes (C/S)
Appendix B: Reserved Words 53
FILE Yes
FILE-CONTROL Yes
FILE-ID Yes
FILE-LIMIT Yes (C/S)
FILE-LIMITS Yes (C/S)
FILE-NAME Yes (C/S)
FILE-POS Yes (C/S)
FILL-COLOR Yes (C/S)
FILL-COLOR2 Yes (C/S)
FILL-PERCENT Yes (C/S)
FILLER Yes
FINAL Yes
FINALLY No
FINISH-REASON Yes (C/S)
FIRST Yes
FIXED Yes
FIXED-FONT Yes
FIXED-WIDTH Yes (C/S)
FLAT Yes (C/S)
FLAT-BUTTONS Yes (C/S)
FLOAT Yes COMP-9, FLOAT-SHORT
FLOAT-BINARY-128 No
FLOAT-BINARY-32 No
FLOAT-BINARY-64 No
FLOAT-DECIMAL-16 Yes
FLOAT-DECIMAL-34 Yes
FLOAT-EXTENDED No
FLOAT-INFINITY No
FLOAT-LONG Yes COMP-10, COMP-15, DOUBLE
FLOAT-NOT-A-NUMBER No (C/S)
FLOAT-SHORT Yes COMP-9, FLOAT
FLOATING Yes
FONT Yes
FOOTING Yes
FOR Yes
FOREGROUND-COLOR Yes (C/S) FOREGROUND-COLOUR
FOREGROUND-COLOUR Yes FOREGROUND-COLOR
FOREVER Yes (C/S)
FORMAT No
FRAME Yes (C/S)
FRAMED Yes (C/S)
FREE Yes
FROM Yes
FULL Yes (C/S) LENGTH-CHECK
FULL-HEIGHT Yes (C/S)
FUNCTION Yes
FUNCTION-ID Yes
FUNCTION-POINTER No
GENERATE Yes
GET No
GIVING Yes
GLOBAL Yes
Appendix B: Reserved Words 54
GO Yes
GO-BACK Yes (C/S)
GO-FORWARD Yes (C/S)
GO-HOME Yes (C/S)
GO-SEARCH Yes (C/S)
GOBACK Yes
GRAPHICAL Yes (C/S)
GREATER Yes
GRID Yes (C/S)
GROUP Yes
GROUP-USAGE No
GROUP-VALUE Yes (C/S)
HANDLE Yes
HAS-CHILDREN Yes (C/S)
HEADING Yes
HEADING-COLOR Yes (C/S)
HEADING-DIVIDER-COLOR Yes (C/S)
HEADING-FONT Yes (C/S)
HEAVY Yes (C/S)
HEIGHT-IN-CELLS Yes (C/S)
HEX No (C/S)
HIDDEN-DATA Yes (C/S)
HIGH-COLOR Yes (C/S)
HIGH-VALUE Yes HIGH-VALUES
HIGH-VALUES Yes HIGH-VALUE
HIGHLIGHT Yes (C/S)
HOT-TRACK Yes (C/S)
HSCROLL Yes (C/S)
HSCROLL-POS Yes (C/S)
I-O Yes
I-O-CONTROL Yes
ICON Yes (C/S)
ID Yes
IDENTIFICATION Yes
IDENTIFIED Yes
IF Yes
IGNORE Yes
IGNORING Yes (C/S)
IMPLEMENTS No (C/S)
IN Yes
INDEPENDENT Yes (C/S)
INDEX Yes
INDEXED Yes
INDICATE Yes
INHERITS No
INITIAL Yes
INITIALISE Yes INITIALIZE
INITIALISED Yes INITIALIZED
INITIALIZE Yes INITIALISE
INITIALIZED Yes (C/S) INITIALISED
INITIATE Yes
INPUT Yes
Appendix B: Reserved Words 55
INPUT-OUTPUT Yes
INQUIRE Yes
INSERT-ROWS Yes (C/S)
INSERTION-INDEX Yes (C/S)
INSPECT Yes
INSTALLATION Yes (C/S)
INTERFACE No
INTERFACE-ID No
INTERMEDIATE Yes (C/S)
INTO Yes
INTRINSIC Yes (C/S)
INVALID Yes
INVOKE No
IS Yes
ITEM Yes (C/S)
ITEM-TEXT Yes (C/S)
ITEM-TO-ADD Yes (C/S)
ITEM-TO-DELETE Yes (C/S)
ITEM-TO-EMPTY Yes (C/S)
ITEM-VALUE Yes (C/S)
JSON Yes
JUST Yes JUSTIFIED
JUSTIFIED Yes JUST
KEPT Yes
KEY Yes
KEYBOARD Yes (C/S)
LABEL Yes
LABEL-OFFSET Yes (C/S)
LARGE-FONT Yes
LARGE-OFFSET Yes (C/S)
LAST Yes
LAST-ROW Yes (C/S)
LAYOUT-DATA Yes (C/S)
LAYOUT-MANAGER Yes
LC_ALL No (C/S)
LC_COLLATE No (C/S)
LC_CTYPE No (C/S)
LC_MESSAGES No (C/S)
LC_MONETARY No (C/S)
LC_NUMERIC No (C/S)
LC_TIME No (C/S)
LEADING Yes
LEADING-SHIFT Yes (C/S)
LEAVE Yes (C/S)
LEFT Yes
LEFT-JUSTIFY No
LEFT-TEXT Yes (C/S)
LEFTLINE Yes
LENGTH Yes
LENGTH-CHECK Yes FULL
LESS Yes
LIKE Yes
Appendix B: Reserved Words 56
LIMIT Yes
LIMITS Yes
LINAGE Yes
LINAGE-COUNTER Yes
LINE Yes
LINE-COUNTER Yes
LINE-SEQUENTIAL Yes (C/S)
LINES Yes
LINES-AT-ROOT Yes (C/S)
LINKAGE Yes
LIST-BOX Yes (C/S)
LM-RESIZE Yes
LOC Yes (C/S)
LOCAL-STORAGE Yes
LOCALE Yes
LOCATION No (C/S)
LOCK Yes
LOCK-HOLDING Yes (C/S)
LONG-DATE Yes (C/S)
LOW-COLOR Yes (C/S)
LOW-VALUE Yes LOW-VALUES
LOW-VALUES Yes LOW-VALUE
LOWER Yes (C/S)
LOWERED Yes (C/S)
LOWLIGHT Yes (C/S)
MAGNETIC-TAPE Yes (C/S)
MANUAL Yes
MASS-UPDATE Yes (C/S)
MASTER-INDEX Yes (C/S)
MAX-LINES Yes (C/S)
MAX-PROGRESS Yes (C/S)
MAX-TEXT Yes (C/S)
MAX-VAL Yes (C/S)
MEDIUM-FONT Yes
MEMORY Yes (C/S)
MENU Yes
MERGE Yes
MESSAGE Yes
MESSAGE-TAG No
METHOD No
METHOD-ID No
MIN-VAL Yes (C/S)
MINUS Yes
MODE Yes
MODIFY Yes
MODULES Yes (C/S)
MOVE Yes
MULTILINE Yes (C/S)
MULTIPLE Yes
MULTIPLY Yes
NAME Yes (C/S)
NAMED Yes (C/S)
Appendix B: Reserved Words 57
RELATIVE Yes
RELEASE Yes
REMAINDER Yes
REMARKS Yes (C/S)
REMOVAL Yes
RENAMES Yes
REORG-CRITERIA Yes (C/S)
REPLACE Yes
REPLACING Yes
REPORT Yes
REPORTING Yes
REPORTS Yes
REPOSITORY Yes
REQUIRED Yes (C/S) EMPTY-CHECK
REREAD Yes (C/S)
RERUN Yes (C/S)
RESERVE Yes
RESET Yes
RESET-GRID Yes (C/S)
RESET-LIST Yes (C/S)
RESET-TABS Yes (C/S)
RESUME No
RETRY Yes
RETURN Yes
RETURNING Yes
REVERSE Yes
REVERSE-VIDEO Yes (C/S)
REVERSED Yes
REWIND Yes
REWRITE Yes
RF Yes
RH Yes
RIGHT Yes
RIGHT-ALIGN Yes (C/S)
RIGHT-JUSTIFY No
RIMMED Yes (C/S)
ROLLBACK Yes
ROUNDED Yes
ROUNDING Yes (C/S)
ROW-COLOR Yes (C/S)
ROW-COLOR-PATTERN Yes (C/S)
ROW-DIVIDERS Yes (C/S)
ROW-FONT Yes (C/S)
ROW-HEADINGS Yes (C/S)
ROW-PROTECTION Yes (C/S)
RUN Yes
S Yes (C/S)
SAME Yes
SAVE-AS Yes (C/S)
SAVE-AS-NO-PROMPT Yes (C/S)
SCREEN Yes
SCROLL Yes (C/S)
Appendix B: Reserved Words 61
STANDARD-1 Yes
STANDARD-2 Yes
STANDARD-BINARY Yes (C/S)
STANDARD-DECIMAL Yes (C/S)
START Yes
START-X Yes (C/S)
START-Y Yes (C/S)
STATEMENT No (C/S)
STATIC Yes (C/S)
STATIC-LIST Yes (C/S)
STATUS Yes
STATUS-BAR Yes (C/S)
STATUS-TEXT Yes (C/S)
STDCALL Yes (C/S)
STEP Yes (C/S)
STOP Yes
STRING Yes
STRONG Yes (C/S)
STYLE Yes (C/S)
SUB-QUEUE-1 Yes
SUB-QUEUE-2 Yes
SUB-QUEUE-3 Yes
SUBTRACT Yes
SUBWINDOW Yes
SUM Yes
SUPER No
SUPPRESS Yes
SYMBOL No (C/S)
SYMBOLIC Yes
SYNC Yes SYNCHRONISED, SYNCHRONIZED
SYNCHRONISED Yes SYNC, SYNCHRONIZED
SYNCHRONIZED Yes SYNC, SYNCHRONISED
SYSTEM-DEFAULT Yes
SYSTEM-INFO Yes (C/S)
SYSTEM-OFFSET Yes
TAB Yes (C/S)
TAB-TO-ADD Yes (C/S)
TAB-TO-DELETE Yes (C/S)
TABLE Yes
TALLYING Yes
TAPE Yes (C/S)
TEMPORARY Yes (C/S)
TERMINAL-INFO Yes (C/S)
TERMINATE Yes
TERMINATION-VALUE Yes (C/S)
TEST Yes
TEXT Yes
THAN Yes
THEN Yes
THREAD Yes
THREADS Yes
THROUGH Yes THRU
Appendix B: Reserved Words 63
INTEGER-OF-BOOLEAN No 1
INTEGER-OF-DATE Yes 1
INTEGER-OF-DAY Yes 1
INTEGER-OF-FORMATTED-DATE Yes 2
INTEGER-PART Yes 1
LENGTH Yes 1
LENGTH-AN Yes 1
LOCALE-COMPARE Yes 2
LOCALE-DATE Yes 1
LOCALE-TIME Yes 1
LOCALE-TIME-FROM-SECONDS Yes 1
LOG Yes 1
LOG10 Yes 1
LOWER-CASE Yes 1
LOWEST-ALGEBRAIC Yes 1
MAX Yes Unlimited
MEAN Yes Unlimited
MEDIAN Yes Unlimited
MIDRANGE Yes Unlimited
MIN Yes Unlimited
MOD Yes 2
MODULE-CALLER-ID Yes 0
MODULE-DATE Yes 0
MODULE-FORMATTED-DATE Yes 0
MODULE-ID Yes 0
MODULE-NAME No 1
MODULE-PATH Yes 0
MODULE-SOURCE Yes 0
MODULE-TIME Yes 0
MONETARY-DECIMAL-POINT Yes 0
MONETARY-THOUSANDS-SEPARATOR Yes 0
NATIONAL-OF No 1
NUMERIC-DECIMAL-POINT Yes 0
NUMERIC-THOUSANDS-SEPARATOR Yes 0
NUMVAL Yes 1
NUMVAL-C Yes 2
NUMVAL-F Yes 1
ORD Yes 1
ORD-MAX Yes Unlimited
ORD-MIN Yes Unlimited
PI Yes 0
PRESENT-VALUE Yes Unlimited
RANDOM Yes 0
RANGE Yes Unlimited
REM Yes 2
REVERSE Yes 1
SECONDS-FROM-FORMATTED-TIME Yes 2
SECONDS-PAST-MIDNIGHT Yes 0
SIGN Yes 1
SIN Yes 1
SQRT Yes 1
STANDARD-COMPARE No 2
Appendix C: Intrinsic Functions 68
C$FILEINFO 2
C$GETPID 0
C$JUSTIFY 1-2
C$MAKEDIR 1
C$NARG 1
C$PARAMSIZE 1
C$PRINTABLE 1-2
C$SLEEP 1
C$TOLOWER 2
C$TOUPPER 2
EXTFH 2
X"91" 3
X"E4" 0
X"E5" 0
X"F4" 2
X"F5" 2
71
Exception Name
EC-ALL
EC-ARGUMENT
EC-ARGUMENT-FUNCTION (f)
EC-ARGUMENT-IMP
EC-BOUND
EC-BOUND-FUNC-RET-VALUE
EC-BOUND-IMP
EC-BOUND-ODO (f)
EC-BOUND-OVERFLOW (f)
EC-BOUND-PTR (f)
EC-BOUND-REF-MOD (f)
EC-BOUND-SET (f)
EC-BOUND-SUBSCRIPT (f)
EC-BOUND-TABLE-LIMIT (f)
EC-CONTINUE
EC-CONTINUE-IMP
EC-CONTINUE-LESS-THAN-ZERO
EC-DATA
EC-DATA-CONVERSION
EC-DATA-IMP
EC-DATA-INCOMPATIBLE (f)
EC-DATA-NOT-FINITE (f)
EC-DATA-OVERFLOW (f)
EC-DATA-PTR-NULL (f)
EC-EXTERNAL
EC-EXTERNAL-DATA-MISMATCH (f)
EC-EXTERNAL-FILE-MISMATCH (f)
EC-EXTERNAL-FORMAT-CONFLICT (f)
EC-EXTERNAL-IMP
EC-FLOW
EC-FLOW-APPLY-COMMIT (f)
EC-FLOW-COMMIT (f)
EC-FLOW-GLOBAL-EXIT (f)
EC-FLOW-GLOBAL-GOBACK (f)
EC-FLOW-IMP
EC-FLOW-RELEASE (f)
EC-FLOW-REPORT (f)
EC-FLOW-RETURN (f)
EC-FLOW-ROLLBACK (f)
EC-FLOW-SEARCH (f)
EC-FLOW-USE (f)
EC-FUNCTION
EC-FUNCTION-ARG-OMITTED (f)
EC-FUNCTION-IMP
Appendix F: Exception names 73
EC-FUNCTION-NOT-FOUND (f)
EC-FUNCTION-PTR-INVALID (f)
EC-FUNCTION-PTR-NULL (f)
EC-I-O
EC-I-O-AT-END
EC-I-O-EOP
EC-I-O-EOP-OVERFLOW
EC-I-O-FILE-SHARING
EC-I-O-IMP
EC-I-O-INVALID-KEY
EC-I-O-LINAGE (f)
EC-I-O-LOGIC-ERROR (f)
EC-I-O-PERMANENT-ERROR (f)
EC-I-O-RECORD-CONTENT (f)
EC-I-O-RECORD-OPERATION
EC-I-O-RECORD-WARNING
EC-IMP
EC-IMP-ACCEPT
EC-IMP-DISPLAY
EC-IMP-UTC-UNKNOWN (f)
EC-IMP-FEATURE-DISABLED
EC-IMP-FEATURE-MISSING
EC-LOCALE
EC-LOCALE-IMP
EC-LOCALE-INCOMPATIBLE
EC-LOCALE-INVALID (f)
EC-LOCALE-INVALID-PTR (f)
EC-LOCALE-MISSING (f)
EC-LOCALE-SIZE (f)
EC-MCS
EC-MCS-ABNORMAL-TERMINATION
EC-MCS-IMP
EC-MCS-INVALID-TAG
EC-MCS-MESSAGE-LENGTH
EC-MCS-NO-REQUESTER
EC-MCS-NO-SERVER
EC-MCS-NORMAL-TERMINATION
EC-MCS-REQUESTOR-FAILED
EC-OO
EC-OO-ARG-OMITTED (f)
EC-OO-CONFORMANCE (f)
EC-OO-EXCEPTION (f)
EC-OO-IMP
EC-OO-METHOD (f)
EC-OO-NULL (f)
EC-OO-RESOURCE (f)
EC-OO-UNIVERSAL (f)
EC-ORDER
EC-ORDER-IMP
EC-ORDER-NOT-SUPPORTED (f)
EC-OVERFLOW
EC-OVERFLOW-IMP
Appendix F: Exception names 74
EC-OVERFLOW-STRING
EC-OVERFLOW-UNSTRING
EC-PROGRAM
EC-PROGRAM-ARG-MISMATCH (f)
EC-PROGRAM-ARG-OMITTED (f)
EC-PROGRAM-CANCEL-ACTIVE (f)
EC-PROGRAM-IMP
EC-PROGRAM-NOT-FOUND (f)
EC-PROGRAM-PTR-NULL (f)
EC-PROGRAM-RECURSIVE-CALL (f)
EC-PROGRAM-RESOURCES (f)
EC-RAISING
EC-RAISING-IMP
EC-RAISING-NOT-SPECIFIED (f)
EC-RANGE
EC-RANGE-IMP
EC-RANGE-INDEX (f)
EC-RANGE-INSPECT-SIZE (f)
EC-RANGE-INVALID
EC-RANGE-PERFORM-VARYING (f)
EC-RANGE-PTR (f)
EC-RANGE-SEARCH-INDEX
EC-RANGE-SEARCH-NO-MATCH
EC-REPORT
EC-REPORT-ACTIVE (f)
EC-REPORT-COLUMN-OVERLAP (f)
EC-REPORT-FILE-MODE (f)
EC-REPORT-IMP
EC-REPORT-INACTIVE (f)
EC-REPORT-LINE-OVERLAP
EC-REPORT-NOT-TERMINATED
EC-REPORT-PAGE-LIMIT
EC-REPORT-PAGE-WIDTH
EC-REPORT-SUM-SIZE (f)
EC-REPORT-VARYING (f)
EC-SCREEN
EC-SCREEN-FIELD-OVERLAP
EC-SCREEN-IMP
EC-SCREEN-ITEM-TRUNCATED
EC-SCREEN-LINE-NUMBER
EC-SCREEN-STARTING-COLUMN
EC-SIZE
EC-SIZE-ADDRESS (f)
EC-SIZE-EXPONENTIATION (f)
EC-SIZE-IMP
EC-SIZE-OVERFLOW (f)
EC-SIZE-TRUNCATION (f)
EC-SIZE-UNDERFLOW (f)
EC-SIZE-ZERO-DIVIDE (f)
EC-SORT-MERGE
EC-SORT-MERGE-ACTIVE (f)
EC-SORT-MERGE-FILE-OPEN (f)
Appendix F: Exception names 75
EC-SORT-MERGE-IMP
EC-SORT-MERGE-RELEASE (f)
EC-SORT-MERGE-RETURN (f)
EC-SORT-MERGE-SEQUENCE (f)
EC-STORAGE
EC-STORAGE-IMP
EC-STORAGE-NOT-ALLOC
EC-STORAGE-NOT-AVAIL
EC-USER
EC-VALIDATE
EC-VALIDATE-CONTENT
EC-VALIDATE-FORMAT
EC-VALIDATE-IMP
EC-VALIDATE-RELATION
EC-VALIDATE-VARYING (f)
EC-XML
EC-XML-CODESET (f)
EC-XML-CODESET-CONVERSION (f)
EC-XML-COUNT (f)
EC-XML-DOCUMENT-TYPE (f)
EC-XML-IMPLICIT-CLOSE (f)
EC-XML-INVALID (f)
EC-XML-NAMESPACE (f)
EC-XML-STACKED-OPEN (f)
EC-XML-RANGE (f)
EC-XML-IMP (f)
EC-JSON
EC-JSON-IMP (f)
76
# Value: enum
standard-define 0
# NOTE: see enum cb_std_def, defined in cobc/cobc.h.
# CB_STD_GC = 0,
# CB_STD_MF,
# CB_STD_IBM,
# CB_STD_MVS,
# CB_STD_BS2000,
# CB_STD_ACU,
# CB_STD_RM,
# CB_STD_85,
# CB_STD_2002,
# CB_STD_2014
# Value: int
tab-width: 8
text-column: 72
# Maximum word-length for COBOL words / Programmer defined words
# Be aware that GC checks the word length against COB_MAX_WORDLEN
# first (currently 63)
word-length: 63
larger-redefines: error
# Allow Hex ’F’ for NUMERIC test of signed PACKED DECIMAL field
hostsign: no
# If yes, DISPLAYs and ACCEPTs are, by default, done on the CRT (i.e., using
# curses).
console-is-crt: no
# If yes, allow redefinition of the current program’s name. This prevents its
# use in a prototype-format CALL/CANCEL statement.
Appendix G: Compiler Configuration 79
program-name-redefinition: yes
# If yes, the first item in a field screen ACCEPT/DISPLAY (e.g. DISPLAY x UPON
# CRT) is located after the previous ACCEPT/DISPLAY (as though LINE 0 COL 0 had
# been specified).
line-col-zero-default: yes
# If yes, DISPLAY SPACES acts as ERASE EOS, DISPLAY X"01" acts as ERASE EOL,
# DISPLAY X"02" acts as BLANK SCREEEN and DISPLAY X"07" acts as BELL. Note
# DISPLAY LOW-VALUE is excluded from this; it will always just position the
# cursor.
display-special-fig-consts: no
# If yes, COMP-1 is a signed 16-bit integer and any PICTURE clause is ignored.
binary-comp-1: no
# If yes, implicitly define a variable for an ASSIGN DYNAMIC which does not
# match an existing data item.
implicit-assign-dynamic-var: yes
# If yes, ACCEPT and DISPLAY statements accept device names using mnemonics
device-mnemonics: no
# Dialect features
# Value: ’ok’, ’warning’, ’archaic’, ’obsolete’, ’skip’, ’ignore’, ’error’,
# ’unconformable’
alter-statement: obsolete
comment-paragraphs: obsolete
control-division: unconformable
partial-replacing-with-literal: obsolete
call-overflow: archaic
data-records-clause: obsolete
Appendix G: Compiler Configuration 80
debugging-mode: ok
use-for-debugging: ok
listing-statements: skip # may be a user-defined word
title-statement: skip # may be a user-defined word
entry-statement: ok
goto-statement-without-name: obsolete
label-records-clause: obsolete
memory-size-clause: obsolete
move-noninteger-to-alphanumeric: error
move-figurative-constant-to-numeric: archaic
move-figurative-space-to-numeric: error
move-figurative-quote-to-numeric: obsolete
multiple-file-tape-clause: obsolete
next-sentence-phrase: archaic
odo-without-to: warning
padding-character-clause: obsolete
section-segments: ignore
stop-literal-statement: obsolete
stop-identifier-statement: obsolete
stop-error-statement: unconformable
same-as-clause: ok
type-to-clause: ok
usage-type: ok
synchronized-clause: ok
sync-left-right: ok
special-names-clause: ok
top-level-occurs-clause: ok
value-of-clause: obsolete
numeric-boolean: ok
hexadecimal-boolean: ok
national-literals: ok
hexadecimal-national-literals: ok
national-character-literals: warning
acu-literals: unconformable
hp-octal-literals: unconformable
word-continuation: warning
not-exception-before-exception: ok
accept-display-extensions: ok
renames-uncommon-levels: ok
symbolic-constant: ok
constant-78: ok
constant-01: ok
perform-varying-without-by: ok
reference-out-of-declaratives: warning
program-prototypes: ok
call-convention-mnemonic: ok
call-convention-linkage: ok
numeric-value-for-edited-item: ok
incorrect-conf-sec-order: ok
define-constant-directive: archaic
free-redefines-position: warning
Appendix G: Compiler Configuration 81
records-mismatch-record-clause warning
record-delimiter: ok
sequential-delimiters: ok
record-delim-with-fixed-recs: ok
missing-statement: warning
missing-period: warning #when format not in {fixed,free}
zero-length-literals: ok
xml-generate-extra-phrases: ok
continue-after: ok
goto-entry: warning
assign-variable: ok
assign-using-variable: ok
assign-ext-dyn: ok
assign-disk-from: ok
vsam-status: ignore
self-call-recursive: warning
record-contains-depending-clause: unconformable
defaultbyte: init
picture-l: ok
# use complete word list; synonyms and exceptions are specified below
reserved-words: default
# not-reserved:
# Value: Word to be taken out of the reserved words list
not-reserved: TERMINAL
not-reserved: EXAMINE
# reserved:
# Entries of the form word-1=word-2 define word-1 as an alias for default
# reserved word word-2. No spaces are allowed around the equal sign.
reserved: AUTO-SKIP=AUTO
reserved: AUTOTERMINATE=AUTO
reserved: BACKGROUND-COLOUR=BACKGROUND-COLOR
reserved: BEEP=BELL
reserved: BINARY-INT=BINARY-LONG
reserved: BINARY-LONG-LONG=BINARY-DOUBLE
reserved: CELLS=CELL
reserved: COLOURS=COLORS
reserved: EMPTY-CHECK=REQUIRED
reserved: EQUALS=EQUAL
reserved: FOREGROUND-COLOUR=FOREGROUND-COLOR
reserved: HIGH-VALUES=HIGH-VALUE
reserved: INITIALISE=INITIALIZE
reserved: INITIALISED=INITIALIZED
reserved: LENGTH-CHECK=FULL
reserved: LOW-VALUES=LOW-VALUE
reserved: ORGANISATION=ORGANIZATION
reserved: PIXELS=PIXEL
reserved: SYNCHRONISED=SYNCHRONIZED
reserved: TIMEOUT=TIME-OUT
reserved: ZEROES=ZERO
reserved: ZEROS=ZERO
82
Any environment variable may be unset with the directive unsetenv (one var per line).
Runtime configuration files can include other files with the directive include .
To include another configuration file only if it is present use the directive includeif . You
can also use ${envvar} inside this.
If you want to reset a parameter to its default value use reset parametername .
Most runtime variables have boolean values, some are switches, some have string values,
integer values (if not explicit noted: unsigned) and some are size values. The boolean values
will be evaluated as following: to true: 1, Y, ON, YES, TRUE (no matter of case) to false: 0, N,
OFF.
A size value is an unsigned integer optionally followed by ‘K’, ‘M’, or ‘G’ for ‘kilo’, ‘mega’ or
‘giga’.
For convenience a parameter in the runtime.cfg file may be defined by using either the
environment variable name or the parameter name. In most cases the environment variable
name is the parameter name (in upper case) with the prefix COB_ .
For a complete list of the settings in use see cobcrun --runtime-config .
Note: If you want to slightly speed up a program’s startup time, remove all of the comments
from the actual real configuration file that is processed.
Appendix I: Runtime configuration 84
without prefix
%L is replaced by Line number, right justified, length 6
%S is replaced by statement type and name
%F is replaced by source file name
Example: TRACE_FORMAT "Line: %L %S"
Note: format of GC2.2 and older:
"PROGRAM-ID: %I Line: %L %S"
Type: boolean
Default: false
Note: This setting is most useful if you want to REWRITE those
files.
Example: LS_FIXED TRUE
covers must also clearly and legibly identify you as the publisher of these copies. The front
cover must present the full title with all words of the title equally prominent and visible.
You may add other material on the covers in addition. Copying with changes limited to
the covers, as long as they preserve the title of the Document and satisfy these conditions,
can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the
first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto
adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you
must either include a machine-readable Transparent copy along with each Opaque copy,
or state in or with each Opaque copy a computer-network location from which the general
network-using public has access to download using public-standard network protocols a
complete Transparent copy of the Document, free of added material. If you use the latter
option, you must take reasonably prudent steps, when you begin distribution of Opaque
copies in quantity, to ensure that this Transparent copy will remain thus accessible at the
stated location until at least one year after the last time you distribute an Opaque copy
(directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before
redistributing any large number of copies, to give them a chance to provide you with an
updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under the conditions
of sections 2 and 3 above, provided that you release the Modified Version under precisely
this License, with the Modified Version filling the role of the Document, thus licensing
distribution and modification of the Modified Version to whoever possesses a copy of it. In
addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct from that of the
Document, and from those of previous versions (which should, if there were any, be
listed in the History section of the Document). You may use the same title as a previous
version if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities responsible for
authorship of the modifications in the Modified Version, together with at least five of
the principal authors of the Document (all of its principal authors, if it has fewer than
five), unless they release you from this requirement.
C. State on the Title page the name of the publisher of the Modified Version, as the
publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications adjacent to the other copy-
right notices.
F. Include, immediately after the copyright notices, a license notice giving the public
permission to use the Modified Version under the terms of this License, in the form
shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections and required Cover
Texts given in the Document’s license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating
at least the title, year, new authors, and publisher of the Modified Version as given
on the Title Page. If there is no section Entitled “History” in the Document, create
one stating the title, year, authors, and publisher of the Document as given on its
Appendix J: GNU Free Documentation License 96
Title Page, then add an item describing the Modified Version as stated in the previous
sentence.
J. Preserve the network location, if any, given in the Document for public access to a
Transparent copy of the Document, and likewise the network locations given in the
Document for previous versions it was based on. These may be placed in the “History”
section. You may omit a network location for a work that was published at least four
years before the Document itself, or if the original publisher of the version it refers to
gives permission.
K. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title
of the section, and preserve in the section all the substance and tone of each of the
contributor acknowledgements and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their
titles. Section numbers or the equivalent are not considered part of the section titles.
M. Delete any section Entitled “Endorsements”. Such a section may not be included in
the Modified Version.
N. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title
with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or appendices that qualify as
Secondary Sections and contain no material copied from the Document, you may at your
option designate some or all of these sections as invariant. To do this, add their titles to
the list of Invariant Sections in the Modified Version’s license notice. These titles must be
distinct from any other section titles.
You may add a section Entitled “Endorsements”, provided it contains nothing but endorse-
ments of your Modified Version by various parties—for example, statements of peer review
or that the text has been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up
to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified
Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added
by (or through arrangements made by) any one entity. If the Document already includes
a cover text for the same cover, previously added by you or by arrangement made by the
same entity you are acting on behalf of, you may not add another; but you may replace the
old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to
use their names for publicity for or to assert or imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this License, under
the terms defined in section 4 above for modified versions, provided that you include in the
combination all of the Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its license notice, and that you
preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical
Invariant Sections may be replaced with a single copy. If there are multiple Invariant
Sections with the same name but different contents, make the title of each such section
unique by adding at the end of it, in parentheses, the name of the original author or
publisher of that section if known, or else a unique number. Make the same adjustment to
the section titles in the list of Invariant Sections in the license notice of the combined work.
Appendix J: GNU Free Documentation License 97
In the combination, you must combine any sections Entitled “History” in the various original
documents, forming one section Entitled “History”; likewise combine any sections Entitled
“Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections
Entitled “Endorsements.”
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents released under
this License, and replace the individual copies of this License in the various documents with
a single copy that is included in the collection, provided that you follow the rules of this
License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually
under this License, provided you insert a copy of this License into the extracted document,
and follow this License in all other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate and independent
documents or works, in or on a volume of a storage or distribution medium, is called an
“aggregate” if the copyright resulting from the compilation is not used to limit the legal
rights of the compilation’s users beyond what the individual works permit. When the
Document is included in an aggregate, this License does not apply to the other works in
the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document,
then if the Document is less than one half of the entire aggregate, the Document’s Cover
Texts may be placed on covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form. Otherwise they must
appear on printed covers that bracket the whole aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may distribute translations of the
Document under the terms of section 4. Replacing Invariant Sections with translations
requires special permission from their copyright holders, but you may include translations
of some or all Invariant Sections in addition to the original versions of these Invariant
Sections. You may include a translation of this License, and all the license notices in
the Document, and any Warranty Disclaimers, provided that you also include the original
English version of this License and the original versions of those notices and disclaimers. In
case of a disagreement between the translation and the original version of this License or a
notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”,
the requirement (section 4) to Preserve its Title (section 1) will typically require changing
the actual title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except as expressly pro-
vided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute
it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license from a particular copy-
right holder is reinstated (a) provisionally, unless and until the copyright holder explicitly
and finally terminates your license, and (b) permanently, if the copyright holder fails to
notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the
copyright holder notifies you of the violation by some reasonable means, this is the first
time you have received notice of violation of this License (for any work) from that copyright
holder, and you cure the violation prior to 30 days after your receipt of the notice.
Appendix J: GNU Free Documentation License 98
Termination of your rights under this section does not terminate the licenses of parties
who have received copies or rights from you under this License. If your rights have been
terminated and not permanently reinstated, receipt of a copy of some or all of the same
material does not give you any rights to use it.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of the GNU Free Doc-
umentation License from time to time. Such new versions will be similar in spirit to the
present version, but may differ in detail to address new problems or concerns. See https://
www.gnu.org/licenses/.
Each version of the License is given a distinguishing version number. If the Document
specifies that a particular numbered version of this License “or any later version” applies
to it, you have the option of following the terms and conditions either of that specified
version or of any later version that has been published (not as a draft) by the Free Software
Foundation. If the Document does not specify a version number of this License, you may
choose any version ever published (not as a draft) by the Free Software Foundation. If the
Document specifies that a proxy can decide which future versions of this License can be
used, that proxy’s public statement of acceptance of a version permanently authorizes you
to choose that version for the Document.
11. RELICENSING
“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web
server that publishes copyrightable works and also provides prominent facilities for anybody
to edit those works. A public wiki that anybody can edit is an example of such a server. A
“Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of
copyrightable works thus published on the MMC site.
“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published
by Creative Commons Corporation, a not-for-profit corporation with a principal place of
business in San Francisco, California, as well as future copyleft versions of that license
published by that same organization.
“Incorporate” means to publish or republish a Document, in whole or in part, as part of
another Document.
An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that
were first published under this License somewhere other than this MMC, and subsequently
incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site under CC-BY-
SA on the same site at any time before August 1, 2009, provided the MMC is eligible for
relicensing.
Appendix J: GNU Free Documentation License 99