Running Algol68C on MVS
Recently, Algol68C Release 1.3039 was made public for download. This release is derived from the compiler that was in service to the mid 1990's on IBM mainframes. The new release is meant to run on either MVT or MVS. This report documents the installation of the new release on emulated MVS/370.
Being the author of Algol 68 Genie I am interested in having access to other Algol 68 compilers for reference purposes. Of course we have algol68toc that descends from Algol68RS but there are also two versions of Algol68C available on the web, the oldest one being Version 247 and the most recent one being Algol68C Release 1.3039. These two compilers run on operating systems MVT 21.8F and MVS 3.8J that can be run free-of-charge on Hercules, the well-known IBM mainframe emulator. MVT and MVS developed into z/OS, which is backward compatible with its predecessors. The free-of-charge versions of MVT and MVS lack program products as ISPF, but TSO is available.
A68C Version 247 appeared in 1976, at about the same time as the Revised Report. In 1976, the language implemented by A68C still differed notably from the Revised Report language. The recent Release 1.3039 however is a much better approximation, and stems from Release 1.303 that I used under VM/CMS in the 1980's to do scientific calculations. The new release does however "preserve" idiosyncracies like allocating three registers to address three 4kB code pages, by which an unsegmented program cannot exceed 12kB in length. All but small programs must still be segmented.
Since Algol68C and FLACC were an inspiration for me to write Algol 68 Genie, I installed Release 1.3039 on MVS. This page documents how to install this compiler.
What does running Algol68C look like?
For the moment I am content to run A68C programs in batch. Next JCL batch job is a typical example: the paradigm ZEROIN algorithm to search for roots of a function, which was also contained in the Mathematisch Centrum Algol 68 Test Set which is available for dowload onto MVS from this page as well. Note that in below listing, A68.SYSIN indicates that the following lines are read by job step A68 in A68CCLG as file SYSIN. Job step A68 is the actual compilation.
//ZEROIN JOB 1,'ZEROIN',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1) //ZEROIN EXEC A68CCLG //A68.SYSIN DD * BEGIN PROC zero in = (REF REAL x, y, PROC (REAL) REAL f, tol) BOOL: BEGIN REAL a := x, b := y; REAL fa := f(a), fb := f(b); REAL c := a, fc := fa; WHILE (ABS fc < ABS fb | (a := b, fa := fb); (b := c, fb := fc); (c := a, fc := fa)); REAL tolb := tol(b), m := (c + b) * .5; ABS (m - b) > tolb DO REAL p := (b - a) * fb, q := fa - fb; (p < 0 | (p := - p, q := - q)); (a := b, fa := fb); fb := f(b := IF p <= ABS q * tolb THEN (c > b | b + tolb | b - tolb) ELIF p < (m - b) * q THEN p / q + b ELSE m FI); IF ABS (SIGN fb + SIGN fc) = 2 THEN (c := a, fc := fa) FI OD; (x := b, y := c); ABS (SIGN fb + SIGN fc) < 2 END; REAL eps = 3 * small real; PROC test = (REAL x0, y0, PROC (REAL) REAL f, STRING s) VOID: BEGIN print((new line, "Expression: ", s, new line, "Zero to be found between ", x0, " and", new line, y0, new line)); IF REAL x, y; zero in(x := x0, y := y0, f, (REAL p) REAL: eps + eps * ABS p) THEN print(("f(", x, ") =", new line, f(x))) ELSE print("no solution found") FI; print(new line) END; test(-10, 10, (REAL x) REAL: x ** 2 - 1, "x ** 2 - 1"); test(-1, 0, (REAL x) REAL: exp(x) - x ** 2, "exp(x) - x ** 2"); test(0, 1, (REAL x) REAL: cos(x) - x, "cos(x) - x") END //
I can issue batch jobs to the reader that on my emulated system sits on device number 00C. So if my batch job would be file jcl/zeroin.jcl, I would type at the Hercules console:
Command ==> devinit 00c jcl/zeroin.jcl eof
Alternatively, I can issue the batch job from TSO. I would log on as user marcel, hence my high level qualifier would also be MARCEL. Then if my batch job would be file MARCEL.ZEROIN.JCL, I would type at the TSO terminal:
This job writes on the MVS console:
and produces on the printer:
Algol68C Release 1.3039 Unused space 25936 Z370 version 303.7 Program=1388 Data=248 Expression: x ** 2 - 1 Zero to be found between -1.0000000000000000E +1 and +1.0000000000000000E +1 f( -9.9999999999999999E -1) = -2.7755575615628914E-17 Expression: exp(x) - x ** 2 Zero to be found between -1.0000000000000000E +0 and +0.0000000000000000E +0 f( -7.0346742249839178E -1) = -2.3592239273284576E-16 Expression: cos(x) - x Zero to be found between +0.0000000000000000E +0 and +1.0000000000000000E +0 f( +7.3908513321516066E -1) = +1.3877787807814457E-17
Note that the compiler's signature reveals its relation to the release 1.303 that I used on VM/CMS, as is apparent from next line printer listing from my 1987 MSc thesis:
Setting up a MVS/370 system
The question is whether you want a prebuilt turnkey-system or want to set up and tailor your own installation. Volker Bandke has posted a great ready-to-run Tur(n)key system. You can download this as an ISO image and be running MVS within minutes. For DIY people like me, Jay Moseley has written excellent instructions on how to set up your own system. This does not have you up and running within minutes, but setting it up yourself is a great learning experience. Note that Jay's system is not the same one as Volker's. The installation of Algol68C as described here was done on Jay's system, but should work equally well on Volker's offering.
Setting up a basic MVS system takes about one evening of entertaining work. I did borrow material from Volker's system to set up mine. For historic reasons I named my installation BUFF and devised a corresponding netsol logon screen as presented in the heading of this report (note that the turkey refers to the original MVS mascot). BUFF is a quite modest 8-DASD set up on which I installed memories of my computing past like FORTRAN H and DUCHESS, a strong 1970's chess program that competed with Chess, Kaissa and Belle. Of course I installed nice tools as Rob Prins's RPF and Greg Price's IMON370 and QUEUE. I ported Collosal Cave Adventure to Fortran H, so I am forever lost in a maze of twisty little passages, but that is another story.
Below screen shows how the A68C distribution files are installed on my particular MVS installation. Most MVS systems are set up such that third-party material is not mixed with IBM material. Hence SYS1 libraries (IBM material) sits for instance on volume MVSRES while SYS2 (third-party material) sits on SYSRES. I installed A68C using prefix SYS2 on volume called SYSRES; below is a view of this volume using RPF. I added SYS2.A68CLIB.MCRA68TS myself which is the Mathematisch Centrum Revised Algol 68 Test Set .
Algol68C installation directions
The straightforward route is to install the prebuilt binaries from the DASD image. I downloaded the DASD image and did not use the AWS tape image. The disk is compressed, and I decompressed it since I do not use compressed disks on my system, and named it dasd/a68c01.3330. Mounting the disk was done by attaching it on the Hercules console:
Command ==> attach 131 dasd/a68c01.3330
Note that the device number, in my example 131, must be some free device number fit for a 3330, this depends on how your MVS system is configured. Once attached, on the MVS console I first put the disk online:
and then I mounted it from the MVS console:
Note that throughout this report I assume that MVS succesfully does what you ask it to do. Check this please, condition codes should typically be 0. I mounted the disk PRIVATE so MVS does not place data on it of its own accord. You can make the disk resident by adding it to member VATLST00 in SYS1.PARMLIB. The disk's VOLSER (label) is A68C01, but since it is not catalogued, there is no high-level qualifier - you don't need it anyway.
Now a JCL job can copy what you need. You can adapt and use the JCL job for my system to install A68C on your system. The job can be started by typing at the Hercules console:
Command ==> devinit 00c a68c-load.jcl eof
where you replace 00C with the device number of your reader. During the job, expect next messages to pass the MVS console:
Now you are set to compose and run jobs as illustrated at the start of this page.