Gnucobol Manual: Keisuke Nishida, Roger While, Brian Tiffin, Simon Sobisch
Gnucobol Manual: Keisuke Nishida, Roger While, Brian Tiffin, Simon Sobisch
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. 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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.3 Source format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.4 Warning options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.5 Configuration options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.6 Listing options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.7 Debug switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.8 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Multiple sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1 Static linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.2 Dynamic linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.2.1 Driver program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.2.2 Compiling programs separately . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.3 Building library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2.4 Using library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 C interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.1 Writing Main Program in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.2 Redirecting output to a (FILE *). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.3 Static linking with COBOL programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.4 Dynamic linking with COBOL programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.5 Static linking with C programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.6 Dynamic linking with C programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3 Customize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1 Customizing compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2 Customizing library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Optimize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.1 Optimize options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.2 Optimize call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.3 Optimize binary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5 Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1 Debug options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6 Non-standard extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.1 SELECT ASSIGN TO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2 Indexed file packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.3 Extended ACCEPT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.3.1 AUTO-SKIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.3.2 PROTECTED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
ii
6.3.3 SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.4 ACCEPT special keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.4.1 Arrow keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.4.2 Backspace key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.4.3 Delete keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.4.4 End keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.4.5 Home keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.4.6 Insert key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.4.7 Tab keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.5 Extended DISPLAY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.5.1 BELL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.5.2 BLANK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.5.3 ERASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.5.4 SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.5.5 Figurative Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7 System Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7.1 CBL GC GETOPT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7.2 CBL GC HOSTED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.3 CBL GC NANOSLEEP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
7.4 CBL GC FORK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
7.5 CBL GC WAITPID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
1
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 -free compiler option.
$ cobc -x -free hellonew.cob
$ ./hellonew
Hello, new world!
2
2 Compile
This chapter describes how to compile COBOL programs using GnuCOBOL.
The following options specify the target type produced by the compiler:
-E Preprocess only: compiler directives are executed, comment lines are removed and
COPY statements are expanded. The output is saved in file *.i.
-C Translation only. COBOL source files are translated into C files. The output is
saved in file *.c.
-S Compile only. Translated C files are compiled by the C compiler to assembler code.
The output is saved in file *.s.
-c Compile and assemble. This is equivalent to cc -c. The output is saved in file *.o.
-m Compile, assemble, and build a dynamically loadable module (i.e., a shared library).
The output is saved in file *.so.2 This is the default behaviour.
-b Compile, assemble, and combine all input files into a single dynamically loadable
module. Unless -o is also used, the output is saved using the first filename as *.so.
-x Include the main function in the output, creating an executable image. The main
entry point being the first program in the file.
This option takes effect at the translation stage. If you give this option with -C,
you will see the main function at the end of the generated C file.
-j(=<args>), -job(=<args>)
Run job after compilation. Either from executable with -x, or with cobcrun when
compiling a module. Optional arguments, if given, are passed to the program or
module command line.
-I <directory>
Add <directory> to copy/include search path.
-L <directory>
Add <directory> to library search path.
-D <define>
Pass <define> to the COBOL compiler.
-free, -F Free format. The program-text area starts in column 1 and continues till the end
of line (effectively 255 characters in GnuCOBOL).
-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
COBOL sources compiled with these dialects therefore may work only with Gnu-
COBOL. COBOL sources may need a change because of reserved words in Gnu-
COBOL, otherwise offending words may be removed by -fno-reserved=word.
COBOL-85, X/Open COBOL, COBOL 2002 and COBOL 2014 are always "strict".
-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
-conf=<file>
User-defined dialect configuration. See -std= above.
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 [cobc --help], page 28.
-T=<file>
Generate and place a wide print listing into *.lst.
--tlines=<lines>
Specify lines per page in print listing, default = 55. Set to zero for no additional
page breaks.
--tsymbols
Generate symbol table in listing.
-P(=<dir or file>)
Generate and place a preprocessed listing (old format) into *.lst.
-Xref
-X Generate cross reference in the listing.
Here is an example program listing with the -t -tsymbols option:
GnuCOBOL 2.0.0 test.cbl Mon Oct 17 10:23:45 2016 Page 0001
When the wide list option is specified (-T), the SEQUENCE columns are included in the
listing.
The second part of the listing file is the listing of the Symbol Table:
GnuCOBOL 2.0.0 test.cbl Mon Oct 17 10:23:45 2016 Page 0002
-fsource-location
Generate source location code (implied by -debug or -g).
-fimplicit-init
Do automatic initialization of the COBOL runtime system.
-fstack-check
Enable PERFORM stack checking (implied by -debug or -g).
-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-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).
-ffunctions-all
Allow use of intrinsic functions without FUNCTION keyword.
-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).
Before running the main program, install the module files in your library directory:
$ cp subr.so /your/cobol/lib
Now, set the environment variable COB_LIBRARY_PATH to your library directory, and run the
main program:
$ export COB_LIBRARY_PATH=/your/cobol/lib
$ ./main
2.3 C interface
This chapter describes how to combine C programs with COBOL programs.
int
main (int argc, char **argv)
{
/* initialize your program */
...
You can write cobc_init(0, NULL); if you do not want to pass command line arguments to
COBOL.
You can compile your C program as follows:
cc -c `cob-config --cflags` main.c
The compiled object must be linked with libcob as follows:
cc -o main main.o `cob-config --libs`
int
main()
Chapter 2: Compile 12
{
int ret;
char hello[8] = "Hello, ";
char world[7] = "world!";
return ret;
}
----------------------------------------
Compile these programs as follows:
$ cc -c ‘cob-config --cflags‘ hello.c
$ cobc -c -static say.cob
$ cobc -x -o hello hello.o say.o
$ ./hello
Hello, world!
int main()
{
int ret;
char hello[8] = "Hello, ";
char world[7] = "world!";
3 Customize
4 Optimize
5 Debug
6 Non-standard extensions
ACCEPT variable-1
LINE <line> COLUMN <column>
WITH
AUTO-SKIP | AUTO
[PROTECTED] SIZE [IS] variable-2 | literal-2
END-ACCEPT.
6.3.1 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 word AUTO may be used for AUTO-SKIP.
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 19.
The Alt-Right-Arrow and Alt-Left-Arrow keys never AUTO-SKIP.
6.3.2 PROTECTED
PROTECTED is ignored. It is optional.
6.3.3 SIZE
The size of variable-1 to accept from the screen. It is optional.
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.
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 <greater than zero>
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.
LOW-VALUE
Position the cursor to LINE and COLUMN. The next DISPLAY statement does not
need a LINE or COLUMN to display at that position.
ALL "1" Display spaces from LINE and COLUMN to the end of the line. This is the same
as WITH ERASE EOL.
ALL "2" Clear the whole screen. This is the same as WITH BLANK SCREEN.
ALL "7" Ring the bell. This is the same as WITH BELL.
All other figurative constants display as a single character.
22
7 System Routines
For a complete list of supported system routines, see Appendix D [cobc –list-system], page 54.
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.
The return-char might contain the following:
• regular character if an option was recognized
• ’ ?’ if we have an undefined or ambiguous option
• ’1’ if we have a non-option (only if first byte of so is ’-’)
• ’0’ if valpoint != NULL and we are writing the return value to the specified address
• ’-1’ if we don’t have any more options (or reach the first non-option if first byte of so is ’+’)
The return-codes of CBL_GC_GETOPT are:
• 1 if we’ve got a non-option (only if first byte of so is ’-’)
• 0 if valpoint != NULL and we are writing the return value to the specified address
• -1 if we don’t have any more options (or reach the first non-option if first byte of so is ’+’)
• 2 if we have got an truncated option value in opt-val (because opt-val was too small)
• 3 if we got a regular answer from getopt
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 26
*> Waiting five seconds using compiler string catenation for readability
call "CBL_GC_NANOSLEEP" using "500" & "0000000" end-call
STOP RUN.
CHILD-CODE.
CALL "C$SLEEP" USING 1 END-CALL
DISPLAY "Hello, I am the child"
Chapter 7: System Routines 27
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.
Options:
-h, -help display this help and exit
-V, -version display compiler version and exit
-i, -info display compiler information (build/environment)
and exit
-v, -verbose display compiler version and the commands
invoked by the compiler
-vv, -verbose=2 like -v but additional pass verbose option
to assembler/compiler
-vvv, -verbose=3 like -vv but additional pass verbose option
to linker
-q, -brief reduced displays, commands invoked not shown
-### like -v but commands not executed
-x build an executable program
-m build a dynamically loadable module (default)
-j [<args>], -job[=<args>] run program after build, passing <args>
-std=<dialect> warnings/features for a specific dialect
<dialect> can be one of:
default, cobol2014, cobol2002, cobol85, xopen,
ibm-strict, ibm, mvs-strict, mvs,
mf-strict, mf, bs2000-strict, bs2000,
acu-strict, acu, rm-strict, rm;
see configuration files in directory config
-F, -free use free source format
-fixed use fixed source format (default)
-O, -O2, -O3, -Os enable optimization
-O0 disable optimization
-g enable C compiler debug / stack check / trace
-d, -debug enable all run-time error checking
-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
--tsymbols specify symbols in listing
-P[=<dir or file>] generate preprocessed program listing (.lst)
-Xref specify cross reference in listing
-I <directory> add <directory> to copy/include search path
-L <directory> add <directory> to library search path
-l <lib> link the library <lib>
-A <options> add <options> to the C compile phase
Appendix A: cobc --help 29
Warning options:
-W enable all warnings
-Wall enable most warnings (all except as noted below)
-Wno-<warning> disable warning enabled by -W or -Wall
-Wno-unfinished do not warn if unfinished features are used
- ALWAYS active
-Wno-pending do not warn if pending features are mentioned
- ALWAYS active
-Wobsolete warn if obsolete features are used
-Warchaic warn if archaic features are used
-Wredefinition warn incompatible redefinition of data items
-Wtruncate warn field truncation from constant assignments
-Wpossible-truncate warn possible field truncation
- NOT set with -Wall
-Woverlap warn overlapping MOVE items
-Wpossible-overlap warn MOVE items that may overlap depending on variables
- NOT set with -Wall
-Wparentheses warn lack of parentheses around AND within OR
-Wstrict-typing warn type mismatch strictly
-Wimplicit-define warn implicitly defined data items
-Wcorresponding warn CORRESPONDING with no matching items
-Winitial-value warn if initial VALUE clause is ignored
-Wprototypes warn missing FUNCTION prototypes/definitions
-Warithmetic-osvs warn if arithmetic expression precision has changed
-Wcall-params warn non 01/77 items for CALL params
- NOT set with -Wall
-Wconstant-expression warn expressions that always resolve to true/false
-Wcolumn-overflow warn text after program-text area, FIXED format
- NOT set with -Wall
-Wterminator warn lack of scope terminator END-XXX
- NOT set with -Wall
-Wlinkage warn dangling LINKAGE items
- NOT set with -Wall
-Wunreachable warn likely unreachable statements
- NOT set with -Wall
-Wno-dialect do not warn dialect specific issues
- ALWAYS active
-Wothers do not warn different issues
- ALWAYS active
-Werror treat all warnings as errors
Appendix A: cobc --help 30
Compiler options:
-fsign=[ASCII|EBCDIC] define display sign representation
- default: machine native
-ffold-copy=[UPPER|LOWER] fold COPY subject to value
- default: no transformation
-ffold-call=[UPPER|LOWER] fold PROGRAM-ID, CALL, CANCEL subject to value
- default: no transformation
-fdefaultbyte=<value> initialize fields without VALUE to value
- decimal 0..255 or any quoted character
- default: initialize to picture
-fmax-errors=<number> maximum number of errors to report before
compilation is aborted
- default: 100
-fdump=<scope> dump data fields on abort, <scope> may be
a combination of: ALL, WS, LS, RD, FD, SC
-fintrinsics=[ALL|intrinsic function name(,name,...)]
intrinsics to be used without FUNCTION keyword
B-NOT No
B-OR No
B-XOR No
BACKGROUND-COLOR Yes (Context sensitive) (aliased with BACKGROUND-COLOUR)
BACKGROUND-COLOUR Yes (aliased with BACKGROUND-COLOR)
BACKGROUND-HIGH Yes
BACKGROUND-LOW Yes
BACKGROUND-STANDARD Yes
BAR Yes (Context sensitive)
BASED Yes
BEEP Yes (aliased with BELL)
BEFORE Yes
BELL Yes (Context sensitive) (aliased with BEEP)
BINARY Yes
BINARY-C-LONG Yes
BINARY-CHAR Yes
BINARY-DOUBLE Yes (aliased with BINARY-LONG-LONG)
BINARY-INT Yes (aliased with BINARY-LONG)
BINARY-LONG Yes (aliased with BINARY-INT)
BINARY-LONG-LONG Yes (aliased with BINARY-DOUBLE)
BINARY-SEQUENTIAL Yes
BINARY-SHORT Yes
BIT No
BITMAP Yes (Context sensitive)
BITMAP-END Yes (Context sensitive)
BITMAP-HANDLE Yes (Context sensitive)
BITMAP-NUMBER Yes (Context sensitive)
BITMAP-START Yes (Context sensitive)
BITMAP-TIMER Yes (Context sensitive)
BITMAP-TRAILING Yes (Context sensitive)
BITMAP-TRANSPARENT-COLOR Yes (Context sensitive)
BITMAP-WIDTH Yes (Context sensitive)
BLANK Yes
BLINK Yes (Context sensitive)
BLOCK Yes
BOOLEAN No
BOTTOM Yes
BOX Yes
BOXED Yes
BUSY Yes (Context sensitive)
BUTTONS Yes (Context sensitive)
BY Yes
BYTE-LENGTH Yes (Context sensitive)
CALENDAR-FONT Yes (Context sensitive)
CALL Yes
CANCEL Yes
CANCEL-BUTTON Yes (Context sensitive)
CAPACITY Yes (Context sensitive)
CARD-PUNCH Yes (Context sensitive)
CARD-READER Yes (Context sensitive)
CASSETTE Yes (Context sensitive)
CCOL Yes (Context sensitive)
Appendix B: cobc --list-reserved 35
CD Yes
CELL Yes (Context sensitive) (aliased with CELLS)
CELL-COLOR Yes (Context sensitive)
CELL-DATA Yes (Context sensitive)
CELL-FONT Yes (Context sensitive)
CELL-PROTECTION Yes (Context sensitive)
CELLS Yes (aliased with CELL)
CENTER Yes (Context sensitive)
CENTERED-HEADINGS Yes (Context sensitive)
CENTURY-DATE Yes (Context sensitive)
CF Yes
CH Yes
CHAIN No
CHAINING Yes
CHARACTER Yes
CHARACTERS Yes
CHECK-BOX Yes (Context sensitive)
CLASS Yes
CLASS-ID No
CLASSIFICATION Yes (Context sensitive)
CLEAR-SELECTION Yes (Context sensitive)
CLINE Yes (Context sensitive)
CLINES Yes (Context sensitive)
CLOSE Yes
COBOL Yes (Context sensitive)
CODE Yes
CODE-SET Yes
COL Yes
COLLATING Yes
COLOR Yes
COLORS Yes (Context sensitive) (aliased with COLOURS)
COLOURS Yes (aliased with COLORS)
COLS Yes
COLUMN Yes
COLUMN-COLOR Yes (Context sensitive)
COLUMN-DIVIDERS Yes (Context sensitive)
COLUMN-FONT Yes (Context sensitive)
COLUMN-HEADINGS Yes (Context sensitive)
COLUMN-PROTECTION Yes (Context sensitive)
COLUMNS Yes
COMBO-BOX Yes (Context sensitive)
COMMA Yes
COMMAND-LINE Yes
COMMIT Yes
COMMON Yes
COMMUNICATION Yes
COMP Yes (aliased with COMPUTATIONAL)
COMP-1 Yes (aliased with COMPUTATIONAL-1)
COMP-2 Yes (aliased with COMPUTATIONAL-2)
COMP-3 Yes (aliased with COMPUTATIONAL-3)
COMP-4 Yes (aliased with COMPUTATIONAL-4)
COMP-5 Yes (aliased with COMPUTATIONAL-5)
Appendix B: cobc --list-reserved 36
DEFAULT Yes
DEFAULT-BUTTON Yes (Context sensitive)
DEFAULT-FONT Yes
DELETE Yes
DELIMITED Yes
DELIMITER Yes
DEPENDING Yes
DESCENDING Yes
DESTINATION Yes
DESTROY Yes
DETAIL Yes
DISABLE Yes
DISC Yes (Context sensitive)
DISK Yes (Context sensitive)
DISPLAY Yes
DISPLAY-COLUMNS Yes (Context sensitive)
DISPLAY-FORMAT Yes (Context sensitive)
DIVIDE Yes
DIVIDER-COLOR Yes (Context sensitive)
DIVIDERS Yes (Context sensitive)
DIVISION Yes
DOTDASH Yes (Context sensitive)
DOTTED Yes (Context sensitive)
DOUBLE Yes (aliased with FLOAT-LONG)
DOWN Yes
DRAG-COLOR Yes (Context sensitive)
DROP-DOWN Yes (Context sensitive)
DROP-LIST Yes (Context sensitive)
DUPLICATES Yes
DYNAMIC Yes
EBCDIC Yes (Context sensitive)
EC Yes
ECHO Yes
EGI Yes
ELSE Yes
EMI Yes
EMPTY-CHECK Yes (aliased with REQUIRED)
ENABLE Yes
END Yes
END-ACCEPT Yes
END-ADD Yes
END-CALL Yes
END-CHAIN No
END-COLOR Yes (Context sensitive)
END-COMPUTE Yes
END-DELETE Yes
END-DISPLAY Yes
END-DIVIDE Yes
END-EVALUATE Yes
END-IF Yes
END-MODIFY Yes (Context sensitive)
END-MULTIPLY Yes
Appendix B: cobc --list-reserved 38
FILE-ID Yes
FILE-NAME Yes (Context sensitive)
FILE-POS Yes (Context sensitive)
FILL-COLOR Yes (Context sensitive)
FILL-COLOR2 Yes (Context sensitive)
FILL-PERCENT Yes (Context sensitive)
FILLER Yes
FINAL Yes
FINISH-REASON Yes (Context sensitive)
FIRST Yes
FIXED Yes
FIXED-FONT Yes
FIXED-WIDTH Yes (Context sensitive)
FLAT Yes (Context sensitive)
FLAT-BUTTONS Yes (Context sensitive)
FLOAT Yes (aliased with 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 (aliased with DOUBLE)
FLOAT-NOT-A-NUMBER No (Context sensitive)
FLOAT-SHORT Yes (aliased with FLOAT)
FLOATING Yes
FONT Yes
FOOTING Yes
FOR Yes
FOREGROUND-COLOR Yes (Context sensitive) (aliased with FOREGROUND-COLOUR)
FOREGROUND-COLOUR Yes (aliased with FOREGROUND-COLOR)
FOREVER Yes (Context sensitive)
FORMAT No
FRAME Yes (Context sensitive)
FRAMED Yes (Context sensitive)
FREE Yes
FROM Yes
FULL Yes (Context sensitive) (aliased with LENGTH-CHECK)
FULL-HEIGHT Yes (Context sensitive)
FUNCTION Yes
FUNCTION-ID Yes
FUNCTION-POINTER No
GENERATE Yes
GET No
GIVING Yes
GLOBAL Yes
GO Yes
GO-BACK Yes (Context sensitive)
GO-FORWARD Yes (Context sensitive)
GO-HOME Yes (Context sensitive)
GO-SEARCH Yes (Context sensitive)
Appendix B: cobc --list-reserved 40
GOBACK Yes
GRAPHICAL Yes
GREATER Yes
GRID Yes (Context sensitive)
GROUP Yes
GROUP-USAGE No
GROUP-VALUE Yes (Context sensitive)
HANDLE Yes
HAS-CHILDREN Yes (Context sensitive)
HEADING Yes
HEADING-COLOR Yes (Context sensitive)
HEADING-DIVIDER-COLOR Yes (Context sensitive)
HEADING-FONT Yes (Context sensitive)
HEAVY Yes (Context sensitive)
HEIGHT-IN-CELLS Yes (Context sensitive)
HIDDEN-DATA Yes (Context sensitive)
HIGH-COLOR Yes (Context sensitive)
HIGH-VALUE Yes (aliased with HIGH-VALUES)
HIGH-VALUES Yes (aliased with HIGH-VALUE)
HIGHLIGHT Yes (Context sensitive)
HOT-TRACK Yes (Context sensitive)
HSCROLL Yes (Context sensitive)
HSCROLL-POS Yes (Context sensitive)
I-O Yes
I-O-CONTROL Yes
ICON Yes
ID Yes
IDENTIFICATION Yes
IDENTIFIED Yes
IF Yes
IGNORE Yes
IGNORING Yes (Context sensitive)
IMPLEMENTS No (Context sensitive)
IN Yes
INDEPENDENT Yes
INDEX Yes
INDEXED Yes
INDICATE Yes
INHERITS No
INITIAL Yes
INITIALISE Yes (aliased with INITIALIZE)
INITIALISED Yes (aliased with INITIALIZED)
INITIALIZE Yes (aliased with INITIALISE)
INITIALIZED Yes (aliased with INITIALISED)
INITIATE Yes
INPUT Yes
INPUT-OUTPUT Yes
INQUIRE Yes
INSERT-ROWS Yes (Context sensitive)
INSERTION-INDEX Yes (Context sensitive)
INSPECT Yes
INTERFACE No
Appendix B: cobc --list-reserved 41
INTERFACE-ID No
INTERMEDIATE Yes (Context sensitive)
INTO Yes
INTRINSIC Yes (Context sensitive)
INVALID Yes
INVOKE No
IS Yes
ITEM Yes (Context sensitive)
ITEM-TEXT Yes (Context sensitive)
ITEM-TO-ADD Yes (Context sensitive)
ITEM-TO-DELETE Yes (Context sensitive)
ITEM-TO-EMPTY Yes (Context sensitive)
ITEM-VALUE Yes (Context sensitive)
JUST Yes (aliased with JUSTIFIED)
JUSTIFIED Yes (aliased with JUST)
KEPT Yes
KEY Yes
KEYBOARD Yes (Context sensitive)
LABEL Yes
LABEL-OFFSET Yes (Context sensitive)
LARGE-FONT Yes
LARGE-OFFSET Yes (Context sensitive)
LAST Yes
LAST-ROW Yes (Context sensitive)
LAYOUT-DATA Yes (Context sensitive)
LAYOUT-MANAGER Yes
LC_ALL No (Context sensitive)
LC_COLLATE No (Context sensitive)
LC_CTYPE No (Context sensitive)
LC_MESSAGES No (Context sensitive)
LC_MONETARY No (Context sensitive)
LC_NUMERIC No (Context sensitive)
LC_TIME No (Context sensitive)
LEADING Yes
LEADING-SHIFT Yes (Context sensitive)
LEFT Yes
LEFT-JUSTIFY No
LEFT-TEXT Yes (Context sensitive)
LEFTLINE Yes
LENGTH Yes
LENGTH-CHECK Yes (aliased with FULL)
LESS Yes
LIMIT Yes
LIMITS Yes
LINAGE Yes
LINAGE-COUNTER Yes
LINE Yes
LINE-COUNTER Yes
LINE-SEQUENTIAL Yes
LINES Yes
LINES-AT-ROOT Yes (Context sensitive)
LINKAGE Yes
Appendix B: cobc --list-reserved 42
PAGE-COUNTER Yes
PAGE-SETUP Yes (Context sensitive)
PAGED Yes (Context sensitive)
PARAGRAPH Yes (Context sensitive)
PARENT Yes (Context sensitive)
PASSWORD Yes (Context sensitive)
PERFORM Yes
PERMANENT Yes (Context sensitive)
PF Yes
PH Yes
PHYSICAL Yes
PIC Yes (aliased with PICTURE)
PICTURE Yes (aliased with PIC)
PIXEL Yes (Context sensitive) (aliased with PIXELS)
PIXELS Yes (aliased with PIXEL)
PLACEMENT Yes (Context sensitive)
PLUS Yes
POINTER Yes
POP-UP Yes
POSITION Yes
POSITION-SHIFT Yes (Context sensitive)
POSITIVE Yes
PREFIXED No (Context sensitive)
PRESENT Yes
PREVIOUS Yes
PRINT Yes (Context sensitive)
PRINT-NO-PROMPT Yes (Context sensitive)
PRINT-PREVIEW Yes (Context sensitive)
PRINTER Yes (Context sensitive)
PRINTER-1 Yes (Context sensitive)
PRINTING Yes
PRIORITY Yes
PROCEDURE Yes
PROCEDURE-POINTER Yes (aliased with PROGRAM-POINTER)
PROCEDURES Yes
PROCEED Yes
PROGRAM Yes
PROGRAM-ID Yes
PROGRAM-POINTER Yes (aliased with PROCEDURE-POINTER)
PROGRESS Yes (Context sensitive)
PROHIBITED Yes (Context sensitive)
PROMPT Yes
PROPERTIES Yes (Context sensitive)
PROPERTY Yes
PROTECTED Yes
PROTOTYPE No
PURGE Yes
PUSH-BUTTON Yes (Context sensitive)
QUERY-INDEX Yes (Context sensitive)
QUEUE Yes
QUOTE Yes (aliased with QUOTES)
QUOTES Yes (aliased with QUOTE)
Appendix B: cobc --list-reserved 45
SIGNED-LONG Yes
SIGNED-SHORT Yes
SIZE Yes
SMALL-FONT Yes
SORT Yes
SORT-MERGE Yes
SORT-ORDER Yes (Context sensitive)
SOURCE Yes
SOURCE-COMPUTER Yes
SOURCES No
SPACE Yes (aliased with SPACES)
SPACE-FILL No
SPACES Yes (aliased with SPACE)
SPECIAL-NAMES Yes
SPINNER Yes (Context sensitive)
SQUARE Yes (Context sensitive)
STANDARD Yes
STANDARD-1 Yes
STANDARD-2 Yes
STANDARD-BINARY Yes (Context sensitive)
STANDARD-DECIMAL Yes (Context sensitive)
START Yes
START-X Yes (Context sensitive)
START-Y Yes (Context sensitive)
STATEMENT No (Context sensitive)
STATIC Yes (Context sensitive)
STATIC-LIST Yes (Context sensitive)
STATUS Yes
STATUS-BAR Yes (Context sensitive)
STATUS-TEXT Yes (Context sensitive)
STDCALL Yes (Context sensitive)
STEP Yes
STOP Yes
STRING Yes
STRONG No (Context sensitive)
STYLE Yes (Context sensitive)
SUB-QUEUE-1 Yes
SUB-QUEUE-2 Yes
SUB-QUEUE-3 Yes
SUBTRACT Yes
SUBWINDOW Yes
SUM Yes
SUPER No
SUPPRESS Yes
SYMBOL No (Context sensitive)
SYMBOLIC Yes
SYNC Yes (aliased with SYNCHRONISED, SYNCHRONIZED)
SYNCHRONISED Yes (aliased with SYNC, SYNCHRONIZED)
SYNCHRONIZED Yes (aliased with SYNC, SYNCHRONISED)
SYSTEM-DEFAULT Yes
SYSTEM-OFFSET Yes
TAB Yes (Context sensitive)
Appendix B: cobc --list-reserved 48
UNSTRING Yes
UNTIL Yes
UP Yes
UPDATE Yes
UPON Yes
UPPER Yes (Context sensitive)
USAGE Yes
USE Yes
USE-ALT Yes (Context sensitive)
USE-RETURN Yes (Context sensitive)
USE-TAB Yes (Context sensitive)
USER Yes (Context sensitive)
USER-DEFAULT Yes
USING Yes
UTF-16 No (Context sensitive)
UTF-8 No (Context sensitive)
V Yes
VAL-STATUS No
VALID No
VALIDATE Yes
VALIDATE-STATUS No
VALUE Yes (aliased with VALUES)
VALUE-FORMAT Yes (Context sensitive)
VALUES Yes (aliased with VALUE)
VARIABLE Yes
VARIANT Yes
VARYING Yes
VERTICAL Yes (Context sensitive)
VERY-HEAVY Yes (Context sensitive)
VIRTUAL-WIDTH Yes (Context sensitive)
VPADDING Yes (Context sensitive)
VSCROLL Yes (Context sensitive)
VSCROLL-BAR Yes (Context sensitive)
VSCROLL-POS Yes (Context sensitive)
VTOP Yes (Context sensitive)
WAIT Yes
WEB-BROWSER Yes (Context sensitive)
WHEN Yes
WIDTH Yes (Context sensitive)
WIDTH-IN-CELLS Yes (Context sensitive)
WINDOW Yes
WITH Yes
WORDS Yes
WORKING-STORAGE Yes
WRAP Yes (Context sensitive)
WRITE Yes
X Yes (Context sensitive)
Y Yes (Context sensitive)
YYYYDDD Yes (Context sensitive)
YYYYMMDD Yes (Context sensitive)
ZERO Yes (aliased with ZEROES, ZEROS)
ZERO-FILL No (Context sensitive)
50
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-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 - 2
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 - 1
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 - 4
STANDARD-DEVIATION Yes Unlimited
STORED-CHAR-LENGTH Yes 1
SUBSTITUTE Yes Unlimited
SUBSTITUTE-CASE Yes Unlimited
SUM Yes Unlimited
TAN Yes 1
TEST-DATE-YYYYMMDD Yes 1
TEST-DAY-YYYYDDD Yes 1
TEST-FORMATTED-DATETIME Yes 2
TEST-NUMVAL Yes 1
TEST-NUMVAL-C Yes 2
TEST-NUMVAL-F Yes 1
TRIM Yes 1 - 2
53
UPPER-CASE Yes 1
VARIANCE Yes Unlimited
WHEN-COMPILED Yes 0
YEAR-TO-YYYY Yes 1 - 3
54
SYSTEM 1
CBL_AND 3
CBL_CHANGE_DIR 1
CBL_CHECK_FILE_EXIST 2
CBL_CLOSE_FILE 1
CBL_COPY_FILE 2
CBL_CREATE_DIR 1
CBL_CREATE_FILE 5
CBL_DELETE_DIR 1
CBL_DELETE_FILE 1
CBL_EQ 3
CBL_ERROR_PROC 2
CBL_EXIT_PROC 2
CBL_FLUSH_FILE 1
CBL_GET_CSR_POS 1
CBL_GET_CURRENT_DIR 3
CBL_GET_SCR_SIZE 2
CBL_IMP 3
CBL_NIMP 3
CBL_NOR 3
CBL_NOT 2
CBL_OPEN_FILE 5
CBL_OR 3
CBL_READ_FILE 5
CBL_READ_KBD_CHAR 1
CBL_RENAME_FILE 2
CBL_SET_CSR_POS 1
CBL_TOLOWER 2
CBL_TOUPPER 2
CBL_WRITE_FILE 5
CBL_XOR 3
CBL_GC_FORK 0
CBL_GC_GETOPT 6
CBL_GC_HOSTED 2
CBL_GC_NANOSLEEP 1
CBL_GC_PRINTABLE 1 - 2
CBL_GC_WAITPID 1
CBL_OC_GETOPT 6
CBL_OC_HOSTED 2
CBL_OC_NANOSLEEP 1
C$CALLEDBY 1
C$CHDIR 2
C$COPY 3
C$DELETE 2
C$FILEINFO 2
C$GETPID 0
55
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
X"91" 2
X"E4" 0
X"E5" 0
X"F4" 2
X"F5" 2
56
System names
SYSIN device name
SYSIPT device name
STDIN device name
SYSOUT device name
SYSLIST device name
SYSLST device name
STDOUT device name
PRINT device name
PRINTER device name
PRINTER-1 device name
SYSERR device name
STDERR device name
CONSOLE device name
C01 feature name
C02 feature name
C03 feature name
C04 feature name
C05 feature name
C06 feature name
C07 feature name
C08 feature name
C09 feature name
C10 feature name
C11 feature name
C12 feature name
CSP feature name
FORMFEED feature name
CALL-CONVENTION feature name
SWITCH-0 switch name
SWITCH-1 switch name
SWITCH-2 switch name
SWITCH-3 switch name
SWITCH-4 switch name
SWITCH-5 switch name
SWITCH-6 switch name
SWITCH-7 switch name
SWITCH-8 switch name
SWITCH-9 switch name
SWITCH-10 switch name
SWITCH-11 switch name
SWITCH-12 switch name
SWITCH-13 switch name
SWITCH-14 switch name
SWITCH-15 switch name
SWITCH-16 switch name
SWITCH-17 switch name
SWITCH-18 switch name
SWITCH-19 switch name
57
# Value: enum
standard-define 0
# CB_STD_OC = 0,
# CB_STD_MF,
# CB_STD_IBM,
# CB_STD_MVS,
# CB_STD_BS2000,
# CB_STD_ACU,
# 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 61)
word-length: 61
# 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.
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
Appendix F: Compiler Configuration 61
# Dialect features
# Value: ’ok’, ’warning’, ’archaic’, ’obsolete’, ’skip’, ’ignore’, ’error’,
# ’unconformable’
alter-statement: obsolete
comment-paragraphs: obsolete
call-overflow: archaic
data-records-clause: obsolete
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
synchronized-clause: ok
top-level-occurs-clause: ok
value-of-clause: obsolete
numeric-boolean: ok
hexadecimal-boolean: ok
national-literals: ok
hexadecimal-national-literals: ok
acu-literals: unconformable
word-continuation: warning
not-exception-before-exception: ok
accept-display-extensions: ok
renames-uncommon-levels: ok
constant-78: ok
constant-01: ok
perform-varying-without-by: ok
program-prototypes: ok
reference-out-of-declaratives: warning
numeric-value-for-edited-item: ok
62
incorrect-conf-sec-order: ok
define-constant-directive: archaic
free-redefines-position: warning
record-delimiter: ok
sequential-delimiters: ok
record-delim-with-fixed-recs: ok
missing-statement: error
# 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
# 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: VALUES=VALUE
reserved: ZEROES=ZERO
reserved: ZEROS=ZERO
63
Options:
-h, -help display this help and exit
-V, -version display cobcrun and runtime version and exit
-i, -info display runtime information (build/environment)
-c <file>, -config=<file> set runtime configuration from <file>
-r, -runtime-config display current runtime configuration
(value and origin for all settings)
-M <module>, -module=<module> set entry point module name and/or load path
where -M module prepends any directory to the
dynamic link loader library search path
and any basename to the module preload list
(COB_LIBRARY_PATH and/or COB_PRELOAD)
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 I: GNU Free Documentation License 74
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 I: GNU Free Documentation License 75
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 I: GNU Free Documentation License 76
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 http://
www.gnu.org/copyleft/.
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 I: GNU Free Documentation License 77
Index
A F
ACCEPT special keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Figurative Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Arrow keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
AUTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
AUTO-SKIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 H
Home keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
B
Backspace key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
I
BELL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Indexed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
BLANK LINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Indexed file packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
BLANK SCREEN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Insert key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Invoking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
C N
Copying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Non-standard extensions . . . . . . . . . . . . . . . . . . . . . . . . . . 18
D P
Delete keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 PROTECTED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
S
E SELECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
End keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 SELECT ASSIGN TO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
ERASE EOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18, 20
ERASE EOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Extended ACCEPT statement . . . . . . . . . . . . . . . . . . . . . . 18
Extended DISPLAY statement . . . . . . . . . . . . . . . . . . . . . 20 T
Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Tab keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19