Computer Programming Languages – PL/1

One of my favorite computer languages is PL/1  or Programming Language / One.   This was IBM’s attempt to merge the scientific language of FORTRAN with the business language of COBOL and ALGOL to produce a single language which can operate equally in both spheres. 

I started using a derivative of PL/1 produced by Cornell university called ‘PL/C’ (I guess for Programming Language / Cornell).  PL/C used a subset of PL/1 and had the uncanny ability to always compile what was fed into it by taking a best guess at statements and producing ‘output’ statements for the rest.  This was at Bellingham High school where we would write out programs on punched cards to be taken up to the University mainframe for processing.  Later when I worked at the university as a ‘student programmer’ in High School I started using the real PL/1(F) compiler (as well a FORTRAN – never got that into COBOL at the time).

PL/1 is a procedural language as well as a structured language with procedures and functions and statements blocks and ‘do groups’ (think { … } in C).  Comments were in the /* COMMENTS  */ form like C today.

PL/1 supported a wide variety of data types.  Fixed binary, fixed decimal, float binary and even float decimal (which didn’t really exuist) and of course strings (fixed and varying (to a maximum) length).  Static, Automatic, or Based (think pointers) storage.  ?One of the interesting data types was the AREA – which is simply an area of memory and an area pointer – which is an offset pointer into that area.  There was also the TASK and EVENT data types which worked closely with miltitasking (read: multi-threading).

Yes, PL/1 supported a rather primitive multi-threading in the language itself.  The OS supported multitasking of course but usually one could only start a separate task via an assembly language.  PL/1 had a TASK option on the CALL statement which would invoke the subroutine as a separate task (sharing memory).  The EVENT datatype was a means of communicating between the tasks.  Along with the EVENT datatype there was the WAIT statements which would wait (or only check as I recall) for one or more events to complete.

PL/1 also supported the ‘PICTURE’ clause of COBOL as well as the scientific datatypes and functions of FORTRAN (even a COMPLEX datatype for complex numbers).  You could output data with a picture clause or Formatting statements like FORTRAN.

PL/1 also supported the various file types – sequential, random, indexed, etc…

PL/1 also included (and I think may have introduced) the concepts of exception handling.  This is where the program can set a trap to go off during specific exceptional conditions (like dividing by zero, a numeric overflow, or even the end of a page like this – to print the headings on the next page.:

ON ENDPAGE(SYSPRINT) DO;

PAGENUMBER = PAGENUMBER + 1;

PUT PAGE SKIP(2) EDIT(‘GENERAL WIDGET COMPANY’,’PAGE:”,PAGENUMBER)(X(30),A(22),X(20),A(5),X(2),G(4));

PUT SKIP(2) EDIT(heading…)(…);

END;

The ON ENDPAGE  specifies actions to take when a end-of-page condition is encountered on the SYSPRINT file (back then SYSPRINT was usually the line printer).  PUT PAGE SKIP(2) EDIT says to go to the next page, skip 2 lines and print…

PL/1 also supported automatic conversion. For example if you were to mathematically add a string to a number it would attempt to first convert the string to a number then do the add.  You could then assign the results to a string and PL/1 would convert the results to a numeric string.

PL/1 also had the PUT and GET DATA statement.  A curious statement which allows the user to specify the variable name and alue in the input (or have it shown in the output) like this:

A = 2, B = 2;

This was curious and I don’t think any other language has such a feature.  In fact if you specify the GET DATA(); without any variables  the user can specify any variable in the program.  I’ve only seen this used once – in a rather huge in-migration and out-migration modeling program I was looking once at written in PL/1.

What happened to PL/1?  I think PL/1 was simply ahead of its time and very complex.  PL/1 object programs were rather large compared with other languages at the time – and at this time having a low memory requirement was a premium.  It was also quite complex for the business or scientific user to grasp.

PL/1 is still available.  A company produces a PL/1 compiler for VMS (both VAX and Alpha).  PL/1(F) is also available via the Hercules 370 emulator and I believe MVS.  I believe Stratus also does most coding in PL/1.  I think IBM once had a ‘VisualAge PL/1’ which ran on windows.

Western Terminal System (see other post) also hosted a derivitive of PL/1 called WPL (Western Programming Language).  It was a very limited subset of PL/1.