) Kednos PL/I for OpenVMS Systems

Kednos PL/I for OpenVMS Systems

Reference Manual

Order Number: AA-H952E-TM

January 2007

This manual defines Kednos PL/I for OpenVMS VAX on the OpenVMS VAX platform and Kednos PL/I for OpenVMS Alpha on the OpenVMS Alpha platform. It includes the keywords and the semantic and syntax rules of PL/I programming language statements, attributes, built-in functions, and other language elements.

Operating System and Version: For Kednos PL/I for OpenVMS VAX: OpenVMS VAX Version 5.5 or higher
For Kednos PL/I for OpenVMS Alpha: OpenVMS Alpha Version 6.2 or higher

Software Version: Kednos PL/I Version 3.8 for OpenVMS VAX
Kednos PL/I Version 4.5 for OpenVMS Alpha

Published by: Kednos Corporation, Pebble Beach, CA, www.Kednos.com

First Printing, August 1980 Revised, November 1983 Updated, April 1985 Revised, April 1987 Revised, January 1992 Revised, March 1992 Revised, November 1993 Revised, April 1995 Revised, October 1995 Revised, November 2003 Revised, January 2007

Kednos Corporation makes no representations that the use of its products in the manner described in this publication will not infringe on existing or future patent rights, nor do the descriptions contained in this publication imply the granting of licenses to make, use, or sell equipment or software in accordance with the description.

Possession, use, or copying of the software described in this publication is authorized only pursuant to a valid written license from Kednos Corporation or an anthorized sublicensor.

No responsibility is assumed for the use or reliability of software on equipment that is not listed as supported in the Product Description.

Copyright Kednos Corporation 1980-2007. All rights reserved.

Copyright ©1980-2007

The following are trademarks of Hewlett-Packard: Alpha AXP, AXP, CDD, DEC, DEC 4000, DECwindows, Digital, OpenVMS AXP, ULTRIX, VAX, OpenVMS, VT102, VT220, VT240, VT320, VT330, VT340, and the DIGITAL logo.

Contents Index


Kednos PL/I for OpenVMS VAX and Kednos PL/I for OpenVMS Alpha are Kednos Corporation implementations of the PL/I programming language, General-Purpose Subset, ANSI X3.74-1981.

Intended Audience

This manual is intended for programmers using PL/I to design or implement applications on OpenVMS VAX or OpenVMS Alpha systems. A prerequisite for attaining optimal benefit from the manual is that its users understand the concepts of programming in PL/I and are familiar with the keywords and topics that will be searched for information. This manual is not suitable for use as a tutorial document.

Associated Documents

The Kednos PL/I for OpenVMS Systems User Manual provides information on program development with the system-specific command language, the extensive I/O capabilities provided in PL/I, and programming techniques available to PL/I programs executing under the exclusive control of the operating system.

For information on installing PL/I, see the Kednos PL/I for OpenVMS Alpha Installation Guide.


Table 1 lists the conventions used in this manual.

Table 1 Conventions Used in this Manual
Conventions Meaning
[Return] In examples, the symbol [Return] represents a single stroke of the key on the terminal.
[Ctrl/] X In examples, [Ctrl/] X indicates that you hold down the Ctrl key while you press another key (represented here by X).
monospace This bold monospace typeface is used in interactive examples to indicate input entered by the user.
italic This italic typeface is used to identify variable names.
Vertical ellipses indicate that not all of the text of a program or program output is illustrated. Only relevant material is shown in the example.
... Horizontal ellipses indicate that additional parameters, options, or values can optionally be entered. When a comma precedes an ellipsis, it indicates that successive items must be separated by commas.
quotation mark
The term quotation mark is used only to refer to the double quotation mark character ("). The term apostrophe is used to refer to the single quotation mark character (').
[OPTIONS (option,...)] Except in OpenVMS file specifications, brackets indicate that a syntactic element is optional and you need not specify it.
[] Brackets surrounding two or more stacked items indicate conflicting options, one of which can optionally be chosen.
{} Braces surrounding two or more stacked items indicate conflicting options, one of which must be chosen.
FILE (file-reference) An uppercase word or phrase indicates a keyword that must be entered as shown; a lowercase word or phrase indicates an item for which a variable value must be supplied. This convention applies to format (syntax) lines, not to code examples.
# A # symbol is used in some contexts to indicate a single ASCII space character.

Technical Assumptions

All descriptions of the effects of executing statements and evaluating expressions assume that the initial procedure activation of the program is through an entry point with OPTIONS(MAIN).

It is further assumed that any non-PL/I procedures called by the program follow all conventions of the PL/I run-time environment. Except as explicitly noted, descriptions of I/O statements do not cover the effects of system-specific options. For details on mixed-language programming and system-specific options, see the Kednos PL/I for OpenVMS Systems User Manual.

Terminological Conventions

Information in this manual applies to the use of Kednos PL/I on the OpenVMS VAX and OpenVMS Alpha Operating Systems unless otherwise indicated.

The term Kednos PL/I refers to both Kednos PL/I for OpenVMS VAX and Kednos PL/I for OpenVMS Alpha.

The terms "full PL/I" and "standard PL/I" refer to the ANSI standard PL/I, X3.53-1976.

Chapter 1
Program Structure and Content

This chapter introduces the following elements of a PL/I program:

Future chapters discuss these topics in more detail.

1.1 Lexical Elements

This section describes the following topics:

1.1.1 Keywords

A keyword is a name that has a special meaning to PL/I when used in a specific context. In context, keywords identify statements, attributes, options, and other program elements. PL/I keywords are not reserved words, so it is possible to use them in a program in other than their keyword context.

PL/I has numerous keywords. Table A-1 describes the PL/I keywords, including brief identifications of their uses and valid abbreviations for the keywords that can be abbreviated.

1.1.2 Punctuation

PL/I recognizes punctuation marks in statements. The punctuation marks serve the following two functions:

For example:

A = B + C; 
In this statement, the equal sign (=), the addition operator (+), and the semicolon (;) delimit the identifiers A, B, and C, as well as define the operation to be performed. (Chapter 6 describes the effect of the various operators in expressions.)

Whenever you use a punctuation mark in a PL/I statement, you can precede or follow the character with any number of spaces (except in the case of an operator consisting of two characters, like >= or **, which must be entered without a space between the two characters). For example, the following two statements are equivalent:

DECLARE ( A, B ) FIXED DECIMAL ( 7, 0 ) ; 

In the second statement, all nonessential spaces are omitted; the parentheses and commas are sufficient to distinguish elements in the statement. The only space required in this statement is the space that separates the two keywords FIXED and DECIMAL.

Table 1-1 lists all the punctuation marks recognized by PL/I.

Table 1-1 Punctuation Marks Recognized by PL/I
Category Symbol Meaning
Arithmetic operators + Addition or unary plus
  - Subtraction or unary minus
  / Division
  * Multiplication
  ** Exponentiation
Relational (or comparison) operators > Greater than
  < Less than
  = Equal to
  ^> Not greater than
  ^< Not less than
  ^= Not equal to
  >= Greater than or equal to
  <= Less than or equal to
Logical operators ^ Logical NOT (unary) and
    EXCLUSIVE OR (binary)
  & Logical AND
  &: Logical AND THEN
  | Logical OR
  |: Logical OR ELSE
Concatenation operator || String concatenation
Separators , Delimits elements in a list
  ; Terminates a PL/I statement
  . Separates identifiers in a structure name; specifies a decimal point
  : Terminates a procedure name or a statement label
  () Encloses lists and extents; defines the order of evaluation of expressions; separates statement and option names from specific keywords; specifies a parameter list
  ' Delimits character strings and bit strings
Locator qualifier -> Pointer resolution

The tilde (~) is equivalent to the circumflex (^), and the exclamation point (!) is equivalent to the vertical bar (|).

Spaces, Tabs, and Line-End Characters

In addition to punctuation marks, PL/I accepts spaces, tabs, and line-end characters between identifiers, constants, and keywords.

The rules for entering spaces are:

The line-end character is a valid punctuation mark between items in a PL/I statement except when it is embedded in a string constant. In a string constant, the line-end character is ignored. For example:


This assignment statement gives the variable A the value of the specified character-string constant. (The line-end character in the constant is ignored.) Note that any tabs or spaces preceding NUED in the previous example will be included in the string.

1.1.3 Identifiers

An identifier is a user-supplied name for a procedure, a statement label, or a variable that represents a data item. The rules for forming identifiers are:

Examples of valid identifiers are:

That last example cannot be used on VAX.


A comment is an informational tool for documenting a PL/I program. To insert a comment in a program, enclose it within the character pairs /* and */. For example:

/* This is a comment...*/ 

Except inside a string constant, wherever the starting characters (/*) appear in a program, the compiler ignores all text until it encounters the ending characters (*/). A comment can span several lines.

The rules for entering comments are:

The following are examples of comments:

A = B + C ;           /* Add B and C */ 
/* *********  START OF SECOND PHASE ********* */ 
/* This module performs the following steps: 
   1. Initializes all arrays and data structures. 
   2. Establishes default condition handlers. 

Although complete comments cannot be nested, you can comment out a statement such as the following:

DECLARE EOF BIT(1); /* end-of-file */ 

To do this, precede the DECLARE statement with another /* pair, as follows:

/* DECLARE EOF BIT(1); /* end-of-file */ 

The compiler will then ignore all text, including the DECLARE statement and the second /*, until it reaches the */.

1.2 Statements

A statement is the basic element of a PL/I procedure. Statements are used to do the following:

Table 1-2 and Table 10-1 provide summaries of PL/I statements. Detailed descriptions of these statements appear throughout this manual.

1.2.1 Statement Formats

The general format of a PL/I statement consists of an optional statement label, the body of the statement, and the required semicolon terminator.

The body of the statement consists of user-specified identifiers, literal constants, or PL/I keywords. Each element must be properly separated, either by special characters that punctuate the statement or by spaces or comments.

1.2.2 Statement Labels

The optional statement label identifies a statement so that it can be referred to elsewhere in the program, for example, as the target of a GOTO statement. A label precedes a statement; it consists of any valid identifier (see Section 1.1.3) terminated by a colon. For example:

TARGET: A = A + B; 

A statement cannot have more than one label.

1.2.3 Simple Statements

A simple statement contains only one action to be performed. There are three types of simple statements:

Keyword Statements

Keyword statements are identified by the PL/I keyword that requests a specific action. Examples of keyword statements are:


In these examples, READ, GOTO, and DECLARE are keywords that identify these statements to PL/I.

Assignment Statements

PL/I identifies an assignment statement by syntax: an assignment statement consists of an identifer and an expression separated by an equal sign (=). For example:


Null Statements

A null statement consists of only a semicolon (;); it indicates that PL/I is to perform no operation. For example:


This IF statement shows a common use of the null statement: as the target of an ELSE clause.

1.2.4 Compound Statements

A compound statement contains more than one PL/I statement within the statement body; it is terminated by the semicolon that terminates the final statement.

1.2.5 Summary of Statements by Function

You can group PL/I statements by function into the following categories.

Data Definition and Assignment Statements

The DECLARE statement defines variable names:

DECLARE identifier [attribute ...]; 

The assignment statement gives a value to a variable or variables:

reference, reference = expression; 

Input/Output Statements

These statements identify files and data formats and perform input and output operations:

Program Structure Statements

These statements define the organization of the program into procedures, blocks, and groups:
END null

Flow Control Statements

These statements change or interrupt the normal sequential flow of execution in a PL/I program:

Storage Allocation Statements

These statements acquire and control the use of storage in a PL/I program:


Table 1-2 gives a summary of the PL/I statements and their uses.

Table 1-2 Summary of PL/I Statements
Statement Use
Assignment Evaluates an expression and gives its value to an identifier
Null Specifies no operation
ALLOCATE Allocates storage for a based or controlled variable
BEGIN Denotes the beginning of a block of statements to be executed as a unit
CALL Transfers control to a subroutine or external procedure
CLOSE Terminates association of a file control block with an input or output file
DECLARE Defines the variable names and identifiers to be used in a PL/I program and specifies the data attributes associated with them
DELETE Removes an existing record from a file
DO Denotes the beginning of a group of statements to be executed as a unit
END Denotes the end of a block or group of statements begun with a BEGIN, DO, or PROCEDURE statement
ENTRY Specifies an alternative point at which a procedure can be invoked
FORMAT Specifies the format of data that is being read or written with GET EDIT and PUT EDIT statements and defines the conversion, if any, to be performed
FREE Releases storage of a based or controlled variable
GET Obtains data from an external stream file or from a character-string expression
GOTO Transfers control to a labeled statement
IF Tests an expression and establishes actions to be performed based on the result of the test
LEAVE Transfers control out of a DO group
ON Establishes the action to be performed when a specified condition is signaled
OPEN Establishes the association between a file control block and an external file
PROCEDURE Specifies the point of invocation for a program, subroutine, or user-defined function
PUT Transfers data to an external stream file or to a character-string variable
READ Obtains a record from a file
RETURN Gives back control to the procedure from which the current procedure was invoked
REVERT Cancels the effect of the most recently established ON unit
REWRITE Replaces a record in an existing file
SELECT Tests a series of expressions and establishes the action to be performed based on the result of the test
SIGNAL Causes a specific condition to be signaled
STOP Halts the execution of the current program
WRITE Copies data from the program to an external record file

Next Contents Index