) Kednos PL/I for OpenVMS Systems

Kednos PL/I for OpenVMS Systems

User Manual

Order Number: AA-H951E-TM

January 2007

This manual provides an overview of the PL/I programming language. It explains programming with Kednos PL/I on OpenVMS VAX Systems and OpenVMS Alpha Systems. It also describes the operation of the Kednos PL/I compilers and the features of the operating systems that are important to the PL/I programmer.

Revision/Update Information: This revised manual supersedes the PL/I User's Manual for VAX VMS, Order Number AA-H951D-TL.

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, May 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, DEC, DEC 4000, DECchip, DECnet, DECtalk, DECUS, Digital, MicroVAX,OpenVMS, OpenVMS AXP, RMS, RMS-11, RX50, TK50, VAX, VAX Ada, VAX BASIC, VAX BLISS, VMScluster, VAX CDD/Plus, VAX COBOL, VAX DATATRIEVE, VAX DIBOL, VAX DOCUMENT, VAX FORTRAN, VAXinfo, VAX MACRO, VAX Pascal, VAX SCAN, VAXset, VAXTPU, VMS, the AXP logo, and the DIGITAL logo.

The Reader's Comments form at the end of this manual requests your critical evaluation to assist in preparing future documentation.

Contents Index


This manual describes how to use the PL/I compiler on the OpenVMS operating systems and contains detailed explanations of the extensions made to the standard PL/I language for Kednos PL/I. To aid in program development, it includes information on some commands and utilities in the operating systems. It also includes information to assist in writing PL/I programs that use features of the file system and the operating systems.

Intended Audience

This manual is designed for programmers who have a working knowledge of PL/I and some familiarity with the OpenVMS operating systems and the DIGITAL Command Language (DCL).

Associated Documents

The Kednos PL/I for OpenVMS Systems Reference Manual contains a complete definition of the PL/I language, with detailed reference information on all standard PL/I language elements.

The Kednos PL/I for OpenVMS Alpha Installation Guide gives instructions on how to install the PL/I compilers.

The OpenVMS documentation set gives complete information on the OpenVMS operating system.

Online Examples

All the full program examples in this manual, and some additional examples, are on line in SYS$COMMON:[SYSHLP.EXAMPLES.PLI]. (This device-directory specification may have been given the logical name PLI$EXAMPLES during installation of the PL/I compiler.)


[Return] A symbol with a key name indicates that you press a key on the terminal, for example, [Return] or [ESC].
[Ctrl/x] The symbol [Ctrl/x] indicates that you press the key "x" while holding down the key labeled Ctrl, for example, Ctrl/C.
$ bold [Return] In interactive dialogues between the system and the user, user input is printed in boldface characters.
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.
option,... Horizontal ellipses indicate that additional optional parameters, options, or values are allowed. 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 you must enter as shown; a lowercase word or phrase indicates an item for which you must supply a variable value. This convention applies to format (syntax) lines, not to code examples.

Terminological Conventions

Information in this manual applies to the use of Kednos PL/I for OpenVMS VAX on the OpenVMS VAX platform and Kednos PL/I for OpenVMS Alpha on the OpenVMS Alpha platform unless otherwise indicated. The term PL/I refers to both Kednos PL/I for OpenVMS VAX and Kednos PL/I for OpenVMS Alpha unless otherwise noted.

Chapter 1

Kednos PL/I for OpenVMS VAX and Kednos PL/I for OpenVMS Alpha are implementations of a comprehensive and powerful programming language useful for systems programming, scientific computation, and commercial data handling and data organization. PL/I is a block-structured language that lends itself to the creation of efficient and maintainable structured programs. It has extensive string-handling capabilities. The Kednos PL/I for OpenVMS VAX and Kednos PL/I for OpenVMS Alpha compilers generate optimized, position-independent machine code.

Kednos PL/I for OpenVMS VAX and Kednos PL/I for OpenVMS Alpha are Kednos implementations, with extensions, of the American National Standard PL/I General-Purpose Subset, ANSI X3.74-1981. The General-Purpose Subset is a subset of full PL/I, ANSI X3.53-1976.

The General-Purpose Subset was designed for scientific, commercial, and systems programming on small and medium-size computer systems. The subset includes features of full PL/I that are easy to learn and use. It excludes features of full PL/I that are difficult to learn, prone to error, or not often used, and that greatly increase the complexity of run-time support required by the compiler.

Over and above its conformity to the General-Purpose Subset, Kednos PL/I for OpenVMS VAX and Kednos PL/I for OpenVMS Alpha offer many enhancements, which are extensions to that subset. Some of these extensions are features of full PL/I, and some are features for compatibility with other PL/I implementations in the industry. Other extensions integrate Kednos PL/I into the OpenVMS common language environment and into a complete programming environment. In general, the Kednos PL/I extensions are intended for programs that will execute exclusively under the control of the OpenVMS operating system.

The Kednos PL/I extensions provide for support of the OpenVMS Calling Standard, which allows PL/I procedures to call procedures written in other languages. The extensions provide access to the file capabilities of OpenVMS Record Management Services, and the OpenVMS file system; they provide improved condition handling; and they provide access to system services, which are operating-system procedures, and to run-time library procedures. Another notable extension is the preprocessor, which allows for conditional compilation of programs and for compile-time source transformation; it enables users to write procedures that will be executed at compile time.

PL/I can be used with a number of tools in a complete programming environment. For example, the OpenVMS Debugger is a powerful tool for debugging programs. Use of the debugger is described in Chapter 3 of this manual. Other tools are optional products, including DEC DATATRIEVE, the DEC Common Data Dictionary (CDD), and the Software Engineering Tools (DECset).

DECset includes several integrated components, including the DEC Code Management System (CMS), the DEC/Test Manager, the VAX Source Code Analyzer (SCA, Kednos PL/I for OpenVMS VAX only), the VAX Program Design Facility (PDF, Kednos PL/I for OpenVMS VAX only) , and the DEC Language-Sensitive Editor (DECLSE). Notably, LSE can be a valuable aid when you write and compile a program, as it includes built-in intelligence about the source format and syntax of PL/I programs. Contact your system manager to find out which of these and other optional products are installed on your system.

Kednos implementations of the PL/I language are fully described in the Kednos PL/I for OpenVMS Systems Reference Manual. That manual contains further information on the General-Purpose Subset, the Kednos PL/I extensions, and the differences between Digital's implementations and other implementations of the PL/I language.

Chapter 2
Developing PL/I Programs at the DCL Command Level

This chapter describes how to create, compile, link, and run a Kednos PL/I program.

2.1 DCL Commands for Program Development

This section describes the DCL commands that are used to create, compile, link, and run a PL/I program on an OpenVMS system. Figure 2-1 shows the steps in creating a program.

Figure 2-1 Steps in Developing Programs

The commands to perform the actions shown in Figure 2-1 are as follows:


PLI is the default file type for PL/I source files. You do not have to specify the file type when you compile the source file.

If your source program compiles successfully, the compiler creates an object file with the file type OBJ. If the compiler detects errors, the system displays each error on your screen and then displays the DCL prompt.

The /LIST qualifier causes the compiler to produce a listing file, as follows:


In this example, AVERAGE is the name of the program. Section 2.3.2 lists the command qualifiers for the PLI command.

To create an executable image file from the sucessfully compiled program, invoke the OpenVMS Linker. The linker uses the object file as input to produce an executable image file as output.

Section 2.4.2 lists and explains the command qualifiers for the LINK command.

To run your program after the executable image file has been created, use the DCL command RUN.

2.2 Creating a PL/I Program

To create and modify a PL/I program, invoke a text editor. The OpenVMS system supports the following text editors: EDT, the DEC Language-Sensitive Editor (LSE), and the DEC Text Processing Utility (DECTPU). LSE is a layered extension of DECTPU. The following sections describe briefly how to use these editors.

2.2.1 Using EDT

EDT is an interactive general-purpose text editor that offers three editing modes: keypad, nokeypad, and line. With keypad mode, you enter commands by using the numeric keypad that appears to the right of your main keyboard. With nokeypad mode, you enter commands on a command line, which EDT processes when you press the Return key. Line mode focuses on the line as the unit of text. With line mode, you enter commands at the line mode asterisk prompt (*).

Keypad mode and nokeypad mode continually display the contents of the file on your screen. When you begin your editing session, editing in line mode is the default. Unlike keypad and nokeypad mode, line mode displays only one line of text on your screen.

The following command line invokes the EDT editor and creates the file PROG_1.PLI:


To change from line mode to keypad mode, enter the CHANGE command at the asterisk prompt. To return to line mode from keypad mode, press Ctrl/z. To change from line mode to nokeypad mode, enter the SET NOKEYPAD command and then enter the CHANGE command.

When you invoke EDT to create a file, a journal file is created automatically. You can use this journal file to recover your edits if the system fails during an editing session. To recover your edits, enter the EDIT/RECOVER command.

EDT provides an online HELP facility that you can access during an editing session. In line mode, you can enter the HELP command. EDT displays general information on EDT as well as detailed information on both line-mode editing and nokeypad-mode editing. In keypad mode, you can press the Help key or the PF2 key. EDT displays a keypad diagram on your screen and a list of keypad editing keys. For help on a specific keypad function, press the key you want help on.

For more information on EDT, see the OpenVMS EDT Reference Manual.

2.2.2 Using LSE

The Language-Sensitive Editor (LSE), a component of the software engineering tool kit called DECset, is a multilanguage, programmable editor designed to help develop and maintain source code. LSE is layered on DECTPU, and is available with the EVE and EDT interfaces. LSE provides language-specific templates for each language it supports, including PL/I; these templates help the programmer build syntactically correct programs efficiently.

LSE provides the following features:

2.2.3 Using DECTPU

The DEC Text Processing Utility (DECTPU) is a high-performance, programmable utility. DECTPU provides two editing interfaces: the Extensible VAX Editor (EVE) and the DECTPU EDT Keypad Emulator. You can also create your own interfaces.

Like EDT, DECTPU provides you with an online HELP facility that you can access during your editing session. When you invoke DECTPU to create a file, a journal file is created automatically. You can use this journal file to recover your edits if the system fails during an editing session. To recover your edits, include the /RECOVER qualifier on the command line that invokes the editor.

Unlike EDT, DECTPU provides multiple windows. This feature allows you to view two files on your screen at the same time.

The following sections describe how to use the EVE interface and the EDT Keypad Emulator interface. The EVE Interface

EVE is an interactive text editor that allows you to execute common editing functions using the EVE keypad or to execute more advanced functions by entering commands on the EVE command line. The following command line invokes the EVE editor and creates the file PROG_1.PLI:


You can define a global symbol for the EDIT/TPU command by placing a symbol definition in your LOGIN.COM file. For example:


After this command line is executed, you can type EVE at the DCL prompt followed by the name of the file you want to modify or create.

For more information on using the advanced features of EVE, see the Guide to VMS Text Processing. The EDT Keypad Emulator Interface

The EDT Keypad Emulator interface provides all the keypad functions associated with EDT and uses the same keys to perform each function. It also provides a subset of the line editing commands of the EDT editor; however, it does not provide nokeypad editing. The following command line invokes the EDT Keypad Emulator:


You can define a global symbol for this command by placing a symbol definition in your LOGIN.COM file. For example:


When this command line is executed, you can enter EDTEM at the DCL prompt followed by the name of the file you want to create or modify. For example:


For more detailed information on how to use the EDT Keypad Emulator, see the Guide to VMS Text Processing.

2.3 Compiling a PL/I Program

The compiler performs the following functions:

The following sections discuss the PLI command and its qualifiers.

2.3.1 PLI Command

To invoke the compiler, use the PLI command. The PLI command has the following format:

PLI[/qualifier...][ file-spec [/qualifier...]],... 


Specifies an action to be performed by the compiler on all files or specific files listed. When a qualifier appears directly after the PLI command, it affects all files listed. However, when a qualifier appears after a file specification, it affects only the file that immediately precedes it. When files are concatenated, however, these rules do not apply.


Specifies an input source file that contains the program or module to be compiled. You are not required to specify a file type; the compiler adopts the default file type, PLI.

You can include more than one file specification on the same command line by separating the file specifications with either a comma (,) or a plus sign (+). If you separate the file specifications with commas, you can control which source files are affected by each qualifier. In the following example, the compiler creates an object file for each source file but creates only a listing file for the source files PROG_1 and PROG_3.


If you separate the file specifications with plus signs, the compiler concatenates each of the specified source files and creates one object file and one listing file. In the following example, only one object file is created, PROG_1.OBJ, and only one listing file is created, PROG_1.LIS. The two files are named after the first source file in the list but contain all three modules.


Note that a qualifier intended for one file affects other files also if the intended file is part of a list of files separated by plus signs.

You can specify a library file in a PLI command. To do this, you must precede the specification with a plus sign and use the /LIBRARY qualifier. For example:


This PLI command compiles the source program APPLIC.PLI and uses the library DATAB.TLB to locate any INCLUDE files that are referenced in the following format:

%INCLUDE text-module-name; 

The module name must not be enclosed in apostrophes.

When you specify more than one library, PL/I searches the libraries in the order specified each time it processes a %INCLUDE statement that specifies a text module name; for example:


When PL/I processes a %INCLUDE statement in the source file APPLIC.PLI, it searches for modules referenced in the libraries DATAB.TLB, NAMES.TLB, and GLOBALSYMS.TLB, in that order.

When you use a command that requests multiple compilations, you must specify a library for each compilation in which it is needed; for example:


In this example, PL/I compiles METRIC.PLI and APPLIC.PLI separately and uses the library DATAB.TLB for each compilation.

The order of appearance of the library file specification within a concatenated list of files is irrelevant. The following, for example, are equivalent:


You can define one of your private INCLUDE file libraries as a default library for the PL/I compiler to search. The compiler searches the default library after it searches libraries specified on the PLI command.

To define a default library, define an equivalence for the logical name PLI$LIBRARY, as follows:


While this assignment is in effect, the compiler automatically searches the library DATAB.TLB for any INCLUDE modules that it cannot locate in libraries explicitly specified on the PLI command.

You can define the logical name PLI$LIBRARY in the process, group, or system logical name table. If the name is defined in more than one table, the PL/I compiler uses the equivalence for the first match it finds in the normal order of search (that is, the process, then group, then system table). Thus, if PLI$LIBRARY is defined in both the process and group logical name tables, the process logical name table assignment overrides the group logical name table assignment.

When it cannot find INCLUDE modules in libraries specified on the PLI command or in the default library defined by PLI$LIBRARY, PL/I searches the library identified by the following name:

SYS$LIBRARY is normally defined by the system manager to identify the device and directory containing system libraries. PLI$STARLET.TLB is a library of INCLUDE modules supplied by PL/I. It contains declarations for the entry points for OpenVMS system services, local symbol definitions required for use with them, and variables to test their return status values. For more information on libraries, see the VMS Librarian Utility Manual.

Next Contents Index