CONTENTS Title Page Copyright Page Preface 1 Program Structure and Content 1.1 Lexical Elements 1.1.1 Keywords 1.1.2 Punctuation 1.1.3 Identifiers 1.1.4 Comments 1.2 Statements 1.2.1 Statement Formats 1.2.2 Statement Labels 1.2.3 Simple Statements 1.2.4 Compound Statements 1.2.5 Summary of Statements by Function 1.3 Program Format 1.4 Blocks 1.4.1 Begin Blocks 1.4.2 Procedure Blocks 1.4.3 Containment 1.4.4 Block Activation 1.4.5 Relationship of Block Activations 1.4.6 Block Termination 1.5 Data and Variables 1.5.1 Preprocessor 2 Declarations 2.1 DECLARE Statement 2.1.1 Simple Declarations 2.1.2 Declarations Outside of Procedures 2.1.3 Multiple Simple Declarations 2.1.4 Factored Simple Declarations 2.1.5 Array Declarations 2.1.6 Structure Declarations 2.2 Attributes 2.2.1 ALIGNED Attribute 2.2.2 ANY Attribute 2.2.3 AREA Attribute 2.2.4 AUTOMATIC Attribute 2.2.5 BASED Attribute 2.2.6 BINARY Attribute 2.2.7 BIT Attribute 2.2.8 BUILTIN Attribute 2.2.9 CHARACTER Attribute 2.2.10 CONDITION Attribute 2.2.11 CONTROLLED Attribute 2.2.12 DECIMAL Attribute 2.2.13 DEFINED Attribute 2.2.14 DESCRIPTOR Attribute 2.2.15 DIMENSION Attribute 2.2.16 DIRECT Attribute 2.2.17 ENTRY Attribute 2.2.18 ENVIRONMENT Attribute 2.2.19 EXTERNAL Attribute 2.2.20 FILE Attribute 2.2.21 FIXED Attribute 2.2.22 FLOAT Attribute 2.2.23 GLOBALDEF Attribute 2.2.24 GLOBALREF Attribute 2.2.25 INITIAL Attribute 2.2.26 INPUT Attribute 2.2.27 INTERNAL Attribute 2.2.28 KEYED Attribute 2.2.29 LABEL Attribute 2.2.30 LIKE Attribute 2.2.31 LIST Attribute 2.2.32 MEMBER Attribute 2.2.33 NONVARYING Attribute 2.2.34 OFFSET Attribute 2.2.35 OPTIONAL Attribute 2.2.36 OUTPUT Attribute 2.2.37 PARAMETER Attribute 2.2.38 PICTURE Attribute 2.2.39 POINTER Attribute 2.2.40 POSITION Attribute 2.2.41 PRECISION Attribute 2.2.42 PRINT Attribute 2.2.43 READONLY Attribute 2.2.44 RECORD Attribute 2.2.45 REFER Attribute 2.2.46 REFERENCE Attribute 2.2.47 RETURNS Attribute 2.2.48 SEQUENTIAL Attribute 2.2.49 STATIC Attribute 2.2.50 STREAM Attribute 2.2.51 STRUCTURE Attribute 2.2.52 TYPE Attribute (VAX PL/I only) 2.2.53 TRUNCATE Attribute 2.2.54 UNALIGNED Attribute 2.2.55 UNION Attribute 2.2.56 UPDATE Attribute 2.2.57 VALUE Attribute 2.2.58 VARIABLE Attribute 2.2.59 VARYING Attribute 3 Data Types 3.1 Summary of Data Types 3.1.1 Declarations 3.1.2 Default Attributes 3.1.2.1 Attributes of Constants 3.1.2.2 Arithmetic Operands 3.1.3 Compatible Data Types 3.2 Arithmetic Data 3.2.1 Precision and Scale of Arithmetic Data Types 3.2.2 Fixed-Point Binary Data 3.2.2.1 Internal Representation of Fixed-Point Binary Data 3.2.3 Fixed-Point Decimal Data 3.2.3.1 Fixed-Point Decimal Constants 3.2.3.2 Fixed-Point Decimal Variables 3.2.3.3 Use in Expressions 3.2.3.4 Internal Representation of Fixed-Point Decimal Data 3.2.4 Floating-Point Data 3.2.4.1 Floating-Point Constants 3.2.4.2 Floating-Point Variables 3.2.4.3 Using Floating-Point Data in Expressions 3.2.4.4 Floating-Point Data Formats 3.2.4.5 VAX VMS Internal Representation of Floating-Point Data 3.2.4.6 RISC ULTRIX Internal Representation of Floating-Point Data 3.2.5 Pictured Data 3.2.5.1 Picture Characters 3.2.5.2 Assigning Values to Pictured Variables 3.2.5.3 Extracting Values from Pictured Data 3.2.5.4 Editing by Picture 3.2.5.5 The Internal Representation of Pictured Variables 3.3 Character-String Data 3.3.1 Character-String Constants 3.3.1.1 Replication of String Constants 3.3.2 Character-String Variables 3.3.2.1 Fixed-Length Character-String Variables 3.3.2.2 Internal Representation of Fixed-Length Character Data 3.3.2.3 Varying-Length Character-String Variables 3.3.2.4 Internal Representation of Varying Character Data 3.3.2.5 Alignment of Character Strings 3.4 Bit-String Data 3.4.1 Bit-String Constants 3.4.1.1 Replication Factor for Bit-String Constants 3.4.2 Bit-String Variables 3.4.3 Alignment of Bit-String Data 3.4.4 Internal Representation of Bit Data 3.4.5 Bit Strings and Integers 3.5 Pointer Data 3.5.1 Pointer Variables in Expressions 3.5.2 Internal Representation of Pointer Data 3.6 Offset Data 3.7 Label Data 3.7.1 Label Array Constants 3.7.2 Label Values 3.7.3 Label Variables 3.7.4 Internal Representation of Variable Label Data 3.8 Entry Data 3.8.1 Entry Constants 3.8.2 Entry Values 3.8.3 Entry Variables 3.8.4 Internal Representation of Variable Entry Data 3.9 File Data 3.9.1 File Constants 3.9.2 File Values 3.9.3 File Variables 3.10 Area Data 3.10.1 Area Variables in Expressions 3.10.2 Reading and Writing Areas 3.10.3 Internal Representation of Area Data 3.11 Condition Data 3.11.1 Internal Representation of Condition Data 4 Aggregates 4.1 Arrays 4.1.1 Array Declarations 4.1.2 References to Individual Elements 4.1.3 Initializing Arrays 4.1.4 Assigning Values to Array Variables 4.1.5 Order of Assignment and Output for Multidimensional Arrays 4.1.5.1 Using GET and PUT Statements with Array Variables 4.1.6 Passing Arrays as Arguments 4.1.7 Built-In Functions Providing Array Dimension Information 4.2 Structures 4.2.1 Structure Declarations and Attributes 4.2.2 Using The UNION Attribute On Structure Declarations 4.2.3 Initializing Structures 4.2.4 Using Structure Variables in Expressions 4.2.5 Passing Structure Variables as Arguments 4.2.6 Member Attributes 4.2.6.1 Using the TYPE Attribute (VAX PL/I only) 4.2.6.2 Using the LIKE Attribute 4.2.6.3 Using the REFER Option 4.2.7 Structure-Qualified References 4.3 Arrays of Structures 4.3.1 Arrays of Structures That Contain Arrays 4.3.2 Connected and Unconnected Arrays 4.4 Internal Representation of Aggregate Data 5 Storage Classes 5.1 Automatic Variables 5.2 Static Variables 5.3 Internal Variables 5.4 External Variables 5.5 Based Variables 5.5.1 Data Types Used with Based Variables 5.5.2 Allocation in Areas 5.5.3 Referring to Based Variables 5.5.4 Based Variables and Dynamic Storage Allocation 5.5.5 Using the ADDR Built-in Function 5.5.6 Data Type Matching for Based Variables 5.5.6.1 Matching by Overlay Defining 5.5.6.2 Matching by Left-to-Right Equivalence 5.5.6.3 Nonmatching Based Variable References 5.5.7 Examples of Based Variables 5.6 Controlled Variables 5.6.1 Using the ALLOCATION Built-In Function 5.6.2 Using the ADDR Built-In Function 5.7 Dynamically Allocated Variables 5.7.1 ALLOCATE Statement 5.7.2 FREE Statement 5.7.3 Other Mechanisms for Dynamic Storage Allocation 5.8 Defined Variables 5.8.1 String Overlay Defining 5.8.2 Rules for Overlay Defining 5.9 Storage Sharing 6 Expressions and Data Type Conversions 6.1 Assignment Statement 6.2 Operators and Operands 6.2.1 Arithmetic Operators 6.2.2 Logical Operators 6.2.2.1 NOT 6.2.2.2 AND 6.2.2.3 OR 6.2.2.4 EXCLUSIVE OR 6.2.2.5 AND THEN 6.2.2.6 OR ELSE 6.2.3 Relational Operators 6.2.3.1 Arithmetic Comparisons 6.2.3.2 Bit-String Comparisons 6.2.3.3 Character-String Comparisons 6.2.3.4 Comparing Noncomputational Data 6.2.4 Concatenation Operator 6.3 Precedence of Operators and Expression Evaluation 6.4 Data Type Conversion of Operands and Expressions 6.4.1 Contexts in which PL/I Converts Data 6.4.2 Derived Data Types for Arithmetic Operations 6.4.3 Conversion of Operands in Nonarithmetic Operations 6.4.4 Built-In Conversion Functions 6.4.5 Implicit Conversion During Assignment 6.4.6 Assignment to Arithmetic Variables 6.4.6.1 Arithmetic to Arithmetic Conversions 6.4.6.1.1 Conversions to Fixed Point 6.4.6.1.2 Conversions to Floating Point 6.4.6.1.3 Conversions from FIXED BINARY to Other Data Types 6.4.6.2 Pictured to Arithmetic Conversions 6.4.6.3 Bit-String to Arithmetic Conversions 6.4.6.4 Character-String to Arithmetic Conversions 6.4.7 Assignments to Bit-String Variables 6.4.7.1 Arithmetic to Bit-String Assignments 6.4.7.2 Pictured to Bit-String Conversions 6.4.7.3 Character-String to Bit-String Conversions 6.4.8 Assignments to Character-String Variables 6.4.8.1 Arithmetic to Character-String Conversions 6.4.8.1.1 Conversion from Fixed-Point Binary or Fixed-Point Decimal 6.4.8.1.2 Conversion from Floating-Point Binary or Floating-Point Decimal 6.4.8.2 Pictured to Character-String Conversion 6.4.8.3 Bit-String to Character-String Conversion 6.4.9 Assignments to Pictured Variables 6.4.10 Conversions Between Offsets and Pointers 7 Procedures 7.1 PROCEDURE Statement 7.2 Functions and Function References 7.3 ENTRY Statement 7.3.1 Specifying Entry Points 7.3.2 Multiple Entry Points 7.4 CALL Statement 7.5 Parameters and Arguments 7.5.1 Rules for Specifying Parameters 7.5.2 Argument Passing 7.6 Calling External and Internal Procedures 7.7 Terminating Procedures 7.8 Passing Arguments to Non-PL/I Procedures 7.8.1 Passing Arguments by Immediate Value 7.8.2 Passing Arguments by Reference 7.8.3 Passing Arguments by Descriptor 8 Program Control 8.1 DO Groups and Statements 8.1.1 Simple DO 8.1.2 DO WHILE 8.1.3 DO UNTIL 8.1.4 Controlled DO 8.1.5 DO REPEAT 8.2 BEGIN Statement 8.3 END Statement 8.4 IF Statement 8.4.1 Nested IF Statements 8.5 SELECT Statement 8.5.1 The Two Forms of the SELECT Statement 8.5.2 OTHERWISE Clause 8.5.3 Nested SELECT Statements 8.6 GOTO Statement 8.7 LEAVE Statement 8.8 STOP Statement 8.9 Null Statement 8.10 Condition Handling 8.10.1 ON Statement 8.10.2 SIGNAL Statement 8.10.3 REVERT Statement 8.10.4 Summary of ON Conditions 8.10.4.1 ANYCONDITION Condition Name 8.10.4.2 AREA Condition Name 8.10.4.3 CONDITION Condition Name 8.10.4.4 CONVERSION Condition Name 8.10.4.5 ENDFILE Condition Name 8.10.4.6 ENDPAGE Condition Name 8.10.4.7 ERROR Condition Name 8.10.4.8 FINISH Condition Name 8.10.4.9 FIXEDOVERFLOW Condition Name 8.10.4.10 KEY Condition Name 8.10.4.11 OVERFLOW Condition Name 8.10.4.12 STORAGE Condition Name 8.10.4.13 STRINGRANGE Condition Name (VAX PL/I only) 8.10.4.14 SUBSCRIPTRANGE Condition Name (VAX PL/I only) 8.10.4.15 UNDEFINEDFILE Condition Name 8.10.4.16 UNDERFLOW Condition Name (VAX PL/I only) 8.10.4.17 VAXCONDITION Condition Name 8.10.4.18 ZERODIVIDE Condition Name 8.10.5 Default PL/I ON-Unit 8.10.6 Establishment of ON-Units 8.10.7 Contents of an ON-Unit 8.10.8 Search Path for ON-Units 8.10.9 Completion of ON-Units 9 Input and Output 9.1 Opening and Closing Files 9.1.1 File Declarations 9.1.2 File Variables 9.1.3 Opening a File 9.1.3.1 OPEN Statement Options 9.1.3.2 Effects of Opening a File 9.1.3.3 Establishing the File's Attributes 9.1.3.4 Determining the File Specification 9.1.3.5 Accessing an Existing File 9.1.3.6 Creating a File 9.1.3.7 File Positioning 9.1.4 File Description Attributes and Options 9.1.5 Closing a File 9.2 Stream I/O 9.2.1 Processing and Positioning of Stream Files 9.2.2 Input by the GET Statement 9.2.2.1 Syntax Summary of the GET Statement 9.2.2.2 GET EDIT 9.2.2.3 GET LIST 9.2.2.4 GET SKIP 9.2.2.5 Execution of the GET Statement 9.2.3 Output by the PUT Statement 9.2.3.1 Syntax Summary of the PUT Statement 9.2.3.2 PUT EDIT 9.2.3.3 PUT LINE 9.2.3.4 PUT LIST 9.2.3.5 PUT PAGE 9.2.3.6 PUT SKIP 9.2.3.7 Execution of the PUT Statement 9.2.4 Format Items 9.2.4.1 A Format Item 9.2.4.2 B Format Items 9.2.4.3 COLUMN Format item 9.2.4.4 E Format Item 9.2.4.5 F Format Item 9.2.4.6 LINE Format Item 9.2.4.7 P Format Item 9.2.4.8 PAGE Format Item 9.2.4.9 R Format Item 9.2.4.10 SKIP Format Item 9.2.4.11 TAB Format Item 9.2.4.12 X Format Item 9.2.4.13 Format Specifications 9.2.5 Processing and Positioning of Character Strings 9.2.6 Terminal I/O 9.2.6.1 Simple Input from a Terminal 9.2.6.2 Simple Output to a Terminal 9.2.6.3 Print File 9.3 Record I/O 9.3.1 READ Statement 9.3.1.1 File Positioning Following a READ Statement 9.3.2 WRITE Statement 9.3.2.1 File Positioning Following a WRITE Statement 9.3.3 DELETE Statement 9.3.3.1 File Positioning Following a DELETE Statement 9.3.4 REWRITE Statement 9.3.4.1 File Positioning Following a REWRITE Statement 9.3.5 Position Information for a Record File 10 Preprocessor 10.1 Preprocessor Compilation Control 10.2 Preprocessor Statements 10.2.1 %Assignment Statement 10.2.2 %Null 10.2.3 %ACTIVATE 10.2.4 %DEACTIVATE 10.2.5 %DECLARE 10.2.6 %DICTIONARY (VAX PL/I only) 10.2.7 %DO 10.2.8 %END 10.2.9 %ERROR 10.2.10 %FATAL 10.2.11 %GOTO 10.2.12 %IF 10.2.13 %INCLUDE 10.2.14 %INFORM 10.2.15 %LIST_xxx 10.2.16 %NOLIST_xxx 10.2.17 %PAGE 10.2.18 %PROCEDURE 10.2.19 %REPLACE Statement 10.2.20 %RETURN Statement 10.2.21 %SBTTL 10.2.22 %TITLE 10.2.23 %WARN 10.3 User-Generated Diagnostic Messages 10.4 Preprocessor Built-In Functions 11 Built-In Functions, Subroutines, and Pseudovariables 11.1 Built-In Function Arguments 11.2 Conditions Signaled 11.3 Summary of Built-In Functions 11.4 Descriptions of Built-In Functions 11.4.1 ABS 11.4.2 ACOS 11.4.3 ACTUALCOUNT (VAX PL/I only) 11.4.4 ADD 11.4.5 ADDR 11.4.6 ADDREL (VAX PL/I only) 11.4.7 ALLOCATION 11.4.8 ASIN 11.4.9 ATAN 11.4.10 ATAND 11.4.11 ATANH 11.4.12 BINARY 11.4.13 BIT 11.4.14 BOOL 11.4.15 BYTE 11.4.16 BYTESIZE (VAX PL/I only) 11.4.17 CEIL 11.4.18 CHARACTER 11.4.19 COLLATE 11.4.20 COPY 11.4.21 COS 11.4.22 COSD 11.4.23 COSH 11.4.24 DATE 11.4.25 DATETIME 11.4.26 DECIMAL 11.4.27 DECODE 11.4.28 DESCRIPTOR 11.4.29 DIMENSION 11.4.30 DIVIDE 11.4.31 EMPTY 11.4.32 ENCODE 11.4.33 ERROR 11.4.34 EVERY 11.4.35 EXP 11.4.36 FIXED 11.4.37 FLOAT 11.4.38 FLOOR 11.4.39 HBOUND 11.4.40 HIGH 11.4.41 INDEX 11.4.42 INFORM 11.4.43 INT 11.4.44 LBOUND 11.4.45 LENGTH 11.4.46 LINE 11.4.47 LINENO 11.4.48 LOG 11.4.49 LOG10 11.4.50 LOG2 11.4.51 LOW 11.4.52 LTRIM (VAX PL/I only) 11.4.53 MAX 11.4.54 MAXLENGTH 11.4.55 MIN 11.4.56 MOD 11.4.57 MULTIPLY 11.4.58 NULL 11.4.59 OFFSET 11.4.60 ONARGSLIST 11.4.61 ONCHAR 11.4.62 ONCODE 11.4.63 ONFILE 11.4.64 ONKEY 11.4.65 ONSOURCE 11.4.66 PAGENO (VAX PL/I only) 11.4.67 POINTER 11.4.68 POSINT 11.4.69 PRESENT (VAX PL/I only) 11.4.70 PROD 11.4.71 RANK 11.4.72 REFERENCE 11.4.73 REVERSE 11.4.74 ROUND 11.4.75 RTRIM (VAX PL/I only) 11.4.76 SEARCH 11.4.77 SIGN 11.4.78 SIN 11.4.79 SIND 11.4.80 SINH 11.4.81 SIZE 11.4.82 SOME 11.4.83 SQRT 11.4.84 STRING 11.4.85 SUBSTR 11.4.86 SUBTRACT 11.4.87 SUM 11.4.88 TAN 11.4.89 TAND 11.4.90 TANH 11.4.91 TIME 11.4.92 TRANSLATE 11.4.93 TRIM 11.4.94 TRUNC 11.4.95 UNSPEC 11.4.96 VALID 11.4.97 VALUE 11.4.98 VARIANT 11.4.99 VERIFY 11.4.100 WARN 11.5 Built-In Subroutines 11.6 Pseudovariables 11.6.1 INT Pseudovariable 11.6.2 ONCHAR Pseudovariable 11.6.3 ONSOURCE Pseudovariable 11.6.4 PAGENO Pseudovariable (VAX PL/I only) 11.6.5 POSINT Pseudovariable 11.6.6 STRING Pseudovariable 11.6.7 SUBSTR Pseudovariable 11.6.8 UNSPEC Pseudovariable A Alphabetic Summary of Keywords B DEC Multinational Character Set C Compatibility with PL/I Standards C.1 Differences Between VAX PL/I and PL/I for RISC ULTRIX C.2 PL/I for RISC ULTRIX Support for Environment Options C.3 PL/I for RISC ULTRIX Support for Record I/O File Options C.4 PL/I for RISC ULTRIX Support for Built-In Functions C.5 PL/I for RISC ULTRIX Support for Condition Handling C.6 Relation to the 1981 PL/I General-Purpose Subset C.6.1 Program Structure C.6.2 Program Control C.6.3 Storage Control C.6.4 Input/Output C.6.5 Attributes and Pictures C.6.6 Built-In Functions and Pseudovariables C.6.7 Expressions C.7 198x PL/I General-Purpose Subset Features Supported C.7.1 Lexical Constructs C.7.2 Program Control C.7.3 Storage Control C.7.4 Input/Output C.7.5 Attributes and Pictures C.7.6 Program Control C.7.7 Built-In Functions and Pseudovariables C.7.8 Expressions C.8 Full PL/I Features Supported C.8.1 Program Structure C.8.2 Program Control C.8.3 Storage Control C.8.4 Attributes and Pictures C.8.5 Built-In Functions and Pseudovariables C.8.6 Expressions C.9 Nonstandard Features from Other Implementations C.9.1 Preprocessor C.9.2 Built-In Functions C.9.3 LIKE Extension C.9.4 Declarations C.10 PL/I-Specific Extensions for VAX VMS and RISC ULTRIX C.10.1 Procedure-Calling and Condition-Handling Extensions C.10.2 Support of VAX Record Management Services C.10.3 Miscellaneous Extensions C.11 Implementation-Defined Values and Features D Migration Notes D.1 Keywords Not Supported D.2 Miscellaneous Differences D.3 Implicit Conversions D.4 Printing a Hexadecimal Memory Dump E VAX PL/I and PL/I for RISC ULTRIX Language Summary E.1 Statements E.2 Attributes E.3 Expressions and Data Conversions E.4 Pseudovariables E.5 Built-In Subroutines EXAMPLES 1-1 Structure of a PL/I Program 7-1 Parameters and Arguments 7-2 Invoking an Internal Procedure 7-3 Invoking an External Procedure FIGURES 1-1 Relationship of Block Activations 3-1 Internal Representation of Fixed-Point Binary Data 3-2 VAX VMS Internal Representation of Floating-Point Data 4-1 Specifying Elements of an Array 4-2 Connected and Unconnected Arrays 5-1 External Variables 5-2 Using the ALLOCATE Statement 5-3 Using the READ Statement with a Based Variable 5-4 Using the ADDR Built-In Function 5-5 An Overlay Defined Variable 11-1 Example of the BOOL Built-In Function TABLES 1 Documentation Conventions Table 1-1 Punctuation Marks Recognized by PL/I 1-2 Summary of PL/I Statements 2-1 Alphabetic Summary of PL/I Attributes 3-1 Implied Attributes for Computational Data 3-2 Ranges of Floating-Point Formats 3-3 Ranges of Precision for Floating-Point Types 3-4 Floating-Point Types Used by PL/I 3-5 Picture Characters 3-6 ASCII Representation of Encoded-Sign Digits 4-1 Specifying Array Dimensions 4-2 Natural Alignment for Structure Members 6-1 Data Types for Assignment Statement 6-2 Precedence of Operators 6-3 Contexts in Which PL/I Converts Data 6-4 Derived Data Types 6-5 Converted Precision as a Function of Target and Source Attributes 6-6 Built-In Functions for Conversions Between Arithmetic and Nonarithmetic Types 8-1 Summary of ON Conditions 9-1 File Description Attributes Implied when a File is Opened 9-2 Summary of File Description Attributes 9-3 Attributes and Access Modes for Stream Files 9-4 Attributes and Access Modes for VAX VMS Record Files 9-5 Attributes and Access Modes for RISC ULTRIX Record Files 10-1 Summary of PL/I Preprocessor Statements 10-2 Summary of PL/I Preprocessor Built-In Functions 11-1 Summary of PL/I Built-In Functions 11-2 Summary of PL/I Built-In Subroutines A-1 PL/I Keywords D-1 PL/I Keywords Not Supported