COBOL on mainframes

z/OS

A mainframe runs z/OS, and COBOL there is compiled by IBM Enterprise COBOL. The language is the same COBOL you learned in this course; the platform adds the file systems, the job scheduler, and the transaction servers.

VSAM files

VSAM is the mainframe file system COBOL knows best: key-sequenced, entry-sequenced, and relative-record datasets. SELECT names the VSAM file, and ORGANIZATION IS INDEXED marks the key-sequenced kind:

SELECT CUST-FILE ASSIGN TO CUSTDATA ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC RECORD KEY IS CUST-KEY.

The 3270 world

Terminal programs paint 3270 screens through CICS or IMS, batch jobs run under JCL, and databases are Db2 and IMS. Learning COBOL on GnuCOBOL first is the right order: the divisions and the verbs transfer directly, and the platform differences become a short list to learn on the job.

The code on this page was not run: VSAM needs z/OS. The SELECT was checked with GnuCOBOL 3.2.0 on Alpine Linux 3.24.3 (x86_64) in a Docker container.

Article author: Arthur Isaev

Banner image