is cobol still a language worth learning?

  • it is still widely used in the banking and finance sector (IRS, SSA, JPMorgan Chase, Bank of America, Citigroup, Wells Fargo, HSBC, American Express, Fiserv, and Visa)
  • mainframes still in use:
    • z16: IBM Telum processor. It has eight general-purpose CPU cores per chip, plus an on-chip AI accelerator.
    • z15: Telum’s predecessor-generation processor, used in z15 systems.
    • z17: A newer IBM Z generation; its processor is Telum II.
    • Telum is more on the CISC than the RISC side but falls in between?
      • Telum implements IBM’s z/Architecture, the descendant of System/360 from 1964.
      • It has the classic CISC traits: variable-length instructions (2, 4, or 6 bytes), memory-to-memory operations, complex instructions that do a lot in one go (string moves, decimal arithmetic, compression, cryptographic operations), and many addressing modes.
      • The microarchitecture looks RISC-like inside.
      • Modern z processors, Telum included, decode those complex instructions into simpler internal micro-operations and execute them on an out-of-order, superscalar pipeline.
      • This is the same basic trick Intel and AMD use for x86.
      • Because of this, the RISC vs. CISC distinction today is mostly about the instruction set the programmer sees, not how the silicon works internally.
      • there seems no good benchmark that compares Talum with x86 so let’s do a cobol based benchmark X-D (scroll to section “benchmark”)
  • cobol often it handles specific high-volume transaction or account-processing tasks behind newer apps and websites
  • valuable combination is COBOL plus the mainframe tools around it, especially JCL, Db2/SQL, CICS, and z/OS along with modern integration skills such as APIs, Git, and Python or Java
  • IBM’s free Z Xplore training includes hands-on COBOL and other mainframe skills

claude actually wrote a pretty decent version of tetirs in cobol

hostnamectl; # tested on
Static hostname: workstation
Icon name: computer-desktop
Chassis: desktop 🖥️
Operating System: Debian GNU/Linux 13 (trixie) 
Kernel: Linux 6.12.113+deb13-amd64
Architecture: x86-64

su - root
apt install gnucobol

vim blocks.cob
# download and insert the src with i and cltr+v that looks like
https://dwaves.de/games/blocks.cob
# hello world
>>SOURCE FORMAT FREE
IDENTIFICATION DIVISION. *> Declares the program's identity and structure.
PROGRAM-ID. HELLO-WORLD. *> Names this program HELLO-WORLD.
PROCEDURE DIVISION. *> Begins the instructions the program will execute.
DISPLAY "hello world". *> Prints hello world to the screen.
STOP RUN. *> Ends the program.

# the syntax is really really strange when comparing it to python

# compile it
cobc -x -free blocks.cob -o blocks

# run it
./blocks

the cobol benchmark

obviously all as non-root user:

# compile it
cobc -x -O2 -o cobbench cobbench.cob 
lscpu |head; # test run on all 12x cores
Architecture:                            x86_64
CPU op-mode(s):                          32-bit, 64-bit
Address sizes:                           48 bits physical, 48 bits virtual
Byte Order:                              Little Endian
CPU(s):                                  12
On-line CPU(s) list:                     0-11
Vendor ID:                               AuthenticAMD
Model name:                              AMD Ryzen 5 5600G with Radeon Graphics
CPU family:                              25
Model:                                   80

time ./cobbench        # detects cores with nproc
Warning: program compiled against libxml 212 using older 209
COBOL multi-core CPU benchmark
Kernel : primes < 300000 by trial division, 2 reps/worker
Cores  : 12
Warning: program compiled against libxml 212 using older 209
12 workers :       8.41 s
 
Result check : OK (25997 primes in every worker)
Throughput    :         2.85 reps/s (all cores)
Speedup vs 1  :     5.75x
Scaling eff.  :    47.9 %

real	0m12.444s <- have no Talum cores available but
# this should allow to compare x86 CPU performance with Talum

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin