Saturday, 9 May 2020

Running COBOL on ....

There's been a splurge of interest in COBOL recently, and especially in acquiring COBOL skills.

Now I learned COBOL in college in the late 80s, and have barely ever looked at it since, apart from a brief spot of exploration of COBOL on the AS/400 back in the 90s

But now COBOL is cool again ( hint, it never went away )

So, without a Raspberry Pi to hand, here's me running COBOL on ..... an IBM mainframe !

cat /proc/cpuinfo 

vendor_id       : IBM/S390
# processors    : 2
bogomips per cpu: 21881.00
max thread id   : 0
features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te vx vxd vxe gs 
facilities      : 0 1 2 3 4 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 40 41 42 43 44 45 47 48 49 50 51 52 53 54 57 58 59 60 64 69 71 73 74 75 76 77 78 80 81 82 129 130 131 133 134 135 138 139 146 147 156
cache0          : level=1 type=Data scope=Private size=128K line_size=256 associativity=8
cache1          : level=1 type=Instruction scope=Private size=128K line_size=256 associativity=8
cache2          : level=2 type=Data scope=Private size=4096K line_size=256 associativity=8
cache3          : level=2 type=Instruction scope=Private size=2048K line_size=256 associativity=8
cache4          : level=3 type=Unified scope=Shared size=131072K line_size=256 associativity=32
cache5          : level=4 type=Unified scope=Shared size=688128K line_size=256 associativity=42
processor 0: version = FF,  identification = 4D3F07,  machine = 3906
processor 1: version = FF,  identification = 4D3F07,  machine = 3906

cpu number      : 0
cpu MHz dynamic : 5208
cpu MHz static  : 5208

cpu number      : 1
cpu MHz dynamic : 5208
cpu MHz static  : 5208


uname -a

Linux 766b81312d8b 4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:21:03 UTC 2019 s390x s390x s390x GNU/Linux

cobc --version

cobc (OpenCOBOL) 1.1.0
Copyright (C) 2001-2009 Keisuke Nishida / Roger While
Built    Aug 04 2016 15:56:22
Packaged Feb 06 2009 10:30:55 CET


cat hello.cbl 

       Identification Division.
       Program-ID. sampleCOBOL.

       Data Division.

       Procedure Division.
       Main-Paragraph.
       Display "Hello World!"
       Stop Run.


cobc -x -o hello hello.cbl 

file ./hello

./hello: ELF 64-bit MSB shared object, IBM S/390, version 1 (SYSV), dynamically linked, interpreter /lib/ld6, for GNU/Linux 3.2.0, BuildID[sha1]=351ec732463ff4add4598e53e1533e534a2fdf44, not stripped

./hello 

Hello World!

So, for the record, I'm using a Virtual Server running on an IBM Z box hosted in the IBM Cloud via the IBM Hyper Protect Virtual Servers offering.

Even better, the first one is free ......




Finally, the idea of running COBOL on Ubuntu came from this blog: -


and uses Open COBOL

Other COBOL compilers exist .......

No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...