Safekipedia

PL/I

Adapted from Wikipedia · Discoverer experience

PL/I, which stands for Programming Language One, is a type of computer language created by IBM. It was made to help with many kinds of work, like science, engineering, business, and managing computer systems. People have been using PL/I since the 1960s in schools, companies, and factories.

In 1976, a group called the American National Standards Institute made a rule book for how PL/I should work, so everyone could use it the same way.

PL/I is good at handling numbers, data, and complicated information. It can work with many different kinds of data, like text and special codes, and it uses words that look like English to make it easier to read. This made it very useful for many different jobs on computers.

Early history

In the 1950s and early 1960s, people used different programming languages for business and science, often on different computer hardware. Business users moved from Autocoders and COMTRAN to COBOL, while science users used Fortran, ALGOL, and GEORGE. When IBM introduced the IBM System/360 in 1964, they wanted one language for everyone. They started with ideas from Fortran but created a new language called PL/I in 1965.

IBM finished designing PL/I so the first compiler could be made. Groups like SHARE and GUIDE helped improve the language. In 1976, PL/I became an official standard. The first PL/I compiler was ready in 1966.

Goals and principles

PL/I was designed to be a strong and flexible programming language. Its goals included competing with other popular languages, working well with different types of computers, and making programming easier. PL/I aimed to be fast, easy to use, and able to grow with new needs.

The language borrowed ideas from other programming languages and added its own special features. It had clear rules for organizing code, many types of data, and a simple way to write commands. PL/I also focused on making programs easy to debug and allowed parts of a program to be built separately and then combined.

Language summary

PL/I is a computer language made to help all kinds of programmers, no matter what they are working on. A PL/I program is made up of small parts called procedures, and each procedure has a list of commands.

Programmers can give names to different types of data, like single numbers or groups of numbers called arrays. There are special ways to do calculations and assign values to variables. Comments can be added anywhere in the program to explain things, using /* to start and */ to end them. Commands can be grouped together using DO and END, and there are ways to handle different situations with IF statements.

Arithmetic (expanded below)
CHARACTER
PICTURE for Arithmetic data
PICTURE for Character data
AREA
BIT
ENTRY
FILE
FORMAT
LABEL
OFFSET
POINTER
a base (BINARY or DECIMAL), and
a scale (FIXED or FLOAT), and
a mode (REAL or COMPLEX), and
a PRECISION (number of digits, and for fixed point numbers, a scale factor)
CONVERSION (CONV)
FIXEDOVERFLOW (FOFL)
OVERFLOW (OFL)
SIZE
STRINGRANGE (STRG)
STRINGSIZE (STRZ)
SUBSCRIPTRANGE (SUBRG)
UNDERFLOW (UFL)
ZERODIVIDE (ZDIV)
ENDFILE(file)
ENDPAGE(file)
KEY(file)
NAME(file)
RECORD(file)
TRANSMIT(file)
UNDEFINEDFILE(file) (UNDF)
Data attributesInput/output attributesOther attributes
ALIGNEDDIRECTAUTOMATIC or AUTO
AREA[(area-size)]ENVIRONMENT(options) or ENV...BASED[(reference)]
BINARY [(precision)] or BIN...INPUTBUILTIN
BIT [(maximum-length)]KEYEDCONDITION or COND
CHARACTER[(maximum-length)] or CHAR...OUTPUTCONSTANT
COMPLEX [(precision)] or CPLX...PRINTCONTROLLED or CTL
DECIMAL [(precision)] or DEC...SEQUENTIAL or SEQLDEFINED[(reference)] or DEF...
(dimension-attribute)STREAMEXTERNAL or EXT
ENTRY[(parameter descriptor list]UPDATEGENERIC(criteria list)
FILERECORDINITIAL(value-list) or INIT...
FIXED [(precision)]INTERNAL or INT
FLOAT [(number of digits)]LIKE unsubscripted reference
FORMATLOCAL
LABELOPTIONS(options)
MEMBERPARAMETER or PARM
NONVARYING or NONVARPOSITION [(expression)] or POS...
OFFSET[(reference)]STATIC
PICTURE picture-specification or PIC...VARIABLE
POINTER or PTR
STRUCTURE
UNALIGNED or UNAL
VARYING or VAR

Standardization

In 1966, groups in Europe and the United States started working together to create a standard for the PL/I programming language. They used a basic document from IBM and made changes based on votes from both groups. Big companies like General Motors, Honeywell, and Digital Equipment Corporation helped with this effort.

When the work was almost done, the group realized that the document was hard to understand because similar ideas were written in different places. So, several experts rewrote the whole document to make it clearer. This was the first time a programming language standard was written in a very exact way. Later, in 1981, a simpler version of PL/I called "Subset-G" was created and updated in 1987. This simpler version became very popular for many PL/I uses.

Implementations

PL/I was first created by IBM at its Hursley Laboratories in the United Kingdom as part of the development of System/360. The first PL/I compiler was the PL/I F compiler for the OS/360 Operating System, built by a team led by John Nash. This compiler was written in System/360 assembly language and released in 1966. It was designed for systems with very little memory.

Other companies also created PL/I compilers. The Multics project at MIT used an early version of PL/I called EPL in 1964. Compilers were also made for various operating systems and computers by companies like Honeywell, DEC, and others.

In 1992, IBM created a new version of PL/I with many added features. This version worked on several platforms including OS/2, AIX, Linux, and z/OS. It added new data types, better support for user-defined types, and improvements to make programs easier to read and maintain.

PL/I compilers were also made for personal computers and Unix systems by companies like Digital Research, Micro Focus, and others. These compilers allowed PL/I programs to run on computers like IBM PC compatibles and Unix-based systems.

PL/I dialects

PL/I had many different versions, or dialects, used for various purposes. PL/S was used for IBM mainframe system software and was later succeeded by PL/AS and PL/X, which is still used today. PL/C was developed for teaching purposes at Cornell University.

Other dialects included PL/MP and PL/MI, used in IBM's System/38 and AS/400 platforms, and PL.8, developed for IBM Research and still used in some IBM systems today. Honeywell, Inc. created PL-6 for its CP-6 operating system, while Prime Computer used PL/P and SP/L for its PRIMOS operating system. XPL was used to write other compilers, and HAL/S was used for the Space Shuttle program. SabreTalk was used for the Sabre airline reservation system, and Apple was used for graphic design on a supercomputer.

Usage

PL/I was used on big computers called mainframes starting in the late 1960s, then on smaller computers in the 1970s, and later on personal computers in the 1980s and 1990s. While it was mostly used on mainframes, there are PL/I compilers for MS-DOS, Windows, OS/2, AIX, OpenVMS, and Unix.

PL/I was popular for business tasks and for creating operating systems. Some important systems were built with PL/I, such as parts of the SAS System, the Sabre airline reservation system, the Multics operating system, and parts of the OpenVMS operating system.

Even though PL/I was powerful, it didn’t become as widely used as its supporters hoped. Other languages like Fortran and COBOL stayed more popular, especially as new technologies and development tools emerged. Also, competition and costs made it harder for PL/I to grow.

Evolution of the PL/I language

This article looks at PL/I using the official standard, but some important features were not included in the standard and were added later by different companies. The language kept growing, especially with the rise of personal computers.

Some features like multithreading, called "multitasking" in older versions, were used in early PL/I compilers but not included in the standard. These included special data types and statements to manage tasks and events.

The preprocessor, which helps change code before it is finally compiled, was also added by several companies. It lets programmers use shortcuts and constants in their code.

Over time, PL/I added support for more complex data types and better handling of dates and times to solve problems like the year 2000 issue.

Criticisms

PL/I was a big and complex programming language, which made it hard for programmers to learn and use. Creating a PL/I compiler took a lot of time and effort, and it was much bigger and slower than compilers for other languages like Fortran or COBOL.

Many programmers did not want to switch to PL/I from COBOL or Fortran because they found it too complicated. They also felt that PL/I mixed features from both COBOL and Fortran, which confused them. Even though PL/I had advanced features like support for pointers, recursion, and multitasking, most programmers and companies stuck with the languages they already used.

Special topics in PL/I

PL/I provides different ways to manage how variables store information. One way is called STATIC, where data is prepared and set up when the program starts, similar to some older languages. Another way is AUTOMATIC, where space for variables is made when a part of the program begins and cleaned up when it ends.

PL/I also allows programs to handle unexpected problems, like division by zero, by using special sections called ON-units. These help the program stay running and recover information instead of stopping suddenly.

Sample programs

Hello world program

Here is a simple program that prints "Hello, World!".

Hello2: proc options(main);
     put list ('Hello, World!');
end Hello2;

Search for a string

This program reads a line of text and then prints every following line that contains that text.

find_strings: procedure options (main);
   declare pattern character (100) varying;
   declare line character (100) varying;
   declare line_no fixed binary;

   on endfile (sysin) stop;

   get edit (pattern) (L);
   line_no = 1;
   do forever;
      get edit (line) (L);
      if index(line, pattern) > 0 then
         put skip list (line_no, line);
      line_no = line_no + 1;
   end;

end find_strings;

Related articles

This article is a child-friendly adaptation of the Wikipedia article on PL/I, available under CC BY-SA 4.0.