PL/I - Introduction

In this series we’ll look at PL/I, or Programming Language 1, an ambitious multi-purpose language developed by IBM.

PL/I overview

PL/I was intended to be a programming language for all users - scientific, business and systems. It was originally developed by IBM in the mid ’60s and spread to other mainframes, Multics and DEC systems. A subset of the language was used to create CP/M and IBM produced a version for OS/2 on PCs that was competitive with C. A standardised specification was produced by ECMA and ANSI from the early ’70s. Although it gained some popularity (it was even used as a teaching language at some universities) it never really took off in any of the fields it was intended for.

Language-wise, it is a procedural imperative language drawing inspiration from FORTRAN, COBOL and ALGOL. Due to its intended wide coverage, it is a very large language with a number of interesting features, some of which were incorporated into later languages such as C.

PL/I on MTS

There were three PL/I environments originally available on MTS:

There are also a number of utility programs for PL/I *PL1SCAN does a quick syntax check of a program and *PL1TIDY formats a PL/I source file.

Prerequisites

No special installation instructions to get PL/I running - just do the standard D6.0 setup as described in this guide and then sign on as a regular user such as ST01.

Using *PLIF

*PLIF will read source from scards (by default *source* ie standard input) and will write object files to spunch. Unlike some other MTS compilers you need to provide a filename for spunch as there is no default. You should destroy or empty the contents of the object file before recompiling.

Other compilation parameters are listed in MTS Volume 7.

To run PL/I programs you need to concatenate the runtime library *PL1LIB with the object file.

Hello world

Here’s a transcript of a session where we run a Hello world program. This assumes the source code is contained in the file hello.pl1.

# $list hello.pl1

      1     /* Hello world program in PL/I */
      2     HELLO: PROCEDURE OPTIONS(MAIN);
      3       DECLARE I FIXED BINARY(16);
      4       DO I = 1 TO 5;
      5           PUT FILE (SCARDS) LIST('Hello, world!');
      6           PUT FILE (SCARDS) SKIP;
      7     END HELLO;

# $destroy -load
 File "-LOAD" has been destroyed.

# $run *pl1f scards=hello.pl1 spunch=-load
# Execution begins   12:18:31


  PROCEDURE HELLO: SYNTAX CHECK COMPLETED. COMPILATION CONTINUES.


  NO ERRORS OR WARNINGS DETECTED.
# Execution terminated   12:18:31  T=0.087

# $run -load+*pl1lib
# Execution begins   12:18:34
 'Hello, world!'
 'Hello, world!'
 'Hello, world!'
 'Hello, world!'
 'Hello, world!'

# Execution terminated   12:18:34  T=0.002

Further information

MTS Volume 7 describes the PL/I compilers available on MTS.

The original IBM documentation for the PL/I language and PL/I F compiler can be found at bitsavers.

A good introduction to PL/I is the PL/I Primer.

The Wikipedia article gives an extensive history and list of implementations.

Updated 10 June 2020: corrected status of *PLC as per MTS Archive.

Comments

comments powered by Disqus