Compilers and Dialects

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

The reference material consulted while preparing these pages is listed in the section bibliography.

This page is written against ISO/IEC 1989:2023 (edition 3, January 2023; an upcoming 4th edition is in its DIS ballot), GnuCOBOL 3.2 (28 July 2023, still the latest release) and IBM Enterprise COBOL for z/OS 6.5 (generally available 13 June 2025, with PTFs through September 2026), and was checked on 2026-10-20. Every GnuCOBOL example below was compiled with cobc 3.2.0 in a container and run, and the output and diagnostics shown are the real ones. Nothing was run on z/OS, with Rocket Visual COBOL or with Fujitsu NetCOBOL; statements about those products come from the vendor pages listed under References and are worded accordingly.

COBOL is one language with many dialects. The ISO standard defines a core, every vendor adds extensions, and an old program is written for the compiler its shop used. This page names the compilers that matter, explains the GnuCOBOL -std= switch and the configuration files behind it (the tool that lets one free compiler imitate several others), compares what each compiler supports, and ends with the conventions that the examples in the rest of this guide follow. The history of the standard itself is in History and Standards; installing and running cobc is in Getting Started.

The compilers at a glance

Compiler What it is Role in this guide

IBM Enterprise COBOL for z/OS 6.5 (6.3 and 6.4 are still met in the field)

The mainframe compiler. "COBOL 85 plus IBM extensions" with a large part of the 2002 and 2014 standards on top. 6.5 was generally available on 13 June 2025; its documentation set is SS6SG3_6.5.

The reference for all z/OS pages: JCL, Db2, CICS, IMS, Language Environment. Code that needs it is labelled "z/OS; not run here".

IBM COBOL for Linux on x86 1.2

IBM’s COBOL compiler for Linux on x86, with 64-bit application development; its documentation library was last updated on 25 May 2026.

Mentioned for completeness; not installed or tested here.

GnuCOBOL 3.2

Free (GPL) compiler that translates COBOL to C and then calls the C compiler. 3.2 was released on 28 July 2023 and is the latest release.

Compiles and runs every portable example in this guide.

Rocket Visual COBOL and Enterprise Developer (formerly Micro Focus)

Commercial compilers and mainframe-development tools for Windows, Linux and UNIX. Rocket Software took over the Micro Focus application-modernization portfolio; Visual COBOL 11.0 was announced on 23 October 2025.

Not tested. GnuCOBOL’s mf dialect imitates the Micro Focus language.

Fujitsu NetCOBOL (Windows, sold in the West by Adaptigent)

Commercial compiler with a project manager, debugger and Eclipse plug-in, 32-bit and 64-bit applications, and no runtime licence fees.

Not tested.

The Linux x86 and GnuCOBOL compilers are not IBM’s mainframe compiler. A program that compiles with cobc -std=ibm has a good chance of compiling on z/OS, but only the real compiler decides; the section on Conventions the examples follow says how this guide handles that gap.

IBM Enterprise COBOL for z/OS

Enterprise COBOL 6.x is the compiler behind everything on the mainframe pages. Its language grew by release, and the current facts are collected in What’s New in COBOL:

  • the base 6.5 release added TYPEDEF/TYPE, the :: qualification, VSAMDB, ARCH(15)/TUNE(15) for the z17 and the OMITTED class test;

  • PTFs through September 2026 added UTF-8 numeric moves (PH69556), the ADATA suboptions EMBEDDED and SEPARATE together with IBM Semeru Java 25 support (PH70635), cob2 and z/OS UNIX enhancements (PH72005), STRONG typedefs (PH73209), the PUSH and POP directives (PH73031) and DYNAM together with CICS (PH73033);

  • 6.4 and 6.3 added Java interoperability outside OO COBOL, FUNCTION-ID user-defined functions, USAGE UTF-8, DYNAMIC LENGTH, PERFORM UNTIL EXIT and other items that the later pages place in context.

IBM keeps a table of the 2002 and 2014 standard features that Enterprise COBOL 3 and later implement (the Language Reference appendix "2002/2014 COBOL Standard features implemented in Enterprise COBOL 3 or later versions"). It is the authoritative answer to "does IBM do feature X from the standard", and the feature-support table below is built from it. Two entries of that table are worth knowing before reading on: Report Writer features are supported through an optional Report Writer precompiler, not by the compiler itself, and user-defined types (TYPEDEF and TYPE) are implemented. IBM’s documentation library page lists the manuals for 6.5 back to 3.1 and says that for versions that are no longer supported only the PDFs remain available, so check IBM’s lifecycle pages before planning around 6.3 or 6.4.

GnuCOBOL 3.2

GnuCOBOL (formerly OpenCOBOL) is a source-to-C translator: cobc turns the COBOL into C and a C compiler (here gcc) builds the executable or module. Besides its own default dialect it can imitate the COBOL 85, X/Open, 2002 and 2014 standards and eight vendor compilers through the -std= option, described next. Version 3.2 added the gcos dialect, more -fformat source formats, STOP ERROR, --coverage, LINE SEQUENTIAL OPEN I-O and REWRITE, the COBOL-WORDS directive and experimental UTF-8 and FLOAT-EXTENDED support. Packaging differs by platform: Homebrew’s gnucobol is 3.2, Debian’s gnucobol3 package is 3.2 on trixie and 3.1.2 on bookworm, and the Debian gnucobol4 package is a 2020 snapshot that should not be used.

Rocket and Fujitsu

Rocket Visual COBOL and Enterprise Developer are the successors of the Micro Focus products; the old Micro Focus documentation index has been replaced by Rocket’s documentation portal. Their dialect is the one GnuCOBOL calls mf. Fujitsu NetCOBOL for Windows, per the distributor’s page, is ANSI COBOL compliant with compatibility for VS COBOL II, OS/VS COBOL and Micro Focus, embedded SQL through ODBC and Oracle, COBOL-to-XML conversion, Unicode and multi-threading; GnuCOBOL has no fujitsu dialect, so NetCOBOL programs are ported by hand. Version numbers of both products are deliberately not pinned on this page because their documentation could not be checked in full on 2026-10-20.

GnuCOBOL dialects: the -std= option

cobc -std=<dialect> selects a bundle of settings: which reserved words exist, which extensions are accepted, how strictly the source is checked and dozens of behaviour switches (for example whether binary items are truncated to their PICTURE size). Each bundle is a text file in the config directory of the installation (cobc --info prints it as COB_CONFIG_DIR; in the test container it is /usr/local/share/gnucobol/config). The dialect name is the file name without .conf, which is also why a name that does not exist is reported as a missing configuration file:

$ cobc -fsyntax-only -std=bogus areaa.cob
configuration error:
/usr/local/share/gnucobol/config/bogus.conf: No such file or directory

The dialects and what they imitate

cobc --help lists the dialects below, apart from realia, which is documented in the manual and is accepted (the file realia.conf exists and a program compiled with -std=realia is checked against it) but is missing from the help text of 3.2. The name: column is the first setting of each file, which is what the compiler calls the dialect.

-std= value name: in the file What it is for

default

GnuCOBOL

GnuCOBOL’s own dialect: many 2002 and 2014 features, many extensions from other dialects and its own features. Used when no -std is given. 944 reserved words.

cobol85

COBOL 85

COBOL 85 with only the 1989 intrinsic-function amendment. Always strict. 350 reserved words.

cobol2002, cobol2014

COBOL 2002, COBOL 2014

The two standards without vendor extensions. Always strict; use -Warchaic and -Wobsolete to flag old features. 449 and 437 reserved words.

xopen

X/Open COBOL

X/Open COBOL (based on COBOL 85); warns about items that a conforming X/Open program should not use.

ibm-strict, ibm

IBM COBOL, IBM COBOL (lax)

Compatible with IBM’s COBOL. 430 and 934 reserved words.

mvs-strict, mvs

IBM COBOL for MVS & VM, MVS/VM COBOL (lax)

The older IBM MVS and VM compiler.

mf-strict, mf

Micro Focus COBOL, Micro Focus COBOL (lax)

Micro Focus (now Rocket) COBOL.

bs2000-strict, bs2000

BS2000 COBOL, BS2000 COBOL (lax)

The COBOL compiler of the BS2000 mainframe operating system (not NetCOBOL).

acu-strict, acu

ACUCOBOL-GT, ACUCOBOL-GT (lax)

ACUCOBOL-GT.

rm-strict, rm

RM-COBOL, RM-COBOL (lax)

RM/COBOL.

realia-strict, realia

CA Realia II, CA Realia II (lax)

CA Realia II.

gcos-strict, gcos

GCOS, GCOS (lax)

The GCOS compiler; new in GnuCOBOL 3.2.

The reserved-word counts come from cobc -std=<dialect> --list-reserved | grep -c ' Yes' and are a measure of how large each language is, not a promise about any vendor’s list. The range, 350 words for COBOL 85 against 944 for the GnuCOBOL default, is why a program written for one dialect can fail in another merely because it uses a data name that is reserved in the second: -fnot-reserved=<word> removes one offending word from the list (the option is repeated for each word), and -freserved-words=<value> takes the complete reserved-word list from a different dialect than the one in -std. (The 3.2 manual spells the first option -fno-reserved; cobc --help and the compiler itself accept only -fnot-reserved.)

Strict versus lax

The -strict variants try to limit both the feature set and the reserved words to the named compiler, so that a source that compiles with cobc -std=ibm-strict is likely to compile with IBM’s compiler, and the reverse. The plain names (ibm, mf, …​) are the lax versions: they switch on the complete GnuCOBOL feature set wherever it does not conflict with the dialect, including its reserved words, so the program may then work only with GnuCOBOL. COBOL 85, X/Open, COBOL 2002 and COBOL 2014 have no lax versions.

The files make this concrete. ibm.conf is four lines long: it includes the strict file, renames the dialect, adds the extra word list ibm.words and includes lax.conf-inc, which relaxes a long list of settings (it lifts the word, literal and PICTURE length limits to GnuCOBOL’s, accepts the TYPE, SAME AS and USAGE type clauses and the level numbers 01 and 78 constants, relaxes the level-hierarchy checks, and so on). The substance is in ibm-strict.conf:

include "ibm-strict.conf"

name: "IBM COBOL (lax)"
include:  "ibm.words"
include "lax.conf-inc"

Some settings of the IBM and the GnuCOBOL default files, as printed in the 3.2 distribution, show what a dialect changes in practice:

Setting (file .conf) default ibm-strict / ibm Meaning

binary-truncate

yes

no

Whether a binary item is truncated to the digits of its PICTURE after arithmetic.

word-length

63

30

Longest user-defined word.

pic-length

255

50

Longest PICTURE string.

numeric-literal-length

38

31

Longest numeric literal.

literal-length

8191

160

Longest alphanumeric literal.

binary-size

1-2-4-8

2-4-8

Storage sizes allowed for BINARY items (bytes).

pretty-display

yes

no

Whether DISPLAY of a numeric item prints the decimal point.

format

auto (fixed unless told otherwise)

cobol85

Source format.

areacheck

no

yes

Whether Area A is enforced.

record-delimiter

ok

ignore

Treatment of the RECORD DELIMITER clause.

defaultbyte

init

0

Initial value of storage with no VALUE: init is "initialize to the VALUE or the type default", 0 is zero bytes.

screen-section-rules

gc

std

Which rules apply to SCREEN SECTION clauses.

The first row has a visible effect on every program that counts, so it is worth running.

Same source, different dialect: binary truncation

WS-COPIES is a three-digit binary counter, like the number of copies of a book. The program adds one to 999. Whether the result is 000 or 1000 is exactly the difference between a binary field that is truncated to its PICTURE and one that is not.

       IDENTIFICATION DIVISION.
       PROGRAM-ID. TRUNCDEMO.
      * Same source, different dialect: what happens when a binary
      * copy counter (PIC 9(3)) is incremented past 999?
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-COPIES               PIC 9(3) BINARY VALUE 999.
       01  WS-SHOW                 PIC 9(5).
       PROCEDURE DIVISION.
       MAIN-PARA.
           ADD 1 TO WS-COPIES
           MOVE WS-COPIES TO WS-SHOW
           DISPLAY "COPIES=" WS-SHOW
           STOP RUN.

Compiled with cobc -x -Wall and different dialect options (no warnings were printed by any of the four compiles):

--- cobc -x -Wall  trunc.cob
COPIES=00000
--- cobc -x -Wall -std=ibm trunc.cob
COPIES=01000
--- cobc -x -Wall -std=ibm-strict trunc.cob
COPIES=01000
--- cobc -x -Wall -fno-trunc trunc.cob
COPIES=01000

The default dialect truncates to the PICTURE (binary-truncate: yes), the IBM dialects do not (binary-truncate: no), and -fno-trunc ("allow numeric field overflow" in cobc --help) switches off the truncation without changing anything else. This is not a claim about what Enterprise COBOL does with the same source: on z/OS the result depends on the TRUNC compiler option, whose default (TRUNC(STD)) truncates, so -std=ibm is a close imitation of the IBM language but not of every IBM option. The full treatment of TRUNC, COMP, COMP-5 and the hardware sizes is in USAGE and Numeric Representation.

Writing a dialect of your own: --conf

A shop that wants "the default dialect, but with IBM’s binary behaviour" does not need to edit the installed files. cobc --conf=<file> reads a user-defined configuration; the file may include any installed one by name and override single settings after it:

# circ.conf - site dialect: the GnuCOBOL default, but binary items
# are not truncated to their PICTURE size (like -std=ibm).
include "default.conf"
name: "Circulation shop"
binary-truncate: no

With the same source as above:

--- cobc -x -Wall --conf=circ.conf trunc.cob
COPIES=01000

The GnuCOBOL manual writes the option as -conf=; cobc --help in 3.2 prints --conf=<file>, and that is the form that was run here. The same page also says that any single configuration option can be given as its own -f flag, which is how -fno-trunc and -fformat= work.

Source formats: -fformat

The reference format (columns, indicator area, free form) is a configuration value too, and -fformat= or the >>SOURCE FORMAT directive selects it. 3.2 accepts nine values; -fixed and -free (alias -F) are shorthands for the first two. The details of fixed and free format are in Reference Format: Fixed and Free.

-fformat= value Format

fixed

The default: columns 1-6 sequence area, column 7 indicator, columns 8-72 program text, columns 73-80 ignored.

free

Free format: text may start in column 1 and runs to the end of the line (effectively 255 characters).

cobol85

Fixed format with enforcement of Area A.

variable

Micro Focus Variable format: like fixed, but the program-text area extends to column 250.

xopen

X/Open free form: text may start in column 1 unless an indicator is present; lines of up to 80 characters.

xcard

ICOBOL xCard: Variable format with the right margin at column 255.

crt

ICOBOL free form (CRT): similar to X/Open, lines of up to 320 characters.

terminal

ACUCOBOL-GT Terminal format: like CRT, with \D as the debugging-line indicator; mostly compatible with VAX COBOL terminal format.

cobolx

COBOLX: like CRT, but the indicator area is always column 1 and program text starts in column 2.

An unknown value is rejected by the compiler (-fformat=bogus and -fformat=gcos both print "invalid value …​ for configuration tag 'format'"). The IBM dialects set format: cobol85, which is why a paragraph name written in Area B is not just style, as the next example shows.

A pitfall the dialect makes visible: Area A

This deliberately wrong program starts the paragraph name MAIN-PARA in column 12 (Area B). The default dialect does not mind; the IBM dialects check the Area A rule that mainframe programmers are used to.

       IDENTIFICATION DIVISION.
       PROGRAM-ID. AREADEMO.
       PROCEDURE DIVISION.
           MAIN-PARA.
               DISPLAY "CIRCULATION"
               STOP RUN.
--- cobc -x -Wall  areaa.cob
CIRCULATION
--- cobc -x -Wall -std=ibm areaa.cob
areaa.cob:4: warning: 'MAIN-PARA' should start in Area A [-Wothers]
    2 |        PROGRAM-ID. AREADEMO.
    3 |        PROCEDURE DIVISION.
    4 >            MAIN-PARA.
    5 |                DISPLAY "CIRCULATION"
    6 |                STOP RUN.
CIRCULATION
--- cobc -x -Wall -std=ibm-strict areaa.cob
areaa.cob:4: error: 'MAIN-PARA' should start in Area A
    2 |        PROGRAM-ID. AREADEMO.
    3 |        PROCEDURE DIVISION.
    4 >            MAIN-PARA.
    5 |                DISPLAY "CIRCULATION"
    6 |                STOP RUN.

Lax dialects turn many of the strict dialect’s errors into warnings, and a warning can be silenced with -w or -Wno-others; the strict dialect stops. Compiling with -std=ibm and -Wall and fixing every message is the cheapest way to move a GnuCOBOL program toward the mainframe.

What each compiler supports

The table answers the question "can I use this standard feature here". The GnuCOBOL column was checked by compiling a small program for each row with cobc 3.2.0 (and running it where it can run without a terminal); the Enterprise COBOL column comes from IBM’s list of implemented 2002/2014 features and the 6.5 release notes. Rocket and Fujitsu columns are left out on purpose: their documentation could not be read in full here, and an unverified "yes" is worse than a link to the vendor manual.

Feature Standard GnuCOBOL 3.2 Enterprise COBOL for z/OS 6.5 Details

Report Writer

COBOL 85 option, integrated into the standard by 2002

Supported. A program with REPORT SECTION, INITIATE, GENERATE and TERMINATE compiled and ran with no warnings in every dialect tried.

Supported only through the optional Report Writer precompiler, not by the compiler itself.

Reports and Report Writer

Object orientation (CLASS-ID)

2002

Not supported: CLASS-ID is "a reserved word, but isn’t supported" and the compile stops with a syntax error expecting FUNCTION-ID or PROGRAM-ID.

Supported (Java-based OO COBOL), listed in IBM’s table of implemented 2002/2014 features.

Object-Oriented COBOL

JSON GENERATE

IBM statement; not in IBM’s list of 2002/2014 features

Supported in 3.2: JSON GENERATE OUT FROM REC produced {"REC":{"A":"HELLO"}}. JSON PARSE compiles with the warning "JSON PARSE is not implemented".

Supported, together with JSON PARSE.

JSON GENERATE and PARSE

XML GENERATE / XML PARSE

IBM statement; not in IBM’s list of 2002/2014 features

XML GENERATE works and produced <REC><A>HELLO</A></REC>; XML PARSE compiles with "XML PARSE is not implemented".

Supported.

XML GENERATE and PARSE

National data and UTF-8

National since 2002; USAGE UTF-8 is an IBM 6.3 extension

USAGE NATIONAL, national literals and USAGE UTF-8 are accepted but every use prints "handling of …​ is unfinished; implementation is likely to be changed [-Wunfinished]": treat as experimental.

Supported: national data from Enterprise COBOL 3, USAGE UTF-8 and PIC U from 6.3, UTF-8 numeric moves by PTF PH69556.

National, UTF-8 and Code Pages

TYPEDEF and TYPE

2002

Supported in default, cobol2014 and ibm; rejected by ibm-strict and cobol85 (see below).

Supported (listed in IBM’s table as user-defined types); 6.5 adds :: qualification and PTF PH73209 STRONG typedefs.

REDEFINES, RENAMES and TYPEDEF

Dynamic-capacity tables (OCCURS DYNAMIC)

2014

Accepted syntactically but not implemented: "OCCURS DYNAMIC is not implemented [-Wpending]".

Not in IBM’s list of implemented features. Dynamic-length elementary items (DYNAMIC LENGTH) are supported.

Tables and OCCURS

SCREEN SECTION

2002

Supported in default and the lax dialects; rejected by ibm-strict, cobol85. Needs a terminal to run.

Not supported; terminal screens are built with BMS maps under CICS.

ACCEPT, DISPLAY and Console I/O

LINE SEQUENTIAL organization

Added to the standard in 2023; common extension for years

Supported, and the organization used for the portable examples.

Supported for z/OS UNIX files only; data sets use SEQUENTIAL, INDEXED, RELATIVE and VSAM.

Sequential Files

Three practical consequences follow from the table:

  • a program written for the mainframe that uses JSON PARSE, XML PARSE, OCCURS DYNAMIC or OO COBOL cannot be run on GnuCOBOL 3.2 at all, and the examples for those features on later pages say so and are labelled "z/OS; not run here";

  • a program written on GnuCOBOL that uses SCREEN SECTION, Report Writer or LINE SEQUENTIAL needs redesign, a precompiler or a different file organization before it moves to z/OS; and

  • "it compiled" is only a statement about the dialect: the table of dialects above says which one answered.

A feature that dialects disagree about: TYPEDEF

The same four-line change shows how a dialect decides what compiles. MONEY-T is a reusable type for a price or a fine, as in the Circulation copybooks.

       IDENTIFICATION DIVISION.
       PROGRAM-ID. TYPEDEMO.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  MONEY-T                 PIC 9(4)V99 IS TYPEDEF.
       01  WS-PRICE                TYPE MONEY-T.
       01  WS-FINE                 TYPE MONEY-T.
       PROCEDURE DIVISION.
       MAIN-PARA.
           MOVE 30.25 TO WS-PRICE
           MOVE 12.50 TO WS-FINE
           DISPLAY "PRICE=" WS-PRICE " FINE=" WS-FINE
           STOP RUN.

The program is accepted without warnings by the default dialect, by -std=cobol2014 and by -std=ibm:

--- cobc -x -Wall  typedemo.cob
PRICE=0030.25 FINE=0012.50
--- cobc -x -Wall -std=ibm typedemo.cob
PRICE=003025 FINE=001250
--- cobc -x -Wall -std=cobol2014 typedemo.cob
PRICE=0030.25 FINE=0012.50

The second line shows another dialect setting at work: pretty-display is off in the IBM files, so DISPLAY prints the digits of PIC 9(4)V99 without the decimal point, as Enterprise COBOL does. Under the strict IBM dialect and under COBOL 85 the program is rejected, and the first error is the one that matters, because the others are its consequences:

--- cobc -x -Wall -std=ibm-strict typedemo.cob
typedemo.cob:5: error: syntax error, unexpected Identifier
    3 |        DATA DIVISION.
    4 |        WORKING-STORAGE SECTION.
    5 >        01  MONEY-T                 PIC 9(4)V99 IS TYPEDEF.
    6 |        01  WS-PRICE                TYPE MONEY-T.
    7 |        01  WS-FINE                 TYPE MONEY-T.
typedemo.cob:6: error: 'MONEY-T' is not a type-name
    4 |        WORKING-STORAGE SECTION.
    5 |        01  MONEY-T                 PIC 9(4)V99 IS TYPEDEF.
    6 >        01  WS-PRICE                TYPE MONEY-T.
    7 |        01  WS-FINE                 TYPE MONEY-T.
    8 |        PROCEDURE DIVISION.
typedemo.cob:6: error: TYPE TO clause does not conform to IBM COBOL
typedemo.cob:7: error: 'MONEY-T' is not a type-name
    5 |        01  MONEY-T                 PIC 9(4)V99 IS TYPEDEF.
    6 |        01  WS-PRICE                TYPE MONEY-T.
    7 |        01  WS-FINE                 TYPE MONEY-T.
    8 |        PROCEDURE DIVISION.
    9 |        MAIN-PARA.
typedemo.cob:7: error: TYPE TO clause does not conform to IBM COBOL

The ibm-strict dialect describes the older IBM compilers, where TYPEDEF is not a reserved word, so the clause is a syntax error; the lax ibm dialect keeps the extensions switched on. Enterprise COBOL itself accepts TYPEDEF from release 6.5, the base release that introduced it. Real mainframe code must therefore be compiled with the lax dialect to stay close to 6.5, or kept free of TYPEDEF if it must run on 6.4 and earlier.

Conventions the examples follow

Every page of this guide follows the same rules, so that a reader knows what a listing means before reading it.

  • Default dialect with IBM-compatible syntax. Programs are written in the subset that both cobc and Enterprise COBOL accept: PIC, COMP, COMP-3, scope terminators (END-IF, END-PERFORM, END-READ), EVALUATE, PERFORM with inline bodies, COPY members, CALL ... USING. Examples were compiled with cobc -x -Wall, and with -std=ibm where the page is about mainframe-compatible behaviour, and every one produced no warning.

  • Fixed reference format unless a page is about free format: columns 8-72, paragraph names in Area A, statements in Area B, comment lines with * in column 7 and inline comments with *> only in the pages on free format. Block comments use column 7, never the 2002 floating *>, so the listings read the same on z/OS.

  • The Circulation scenario. The same small library back office runs through all pages: the files BOOKMAST (60 bytes), MEMBMAST (60 bytes) and LOANTRAN (30 bytes), described by the copybooks BOOKREC, MEMBREC and LOANREC, with a nightly batch run that validates the transactions, applies checkouts and returns, assesses fines, prints a report and writes the rejects. On z/OS the same data sets are named like USERID.CIRC.BOOKMAST; there is also a Db2 table LOAN and a CICS transaction CINQ. No real host, user ID or credential appears anywhere.

  • LINE SEQUENTIAL for portable files. On the workstation the three Circulation files are line-sequential text files, because they are easy to create and read. On z/OS they are fixed-length records in data sets (or VSAM clusters), and the pages that care say how the SELECT and the JCL DD statement change.

  • Real output. Every portable listing is followed by the output of the run, copied from the terminal, and every diagnostic shown is what cobc printed. A deliberately wrong program says so.

  • z/OS-only code is labelled. JCL, IDCAMS and DFSORT control statements, EXEC SQL, EXEC CICS, BMS maps, IMS calls and VSAM-specific features cannot be run on GnuCOBOL. They are checked statement by statement against the IBM documentation and marked "z/OS; not run here" in the text next to them.

  • Each example names its source. The line below a listing starting with Source: links the official page (IBM Documentation, the GnuCOBOL manual or the ISO catalogue) that defines the behaviour the example demonstrates; pinned IBM links use the SS6SG3_6.5, SSLTBW_3.2.0 and SSEPEK_13.0.0 documentation sets so that the page a reader opens is the one that was read.

  • Modern control flow. Examples use structured statements. Old constructs (ALTER, GO TO DEPENDING ON, NEXT SENTENCE, two-digit years) appear only on Legacy Features and Migration, labelled as old code and shown next to the modern form.

Where the Taulli book is out of date on compilers

Tom Taulli’s Modern Mainframe Development (O’Reilly, 2022) is a useful orientation to the mainframe, and this page used it only as a consulted overview of which tools people use. Several statements about compilers have since been overtaken: Enterprise COBOL 6.3 is no longer "the latest" (6.5 has been generally available since June 2025, with PTFs through September 2026), the history it gives stops at COBOL 2002 although the standard was revised in 2014 and 2023, Micro Focus is now part of Rocket Software, and OpenCobolIDE as the PC environment is unmaintained: install GnuCOBOL 3.2 and an editor such as VS Code instead (see Modern Tooling: VS Code and Zowe). The book does not cover GnuCOBOL’s dialects or cobc at all, which is why this page takes them from the GnuCOBOL manual.

Choosing a compiler and a dialect

Situation Choice

Learning COBOL, running the examples on a laptop

GnuCOBOL 3.2, default dialect, cobc -x -Wall.

Writing code that must move to the mainframe

GnuCOBOL with -std=ibm and -Wall while developing, then compile and test on Enterprise COBOL; use -std=ibm-strict only to check that nothing outside the older IBM language slipped in.

Maintaining a Micro Focus, ACUCOBOL-GT, RM/COBOL or Realia program

-std=mf, -std=acu, -std=rm or -std=realia on GnuCOBOL as a first migration step, or the vendor’s compiler if the code uses vendor features that GnuCOBOL lacks.

Checking standards conformance

-std=cobol2014 (or cobol2002, cobol85) with -Warchaic and -Wobsolete; there is no cobol2023 dialect in 3.2.

A shop-specific mix

A file for --conf that includes the nearest installed dialect and overrides the settings that differ.

Production on z/OS

Enterprise COBOL for z/OS 6.5 (or the release your site runs); GnuCOBOL is a development aid, not a substitute.

The compiler options of Enterprise COBOL (ARCH, OPTIMIZE, TRUNC, NUMPROC, SSRANGE, NUMCHECK, INITCHECK) are the mainframe counterpart of the GnuCOBOL switches on this page and are covered in Performance and Compiler Options and Compiling, Linking and Language Environment.