Tutorials on PL/I Programming

PL/I Programming Language One (Basics)

PL/I is a powerful language used in Mainframe that can be used for both business and scientific applications. PL/I is Programming Language One. One is a roman letter, not alphabet I . PL/I is used to write structured programs. It can be pronounced as pee ell one and not pee ell iee.

Whenever you are writing programs, you must follow the three basic criteria of Good program.

  • It must correctly solve the problem it is indented to solve.
  • It must be reliable.
  • It must be easy to read and easy to maintain.

The characteristics of structured program are,

  • It should have one entry point.
  • It should have one exit point.
  • It should not have any dead or unreachable code.
  • It should not have any infinite loop.
Mainframe Programming - PL/I Basics
Photo by Lukas on Pexels.com

The basic things to keep in mind to write PL/I programs are,

  • Use as meaningful data names as possible.
  • Use a data name for only one purpose inside a program.
  • Have a program code read from top to bottom and doesn’t use branch statements at the maximum. Avoid GOTO Statements.
  • Given two alternatives, clever code Vs. Clearer code that may take a few more instructions or more execution time – opt for the Clearer one.
  • Programs are written to be read by other people.

FLOWCHART shows the logic, the sequence in which operations will be carried out. It shows Procedure.

HIERARCHY is the term used to show the relationship between the main functions and their sub functions in the chart.

HIERARCHY CHART does not show the decision making logic or flow of execution. It shows what needs to be done. It shows Functions. It allows you to concentrate on defining what need to be done in a program before you decide how it is to be done.

FUNCTION is the change takes place between the time entered in to the module to completion of action.

PL/I program must consist of a main procedure and one or more external procedures or modules. These modules may be thought of as sub functions of functions that precede them on hierarchy chart.

Important Questions & Answers on PL/1 Basics – Check Out for the top PL/1 interview questions


  • Extended alphabet  (29 Characters)    $, @, #, A to Z.
  • Decimal digits   (10 Characters)  0  1  2  3  4  5  6  7  8  9 
  • Special Characters  (21 Special Characters)
  • Blank
  • Equal to
  • Plus sign
  • Minus Sign
  • Asterisk / multiply sign
  • Slash / Divide sign
  • Left parenthesis
  • Comma
  • Point / Period
  • Single Quotation
  • Percent symbol
  • Semicolon
  • Colon
  • NOT Symbol
  • AND Symbol
  • OR Symbol
  • Greater than symbol
  • Less than symbol
  • Break
  • Question mark


The identifiers are the Name of data, Name of the procedures, Labels of the PL/I statement and the Keywords.

  •   First Character Should be the Alphabetic
  •   There Should not be any embedded blanks
  •   The identifiers are the combination of the Character sets, Decimal digits and Break Character. Break character is equal to the under score character.
  •   A hyphen cannot be used, because it is treated as a minus sign.
  •   Special Characters should not be used in Identifiers.
  •   Name of the external procedures and files must be the max of Seven or Eight character width.

Valid identifiers are,                                                             Invalid are,

                        EMP_NAME                                                  EMP NAME

                        EMP_NO#                                                      #_EMP_NO

                        EMPNO                                                          EMP-NO


A Constant is a data item that does not have a name and whose value cannot be changed during the execution of the program or in the program.

DECIMAL FIXED-POINT               12.75               Commercial Applications

DECIMAL FLOATING-POINT       0.1275E+2      Scientific Applications

CHARACTER STRING                    ‘XXXXX’ More commonly used in Commercial,   but often used in Scientific Applications

BIT STRING                                      ‘1’B                 Program switches / Flags in Both applns.

BINARY FIXED-POINT                  1B                   For non-optimizing compilers, where the program efficiency is on paramount concern.

BINARY FLOATING-POINT         0.110E+48B    Highly specialized applications.


These constants consist of one or more decimal digits and optionally, a decimal point. If no decimal point appears, then the data item is called INTEGER.

            Examples :

                        180                  2.4567             +867.78           -24934.00        0.00006


These constants are written using exponential notation i.e. the multiplier of 10. In IBM implementation the max exponents allowed as -73 to +73.


                                                                        Decimal Fixed point equivalent

                        18.E+05 / 18E5                                   180000

                        18E                                                      18

                        .1E-07                                                 .00000007

                        123456E-6                                          .123456


These constants consist of any of the 256 characters recognized by the system. Any blank included in the Character string constants. Inside the program the Character string constants must be enclosed in single quote marks. The character string constants are right justified. The unused portions of the data item are padded with blanks.

            Examples :

                        ‘ANAND BALASUBRAMANIAN’

                        ‘AVE. MARKS’

                        ‘ANAND’’S FATHER’ – Result will be ANAND’S FATHER

It is also possible to specify a repetition factor for the string constants. This feature is useful, when a pattern of string data exists.

                        (3) ‘ANANDb’           – Result will be ANANDbANANDbANAND.

                        (81)’-’ – —————————————————————————


The constants are written in the program as a series of binary digits enclosed in single quotation marks and followed by the letter B. These are valuable, when it is used as the indicators and flags. They can be set to 1 or 0 and then later changed in the program.

Mostly bit strings are not used in calculations and they can be used in the program to indicate whether the certain conditions exists or not.

Examples :




                                    10 0 1 1 01 1

                                      |   |  |  |   |    |   

                                      |   |  |  |   |    ——————–>   1 – Male / 0 – Female

                                      |   |  |  |   |

                                      |   |  |  |   ————————>   01 – Married / 10 – Unmarried

                                      |   |  |  |                                        11 – Widow

                                      |   |  |  —————————>    1 – Local / 0 – Outstation

                                      |   |  |

                                      |   |  —————————–>    1 – Executive / 0 – Employee

                                      |   |

                                      |  ——————————->    1 – Covered Insurance / 0 – Uncovered

                                      |————————>  etc.

Leave a Comment