Safekipedia

PL/I

Adapted from Wikipedia ยท Adventurer experience

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

In 1976, the American National Standards Institute made a rule book for PL/I. This helped everyone use it the same way.

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

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 and 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 created to be a strong and flexible programming language. It wanted to compete with other popular languages, work well on many kinds of computers, and make programming simpler. 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 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 fix 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. A PL/I program is made up of small parts called procedures, each with 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 began 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 found the document hard to understand because similar ideas were written in different places. So, 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 made for systems with very little memory.

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

In 1992, IBM made 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 and made programs easier to read and maintain.

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

PL/I dialects

PL/I had many different versions, called dialects, used for different jobs. PL/S was used for IBM mainframe system software. It was later replaced by PL/AS and PL/X, which is still used today. PL/C was made to teach students at Cornell University.

Other dialects included PL/MP and PL/MI, used in IBM's System/38 and AS/400 computers, and PL.8, made for IBM Research and still used in some IBM systems. Honeywell, Inc. made PL-6 for its CP-6 operating system. 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. Later, it was used on smaller computers in the 1970s and on personal computers in the 1980s and 1990s. PL/I works on MS-DOS, Windows, OS/2, AIX, OpenVMS, and Unix.

PL/I was good for business tasks and for making operating systems. Some important systems were built with PL/I, like 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 strong, it was not used as much as some people wanted. Other languages like Fortran and COBOL were more popular, especially with new technologies and tools. Competition and costs also made it harder for PL/I to grow.

Evolution of the PL/I language

This article talks about PL/I using the official rules, but some important parts were not in these rules. They were added later by different companies. The language kept growing, especially when personal computers became popular.

Some parts, like working with many tasks at once (called "multitasking" in older versions), were used in early PL/I tools but not in the official rules. These included special types of data and commands to control tasks and events.

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

Over time, PL/I added support for more complicated types of data and better ways to handle dates and times to fix problems like the year 2000 issue.

Criticisms

PL/I was a big and complex programming language. This made it hard for programmers to learn and use. Creating a PL/I compiler took a lot of time and effort. It was also 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 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 kept using the languages they already had.

Special topics in PL/I

PL/I offers various methods for managing how variables store information. One method is called STATIC, where data is prepared when the program starts, similar to older languages. Another method is AUTOMATIC, where space for variables is created when a part of the program begins and removed when it ends.

PL/I also lets programs handle unexpected issues, such as division by zero, using special sections named ON-units. These help the program continue 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.