Kednos PL/I for UNIX

User's Manual for Digital UNIX

April 1996

This manual gives an overview of the PL/I language and an explanation
of PL/I program development. It describes the operation of the
Kednos PL/I for UNIX compiler and the features of the Digital UNIX
operating system environment that are important to the PL/I
programmer.

 

 

 

Operating System and Version: Digital UNIX Version 3.2 and
higher

Software Version: Kednos PL/I for UNIX
Version 1.3

 

Kednos Corporation
Pebble Beach, California
Second Printing (Update), April 1996

Kednos Systems, Inc., 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 or an authorized sublicensor.

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

Restricted Rights: Use, duplication or disclosure by the U.S. Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013.

© Kednos Corporation, 1995, 1996, All Rights Reserved.

Kednos Corporation, Kednos PL/I, and Kednos VPO are trademarks of Kednos Corporation.

Alpha AXP, AXP, CDD, DEC,DEC 4000, DECwindows, Digital, OpenVMS AXP, ULTRIX, VAX, OpenVMS, VT102, VT220, VT240, VT320, VT330, VT340, and the DIGITAL logo are trademarks of Digital Equipment Corporation.

SAA and IBM are trademarks of International Business Machine Inc.

Stratus is a trademark of Stratus Computer Inc.

Kednos PL/I for UNIX includes the GNU readline and assembler software. See See for the entire text of the Free Software Foundation's GNU Copyleft.

Portions Copyright 1984-1990 FairCom Corporation. All Rights Reserved.

Kednos requests your critical evaluation to assist in preparing future documentation. Please send any comments to comments@Kednos.com or by physical mail to:

Kednos Corporation
1051 Rodeo Road
Pebble Beach, CA  93953

Table of Contents

Preface ix

Intended Audience ix

Structure of This Manual ix

Where to Find More Information x

Conventions x

Chapter 1 --

Overview of Kednos PL/I for UNIX 1-1

Chapter 2 --

Developing a PL/I Program 2-1

Creating Source Files 2-1

Compiling and Linking a PL/I Program 2-1

The pl1 Command 2-1

Compilation with pl1 2-2

Compiling Multi-Language Programs 2-4

Driver Options 2-4

Linking Objects using the pl1 Command 2-8

Run-Time Libraries 2-8

Library Search Path 2-9

PL/I Preprocessor 2-10

Preprocessor Compilation Control 2-11

Preprocessor Procedures 2-12

Compiler Listing Files 2-14

Compiler Error Messages 2-18

Running a PL/I Program 2-20

Run-Time Errors 2-20

Passing Command Line Parameters to a PL/I Program 2-20

Accessing Command Line Parameters in PL/I Programs 2-20

Specifying Command Line Parameters 2-22

Chapter 3 --

Using the dbg Debugger 3-1

Overview 3-1

General Information 3-3

Terminology 3-3

Accessing Data 3-6

Accessible Data 3-6

Accessing Static Data 3-6

Accessing Automatic and Parameter Data 3-7

Accessing Based Data 3-7

Qualifying Structure References 3-7

Referring to Arrays and Structures 3-8

Preparing to Use the Debugger 3-8

Compiling for the dbg Debugger 3-8

Debugging Optimized Programs 3-9

Starting and Ending a Debugging Session 3-10

The dbg Command 3-10

Creating .dbginit Files 3-11

Ending the Debugging Session 3-11

Using the dbg Command Line Editing Features 3-11

Getting Started with Command Line Editing 3-12

The Initialization File, ~/.inputrc 3-13

The Sample Program 3-14

The Debugger Commands 3-16

Debugger Error Messages 3-18

ALIAS 3-19

AUDIT 3-21

BREAK 3-22

CLEAR BREAK 3-26

CONTINUE 3-28

DESCRIBE 3-29

DIRECTORY 3-31

DOWN 3-32

ENVIRONMENT 3-33

EXIT 3-35

HELP 3-36

INITIALIZE 3-37

LIST 3-39

PLAYBACK 3-42

PROMPT 3-43

RECORD 3-44

REGISTER 3-45

SET 3-46

SHELL 3-48

SHOW 3-49

SIGNAL 3-51

STEP 3-53

UP 3-55

WALKBACK 3-56

Chapter 4 --

The File System 4-1

File Control 4-1

Using the UNIX File System for I/O 4-2

PL/I Files and UNIX File Specifications 4-2

Using the TITLE Option 4-3

Using Environment Variables 4-4

Environment Variables in TITLE Values 4-4

Process Standard System File Names 4-5

Expanding File Specifications 4-6

Error Handling 4-7

Values Returned by PL/I Built-In Functions for Error Handling 4-8

Writing an Error Handler 4-8

Default Error Handling for the File System 4-9

Chapter 5 --

File Organizations and Input/Output 5-1

File Organizations 5-1

Access Modes for Record I/O 5-3

Sequential Access 5-3

Direct Access 5-4

Direct and Sequential Access 5-4

Access by Record Identification 5-4

Record Formats 5-5

Fixed-Length Records 5-5

IBM Dialect Fixed Length Environment Options 5-5

Variable-Length Records 5-6

IBM Dialect Variable Length Environment Options 5-6

Stream Files 5-6

Stream Files Organization 5-6

Creating a Stream File 5-7

Appending Records to an Existing File 5-8

Superseding an Existing File 5-8

Relative Files 5-8

Relative File Organization 5-8

Creating a Relative File 5-9

Using Relative Files 5-10

Populating a Relative File 5-11

Updating a Relative File 5-12

Reading a Relative File Sequentially 5-12

Error Handling 5-13

Chapter 6 --

Options of the ENVIRONMENT Attribute 6-1

Specifying and Using Environment Options 6-1

Arguments for Environment Options 6-1

Expressions 6-2

Variable References 6-3

Boolean Values 6-3

Interpretation of ENVIRONMENT Options for Existing Files 6-3

Conflicting and Invalid ENVIRONMENT Options 6-3

Summary of ENVIRONMENT Options 6-4

APPEND Option 6-11

BLKSIZE Option 6-11

CONSECUTIVE Option 6-12

DEFAULT_FILE_NAME Option 6-12

DELETE Option 6-13

F, FB, FS, or FSB Option 6-14

FILE_ID Option 6-14

FILE_ID_TO Option 6-15

FIXED_LENGTH_RECORDS Option 6-16

GROUP_PROTECTION Option 6-16

MAXIMUM_RECORD_SIZE Option 6-17

OWNER_PROTECTION Option 6-18

RECORD_ID_ACCESS Option 6-19

RECSIZE Option 6-19

SCALARVARYING Option 6-20

SHARED_READ Option 6-22

SUPERSEDE Option 6-22

TEMPORARY Option 6-23

V, VB, VS, or VSB Option 6-24

WORLD_PROTECTION Option 6-25

ENVIRONMENT Options for File Protection and File Sharing 6-26

File Protection 6-26

Defining File Protection 6-27

File Sharing 6-28

Chapter 7 --

Input/Output Statement Options 7-1

Option Format 7-1

Summary of Input/Output Statement Options 7-2

NO_ECHO Option 7-3

PROMPT Option 7-3

PURGE_TYPE_AHEAD Option 7-4

RECORD_ID Option 7-5

RECORD_ID_TO Option 7-6

Chapter 8 --

File-Handling Built-In Subroutines 8-1

FLUSH Built-In Subroutine (DEC Dialect Only) 8-1

REWIND Built-In Subroutine (DEC Dialect Only) 8-2

Chapter 9 --

General Information 9-1

How the Sort Program Interface Works 9-2

Determining Which Entry Point to Use 9-3

Calling the Sort Subroutines 9-4

General Format of the Sort Interface Call 9-4

Specifying the Sort Fields 9-5

Specifying Record Information 9-7

Specifying Storage 9-8

Using the Return Code 9-9

Specifying Input and Output Routines 9-10

Specifying a File Prefix 9-10

Specifying Message Level 9-10

Input and Output Routines 9-11

Using the PLIRETC Built-In Subroutine 9-11

Writing Input Routines 9-12

Writing Output Routines 9-14

Programming Examples 9-15

Calling the PLISRTA Entry Point 9-15

Calling the PLISRTD Entry Point 9-16

Chapter 10 --

Error Handling 10-1

RESIGNAL Built-In Subroutine 10-1

VAXCONDITION Condition 10-2

ON-Unit Actions 10-4

Handling the Condition 10-4

Resignaling the Condition 10-5

Executing a Nonlocal GOTO 10-6

Stopping the Program 10-8

Relationship of UNIX Signals to PL/I ON-Units 10-8

Accessing the Signal Values 10-10

Modifying the ONCODE Values 10-11

Search Path for ON-Units 10-13

Default Handling for Main Procedures 10-14

Default Handling for Non-Main Procedures 10-15

Multiple Conditions 10-17

Scope of ON-Units 10-20

ON-Unit Examples 10-20

Condition-Handling Built-In Functions 10-22

ONCODE Built-In Function 10-22

ONFILE Built-In Function 10-24

ONKEY Built-In Function 10-24

Chapter 11 --

Using PL/I in the Common Language Environment 11-1

The UNIX Procedure Calling and Condition Handling Standard 11-2

Parameter-Passing Mechanisms 11-2

Passing Parameters by Reference 11-3

Using the ANY Attribute 11-3

Dummy Arguments for Arguments Passed by Reference 11-4

Using Pointer Values for Arguments Passed by Reference 11-5

Passing Arrays to a FORTRAN Routine by Reference 11-5

Passing Parameters by Value 11-5

Dummy Arguments for Arguments Passed by Value 11-7

Special Parameter Attributes 11-7

OPTIONS(VARIABLE) Option 11-8

OPTIONAL Attribute 11-8

TRUNCATE Attribute 11-9

Calling Routines 11-9

Determining the Type of Call 11-10

Declaring an External Routine and Its Arguments 11-10

Calling the External Routine 11-10

Appendix A --

GNU Software Information A-1

GNU Copyleft A-1

Preamble A-1

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION A-2

How to Apply These Terms to Your New Programs A-8

Figures

Figure 3-1. Specifying Environments 3-5

Figure 5-1. Relative File 5-9

Figure 10-1. Resignaling a Condition 10-6

Figure 10-2. Unwinding the Call Stack 10-7

Figure 10-3. Execution of an ON-Unit 10-14

Figure 10-4. Search for an ON-Unit 10-17

Figure 10-5. Effect of Multiple Conditions 10-18

Tables

Table P-1. Documentation Conventions Table xi

Table 2-1. Alphabetic List of PL/I Driver Options 2-4

Table 3-1. dbg Command Line Options 3-10

Table 3-2. Debugger Command Summary 3-17

Table 4-1. Default Process Stream Names 4-5

Table 4-2. System File Names for Get and Put Statements 4-5

Table 6-1. Description of Columns in Table 6-2 6-4

Table 6-2. Summary of DEC and ANSI Dialect ENVIRONMENT Options 6-5

Table 6-3. Summary of IBM Dialect ENVIRONMENT Options 6-6

Table 6-4. ENVIRONMENT Options That Are Ignored 6-7

Table 6-5. Default Record Sizes 6-18

Table 6-6. Default Record Sizes 6-20

Table 7-1. Summary of Input/Output Statement Options 7-2

Table 9-1. Entry Points for the Sort Program 9-3

Table 10-1. Corresponding Values 10-10

Table 10-2. ONCODE Values for PL/I ON Conditions 10-23

Table 11-1. Converted Data Types of Arguments Passed by Reference 11-4

Table 11-2. Assignment of Data Type to Dummy Arguments 11-7

Reader's Comments Card Back of Book
Figures

Figure 3-1. Specifying Environments 3-5

Figure 5-1. Relative File 5-9

Figure 10-1. Resignaling a Condition 10-6

Figure 10-2. Unwinding the Call Stack 10-7

Figure 10-3. Execution of an ON-Unit 10-14

Figure 10-4. Search for an ON-Unit 10-17

Figure 10-5. Effect of Multiple Conditions 10-18

Tables

Table P-1. Documentation Conventions Table xv

Table 2-1. Alphabetic List of PL/I Driver Options 2-4

Table 3-1. dbg Command Line Options 3-10

Table 3-2. Debugger Command Summary 3-17

Table 4-1. Default Process Stream Names 4-5

Table 4-2. System File Names for Get and Put Statements 4-5

Table 6-1. Description of Columns in Table 6-2 6-4

Table 6-2. Summary of DEC and ANSI Dialect ENVIRONMENT Options 6-5

Table 6-3. Summary of IBM Dialect ENVIRONMENT Options 6-6

Table 6-4. ENVIRONMENT Options That Are Ignored 6-7

Table 6-5. Default Record Sizes 6-18

Table 6-6. Default Record Sizes 6-20

Table 7-1. Summary of Input/Output Statement Options 7-2

Table 9-1. Entry Points for the Sort Program 9-3

Table 10-1. Corresponding Values 10-10

Table 10-2. ONCODE Values for PL/I ON Conditions 10-23

Table 11-1. Converted Data Types of Arguments Passed by Reference 11-4

Table 11-2. Assignment of Data Type to Dummy Arguments 11-7

Preface

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

Intended Audience

This manual is designed for programmers who have a working knowledge of PL/I and some familiarity with the Digital UNIX operating system and the C shell (csh).

Structure of This Manual

This manual is divided into the following sections:

  • See gives an overview of the Kednos PL/I for UNIX compiler.
  • See explains developing a PL/I program.
  • See explains debugging PL/I programs.
  • See describes the file system.
  • See explains record and stream input/output.