CONTENTS Title Page Copyright Page Preface Summary of Technical Changes Part I Developing VAX COBOL Programs 1 Overview of VAX COBOL 2 Developing VAX COBOL Programs at DCL Command Level 2.1 Choosing a Reference Format 2.1.1 Terminal Reference Format 2.1.2 ANSI Reference Format 2.1.3 Converting Between Reference Formats 2.2 DCL Commands for Program Development 2.3 Creating a VAX COBOL Program 2.4 Using the COPY Statement in Your Source Program 2.5 Compiling a VAX COBOL Program 2.5.1 The COBOL Command 2.5.2 COBOL Command Qualifiers 2.5.3 Compiling Programs with Conditional Compilation Lines 2.5.4 Compiler Error Messages 2.5.5 Compiler Listings 2.5.5.1 Source Program Listing 2.5.5.2 Storage Map Portion of Compiler Listing 2.5.5.3 Compilation Summary 2.5.5.4 Compiler Listing Including the /MACHINE_CODE Qualifier 2.5.5.5 Compiler Listing for a Contained Program 2.6 Linking a VAX COBOL Program 2.6.1 The LINK Command 2.6.2 LINK Command Qualifiers 2.6.3 Positional Qualifiers 2.6.4 Using an Object Module Library 2.6.5 Object Libraries 2.6.5.1 Using System-Supplied Object Module Libraries 2.6.5.2 Defining the Search Order for Libraries 2.6.5.3 Default User Object Module Libraries 2.6.5.4 System Libraries 2.6.6 Shareable Images 2.6.6.1 Creating a Shareable Image 2.6.6.2 Using Transfer Vectors 2.6.7 Linker Error Messages 2.7 Running a VAX COBOL Program 2.7.1 COBOL Run-Time Errors 2.8 Program Switches 2.8.1 Setting Switches Internally 2.8.2 Setting Switches for a Process 2.8.3 Order of Evaluation 2.8.4 Checking and Controlling Switch Settings 2.8.5 Example Using Program Switches 3 Using the VMS Debugger 3.1 VMS Debugger Concepts 3.2 Features of the Debugger 3.3 Getting Started with the Debugger 3.3.1 Compiling and Linking to Prepare for Debugging 3.3.1.1 Establishing the Debugging Configuration 3.3.2 Starting and Ending a Debugging Session 3.3.3 Issuing Debugger Commands 3.4 Notes on VAX COBOL Support 3.5 Sample Debugging Session Part II Using VAX COBOL Features on VMS 4 Numeric Data Handling 4.1 How the Compiler Stores Numeric Data 4.2 Sign Conventions 4.3 Invalid Values in Numeric Items 4.4 Evaluating Numeric Items 4.4.1 Numeric Relation Tests 4.4.2 Numeric Sign Tests 4.4.3 Numeric Class Tests 4.4.4 Success/Failure Tests 4.5 Using the MOVE Statement 4.5.1 Elementary Numeric Moves 4.5.2 Elementary Numeric Edited Moves 4.5.3 Common Move Errors 4.6 Using the Arithmetic Statements 4.6.1 Intermediate Results 4.6.2 Specifying a Truncation Qualifier 4.6.3 Using the ROUNDED Phrase 4.6.3.1 ROUNDED with REMAINDER 4.6.4 Using the SIZE ERROR Phrase 4.6.5 Using the GIVING Phrase 4.6.6 Multiple Operands in ADD and SUBTRACT Statements 4.6.7 Common Errors in Arithmetic Statements 4.7 Arithmetic Expression Processing 5 Nonnumeric Data Handling 5.1 Data Organization 5.1.1 Group Items 5.1.2 Elementary Items 5.2 Special Characters 5.3 Testing Nonnumeric Items 5.3.1 Relation Tests of Nonnumeric Items 5.3.1.1 Classes of Data 5.3.1.2 Comparison Operations 5.3.2 Class Tests for Nonnumeric Items 5.4 Data Movement 5.5 Using the MOVE Statement 5.5.1 Group Moves 5.5.2 Elementary Moves 5.5.2.1 Edited Moves 5.5.2.2 Justified Moves 5.5.3 Multiple Receiving Items 5.5.4 Subscripted Moves 5.5.5 Common Nonnumeric Item MOVE Statement Errors 5.5.6 Using the MOVE CORRESPONDING Statement for Nonnumeric Items 5.5.7 Using Reference Modification 6 Table Handling 6.1 Defining Tables 6.1.1 Defining Fixed-Length, One-Dimensional Tables 6.1.2 Defining Fixed-Length, Multidimensional Tables 6.1.3 Defining Variable-Length Tables 6.1.4 Storage Allocation for Tables 6.1.4.1 Using the SYNCHRONIZED Clause 6.2 Initializing Values of Table Elements 6.3 Accessing Table Elements 6.3.1 Subscripting 6.3.2 Subscripting with Literals 6.3.3 Subscripting with Data Names 6.3.4 Subscripting with Indexes 6.3.5 Relative Indexing 6.3.6 Index Data Items 6.3.7 Assigning Index Values Using the SET Statement 6.3.7.1 Assigning an Integer Index Value with a SET Statement 6.3.7.2 Incrementing an Index Value with the SET Statement 6.3.8 Identifying Table Elements Using the SEARCH Statement 6.3.8.1 Implementing a Sequential Search 6.3.8.2 Implementing a Binary Search 7 Using the STRING, UNSTRING, and INSPECT Statements 7.1 Concatenating Data Using the STRING Statement 7.1.1 Multiple Sending Items 7.1.2 Using the DELIMITED BY Phrase 7.1.3 Using the POINTER Phrase 7.1.4 Using the OVERFLOW Phrase 7.1.5 Common STRING Statement Errors 7.2 Separating Data Using the UNSTRING Statement 7.2.1 Multiple Receiving Items 7.2.2 Controlling Moved Data Using the DELIMITED BY Phrase 7.2.2.1 Multiple Delimiters 7.2.3 Using the COUNT Phrase 7.2.4 Saving UNSTRING Delimiters Using the DELIMITER Phrase 7.2.5 Controlling UNSTRING Scanning Using the POINTER Phrase 7.2.6 Counting UNSTRING Receiving Items Using the TALLYING Phrase 7.2.7 Exiting an UNSTRING Statement Using the OVERFLOW Phrase 7.2.8 Common UNSTRING Statement Errors 7.3 Examining and Replacing Characters Using the INSPECT Statement 7.3.1 Using the TALLYING and REPLACING Options of the INSPECT Statement 7.3.2 Restricting Data Inspection Using the BEFORE/AFTER Phrase 7.3.3 Implicit Redefinition 7.3.4 Examining the INSPECT Operation 7.3.4.1 Setting the Scanner 7.3.4.2 Active/Inactive Arguments 7.3.4.3 Finding an Argument Match 7.3.5 The TALLYING Phrase 7.3.5.1 The Tally Counter 7.3.5.2 The Tally Argument 7.3.5.3 The Tally Argument List 7.3.5.4 Interference in Tally Argument Lists 7.3.6 Using the REPLACING Phrase 7.3.6.1 The Search Argument 7.3.6.2 The Replacement Value 7.3.6.3 The Replacement Argument 7.3.6.4 The Replacement Argument List 7.3.6.5 Interference in Replacement Argument Lists 7.3.7 Using the CONVERTING Option 7.3.8 Common INSPECT Statement Errors 8 The Basics of Handling VAX COBOL Files and Records 8.1 VAX Record Management Services 8.2 File Attributes 8.3 Record Attributes 8.3.1 Record Format 8.3.1.1 Fixed-Length Records 8.3.1.2 Variable-Length Records 8.3.2 Print-Controlled Files 8.4 File Design Considerations 8.5 File Handling 8.5.1 Identifying a File from Your VAX COBOL Program 8.5.1.1 Using the VALUE OF ID Clause for Device Independence 8.5.1.2 Using Logical Names 8.5.2 Choosing File Organization and Record Access Mode 8.5.2.1 File Organizations 8.5.2.2 Record Access Modes 8.6 Opening and Closing Files 8.7 File Compatibility 8.7.1 Data Type Differences 8.7.2 Data Record Formatting Differences 8.8 Backing Up Your Files 8.9 Low-Volume I/O (ACCEPT and DISPLAY) 8.9.1 Mnemonic Names (SPECIAL-NAMES Paragraph) 8.9.2 Logical Name Devices 8.9.3 ACCEPT Statement 8.9.4 DISPLAY Statement 8.10 Printing with VAX VFP 9 Processing Sequential Files 9.1 Sequential File Organization 9.2 Design Considerations 9.3 Statements for Sequential File Processing 9.4 Defining a Sequential File 9.5 Creating a Sequential File 9.6 Reading a Sequential File 9.7 Updating Records in a Sequential File 9.8 Extending a Sequential File 10 Processing Relative Files 10.1 Relative File Organization 10.2 Design Considerations 10.3 Statements for Relative File Processing 10.4 Defining a Relative File 10.5 Creating a Relative File 10.5.1 Sequential Access Mode Creation 10.5.2 Random Access Mode Creation 10.6 Reading a Relative File 10.6.1 Sequential Reading 10.6.2 Random Reading 10.6.3 Dynamic Reading 10.7 Updating a Relative File 10.7.1 Rewriting Relative Records 10.7.1.1 Sequential Access Mode Rewriting 10.7.1.2 Random Access Mode Rewriting 10.7.2 Deleting Relative Records 10.7.2.1 Sequential Access Mode Deletion 10.7.2.2 Random Access Mode Deletion 11 Processing Indexed Files 11.1 Indexed File Organization 11.2 Design Considerations 11.3 Statements for Indexed File Processing 11.4 Defining an Indexed File 11.5 Creating and Populating an Indexed File 11.6 Reading an Indexed File 11.6.1 Sequential Reading 11.6.2 Random Reading 11.6.3 Dynamic Reading 11.7 Updating an Indexed File 11.7.1 Sequential Updating 11.7.2 Random Updating 11.7.3 Dynamic Updating 12 Input/Output Exception Conditions Handling 12.1 Planning for the At End Condition 12.2 Planning for the Invalid Key Condition 12.3 Using File Status Values 12.3.1 VAX COBOL File Status Values 12.3.2 RMS File Status Values 12.4 Using Declarative Procedures to Handle Exception Conditions 13 Sharing Files and Protecting Records 13.1 File-Sharing and Record-Locking Concepts 13.2 Ensuring Successful File Sharing 13.2.1 Providing Disk Residency 13.2.2 Using VMS File Protection 13.2.3 Determining the Intended Access Mode to a File 13.2.4 Indicating the Access Allowed to Other Streams 13.2.5 Describing Types of Access Streams 13.2.6 Summarizing Related File-Sharing Criteria 13.2.7 Checking File Operations 13.2.8 Specifying the OPEN EXTEND in a File-Sharing Environment 13.2.8.1 OPEN EXTEND with a Shared Sequential File 13.2.8.2 OPEN EXTEND with a Shared Relative File 13.2.8.3 OPEN EXTEND with a Shared Indexed File 13.3 Using Record Locking 13.3.1 Specifying Automatic Record Locking 13.3.2 Specifying Manual Record Locking 13.3.3 Locking Error Conditions 13.3.3.1 Hard Record Locks 13.3.3.2 Soft Record Locks 13.3.4 Releasing Locks on Deleted Records 13.3.5 Bypassing a Record Lock 14 Using the COBOL SORT and MERGE Statements 14.1 ASCENDING and DESCENDING KEY Phrases 14.1.1 Sorting Concepts 14.2 USING and GIVING Phrases 14.3 INPUT PROCEDURE and OUTPUT PROCEDURE Phrases 14.4 WITH DUPLICATES IN ORDER Phrase 14.5 COLLATING SEQUENCE IS Alphabet-Name Phrase 14.6 File Organization 14.7 Multiple Sorts 14.8 Sorting Variable-Length Records 14.9 Preventing I/O Aborts 14.10 The MERGE Statement 14.11 Sample Programs Using the SORT and MERGE Statements 15 Database Programming with VAX COBOL 15.1 The Self-Paced Demonstration Package 15.2 VAX COBOL Data Manipulation Language (DML) 15.3 Creating a VAX COBOL DML Program 15.4 Compiling a VAX COBOL DML Program 15.4.1 Copying Database Records in a VAX COBOL Program 15.4.2 Using the /MAP Compiler Qualifier 15.5 Linking a VAX COBOL DML Program 15.6 Running a VAX COBOL DML Program 15.7 A Database 15.8 Schema 15.9 Storage Schema 15.10 Subschema 15.11 Stream 15.12 Using CDD/Plus 15.13 Database Records 15.14 Database Data Item 15.15 Database Key 15.16 Record Types 15.17 Set Types 15.18 Sets 15.18.1 Simple Set Relationships 15.18.1.1 System-Owned Sets 15.18.1.2 Simple Sets 15.18.1.3 Forked Sets 15.18.2 Multiset Relationships 15.18.2.1 Many-to-Many Relationships Between Two Types of Records 15.18.2.2 Many-to-Many Relationships Between Records of the Same Type 15.18.2.3 One-to-Many Relationships Between Records of the Same Type 15.19 Areas 15.20 Realms 15.21 Run Unit 15.22 Currency Indicators 15.22.1 Current of Realm 15.22.2 Current of Set Type 15.22.3 Current of Record Type 15.22.4 Current of Run Unit 15.23 Currency Indicators in a VAX COBOL DML Program 15.23.1 Using the RETAINING Clause 15.23.2 Using Keeplists 15.23.3 Transactions and Quiet Points 15.24 VAX COBOL DML Programming-Tips and Techniques 15.24.1 The Ready Modes 15.24.1.1 Record Locking 15.24.2 COMMIT and ROLLBACK 15.24.3 The Owner and Member Test Condition 15.24.4 Using IF EMPTY Instead of IF OWNER 15.24.5 Modifying Members of Sorted Sets 15.24.6 CONNECT and DISCONNECT 15.24.7 RECONNECT 15.24.8 ERASE ALL 15.24.9 ERASE Record-Name 15.24.10 Freeing Currency Indicators 15.24.10.1 Establishing a Known Currency Condition 15.24.10.2 Releasing Record Locks 15.24.11 FIND and FETCH Statements 15.24.12 FIND ALL Option 15.24.13 FIND NEXT and FETCH NEXT Loops 15.24.14 Qualifying FIND and FETCH 15.25 Handling Database Exception Conditions 15.25.1 AT END Phrase 15.25.2 ON ERROR Phrase 15.25.3 USE Statement 15.25.4 How to Translate DB-CONDITION Values to Exception Messages 15.26 Debugging and Testing VAX COBOL DML Programs 15.27 DBQ Commands and DML Statements 15.28 Sample Debugging and Testing Session 15.29 Reading a VAX COBOL Subschema Map Listing 15.29.1 PARTSS1 Subschema Map Listing 15.29.2 PARTSS3 Subschema Map Listing 15.30 Examples 15.30.1 Populating a Database 15.30.2 Backing Up a Database 15.30.3 Accessing and Displaying Database Information 15.30.4 PARTBOM Sample Run 15.30.5 Creating Relationships Between Records of the Same Type 15.30.6 STOOL Program Parts Breakdown Report-Sample Run 15.30.7 Creating New Record Relationships 15.30.7.1 PERSONNEL-UPDATE Sample Run-Listing Before Promotion 15.30.7.2 PERSONNEL-UPDATE Sample Run-Listing After Promotion 16 Producing Printed Reports with VAX COBOL 16.1 Designing the Report 16.2 Components of a Report 16.3 Accumulating and Reporting Totals 16.4 The Logical Page and the Physical Page 16.5 Programming the Conventional VAX COBOL Report 16.5.1 Defining the Logical Page in a Conventional Report 16.5.2 Controlling the Spacing in a Conventional Report 16.5.3 Advancing to the Next Logical Page in a Conventional Report 16.5.3.1 Programming for the Page-Overflow Condition in a Conventional Report 16.5.3.2 Using a Line Counter 16.5.4 Printing the Conventional Report 16.5.5 A Conventional File Report Example 16.6 Programming the Linage-File VAX COBOL Report 16.6.1 Defining the Logical Page in a Linage-File Report 16.6.2 Controlling the Spacing in a Linage-File Report 16.6.3 Using the LINAGE-COUNTER 16.6.4 Advancing to the Next Logical Page in a Linage-File Report 16.6.5 Programming for the Page-Overflow Condition 16.6.6 Printing a Linage-File Report 16.6.7 A Linage-File Report Example 16.7 Modes for Printing Reports 16.7.1 Directly Allocating a Printer 16.7.2 Spooling to a Mass Storage Device 16.8 Programming the Report Writer Report 16.8.1 Using the REPORT Clause in the File Section 16.8.2 Defining the Report Section and the Report File 16.8.3 Defining a Report Writer Logical Page with the PAGE Clause 16.8.4 Describing Report Group Description Entries 16.8.5 Vertical Spacing for the Logical Page 16.8.6 Horizontal Spacing for the Logical Page 16.8.7 Assigning a Value in a Print Line 16.8.8 Defining the Source for a Print Field 16.8.9 Specifying Multiple Reports 16.8.10 Generating and Controlling Report Headings and Footings 16.8.11 Defining and Incrementing Totals 16.8.11.1 Subtotaling 16.8.11.2 Crossfooting 16.8.11.3 Rolling-Forward 16.8.11.4 RESET Option 16.8.11.5 UPON Option 16.8.12 Restricting Print Items 16.8.13 Processing a Report Writer Report 16.8.13.1 Initiating the Report 16.8.13.2 Generating a Report Writer Report 16.8.13.3 Automatic Operations of the GENERATE Statement 16.8.13.4 Ending Report Writer Processing 16.8.13.5 Applying the USE BEFORE REPORTING Statement 16.8.13.6 Suppressing a Report Group 16.8.14 Selecting a Report Writer Report Type 16.8.14.1 Detail Reporting 16.8.14.2 Summary Reporting 16.9 Report Writer Examples 16.9.1 Input Data 16.9.2 REPORT1-Detail Report Program 16.9.3 REPORT2-Detail Report Program 16.9.4 REPORT3-Detail Report Program 16.9.5 REPORT4-Detail Report Program 16.9.6 REPORT5-Summary Report Program 16.10 Solving Report Problems 16.10.1 Printing More Than One Logical Line on a Single Physical Line 16.10.2 Group Indicating 16.10.3 Fitting Reports on the Page 16.10.4 Printing Totals Before Detail Lines 16.10.5 Underlining Items in Your Reports 16.10.6 Bolding Items in Your Reports 17 Forms for Video Terminals 17.1 Clearing a Screen Area 17.2 Horizontal and Vertical Positioning of the Cursor 17.3 Assigning Character Attributes to Your Format Entries 17.4 Using the CONVERSION Clause to Display Data 17.5 Handling Data with ACCEPT Options 17.5.1 Using CONVERSION with ACCEPT Data 17.5.2 Using ON EXCEPTION When Accepting Data with CONVERSION 17.5.3 Protecting Your Screen 17.5.4 Using NO ECHO with ACCEPT Data 17.5.5 Assigning Default Values to Data Fields 17.6 Using Keys on Your Terminal to Define Special Program Functions 17.7 Using the EDITING Phrase 18 Interprogram Communication 18.1 Multiple COBOL Program Run-Unit Concepts 18.1.1 Definition of a Multiple COBOL Program Run Unit 18.1.2 Examples of COBOL Run Units 18.1.3 Calling Procedures 18.2 COBOL Program Attributes 18.2.1 The INITIAL Clause 18.2.2 The EXTERNAL Clause 18.3 Transferring Execution Control 18.3.1 The CALL Statement 18.3.2 The EXIT PROGRAM Statement 18.3.3 Nesting CALL Statements 18.4 Accessing Another Program's Data Division 18.4.1 The USING Phrase 18.4.1.1 The Linkage Section 18.5 Communicating with Contained COBOL Programs 18.5.1 The COMMON Clause 18.5.2 Defining and Using the GLOBAL Clause 18.5.2.1 Sharing Data 18.5.2.2 Sharing Files 18.5.2.3 Sharing Database Resources 18.5.2.4 Sharing Other Resources 18.5.3 Sharing USE Procedures 18.6 Including Non-COBOL Programs in the Run Unit 18.7 Using VAX COBOL in the Common Language Environment 18.8 The VAX Procedure Calling and Condition Handling Standard 18.8.1 Register and Stack Usage 18.8.2 Return of the Function Value 18.8.3 The Argument List 18.9 VMS Run-Time Library Routines 18.10 VMS System Services Routines 18.11 Calling Routines 18.11.1 Determining the Type of Call 18.11.2 Defining the Argument 18.11.3 Calling the External Routine 18.11.4 Calling System Routines 18.11.4.1 System Routine Arguments 18.11.4.2 Calling a System Routine in a Function Call 18.11.4.3 Calling a System Routine in a Procedure Call 18.11.5 Checking the Condition Value 18.11.5.1 Library Return Status and Condition Value Symbols 18.11.6 Locating the Result 18.12 Calling Shareable Images 18.13 Examples 18.14 Additional Information Part III VAX COBOL Programming Options and Performance Considerations 19 Using the REFORMAT Utility 19.1 ANSI-to-Terminal Format Conversion 19.1.1 ANSI-to-Terminal REFORMAT Command String 19.2 Terminal-to-ANSI Format Conversion 19.2.1 Terminal-to-ANSI REFORMAT Command String 19.3 REFORMAT Error Messages 20 Optimizing Your VAX COBOL Program 20.1 VAX Subset Processors and the /INSTRUCTION_SET Qualifier 20.1.1 Overview of VAX Architectural Subsetting 20.1.2 Performance Slowdowns for a Minority of Applications on Subset Processors 20.1.3 Determining Whether You Have a Subset Processor 20.1.4 The /INSTRUCTION_SET Qualifier 20.2 Using BINARY (COMP) Data Items for Speed on Subset Processors 20.3 Other Ways to Improve the Performance of Operations on Numeric Data 20.3.1 Avoiding DISPLAY Data Items in Arithmetic Operations 20.3.2 Mixing Scale Factors and Data Types 20.3.3 Using Significant Digits 20.4 Choices in Procedure Division Statements 20.4.1 Using GO TO DEPENDING ON Instead of IF, GO TO 20.4.2 Using Indexing Instead of Subscripting 20.4.3 Using PERFORM n TIMES Instead of PERFORM VARYING 20.4.4 Using SEARCH ALL Instead of SEARCH 20.5 I/O Operations 20.5.1 Using the APPLY Clause 20.5.1.1 Using the PREALLOCATION Phrase of the APPLY Clause 20.5.1.2 Using the EXTENSION Phrase of the APPLY Clause 20.5.1.3 Using the DEFERRED-WRITE Phrase of the APPLY Clause 20.5.1.4 Using the FILL-SIZE ON Phrase of the APPLY Clause 20.5.1.5 Using the WINDOW Phrase of the APPLY Clause 20.5.2 Using Multiple Buffers 20.5.3 Sharing Record Areas 20.6 Optimizing File Design 20.6.1 Sequential Files 20.6.2 Relative Files 20.6.2.1 Maximum Record Number (MRN) 20.6.2.2 Cell Size 20.6.2.3 Bucket Size 20.6.2.4 File Size 20.6.3 Indexed Files 20.6.3.1 Optimizing Indexed File I/O 20.6.3.2 Calculating Key Index Levels 20.6.3.3 Caching Index Roots A Compiler Implementation Limitations B Error Messages B.1 Run-Time Errors B.1.1 Sample Run-Time Error B.2 Program Run Errors B.2.1 Faulty Data B.2.2 Program Logic Errors B.3 Run-Time Input/Output Errors B.4 Compiler Messages C Using the COBOL-81 SUBSET Flagger C.1 Using VAX COBOL to Produce Compatible COBOL-81 Source Programs C.2 Using the /STANDARD=PDP11 Qualifier C.3 VAX COBOL Flagging Procedures C.4 Source Level Differences and Incompatibilities C.4.1 General Language Concepts C.4.2 Unsupported Language Elements by Division C.5 Alignment of COMP Data Items D Additional Information on COBOL Command Qualifiers D.1 Using the /FLAGGER Qualifier D.1.1 /FLAGGER Options D.1.2 FIPS Levels D.2 Differences Using /STANDARD=85 and /STANDARD=V3 D.2.1 Overview D.2.2 DIVIDE Statement D.2.3 STRING Statement D.2.4 UNSTRING Statement D.2.5 INSPECT Statement D.2.6 PERFORM ... VARYING ... AFTER Statement D.2.7 PIC P Digits D.2.8 Size of Variable-Length Tables D.2.9 EXIT PROGRAM Statement D.2.10 New and Revised I-O Status Codes D.2.10.1 No Valid Next Record Condition D.2.11 OPEN I-O and EXTEND Modes E Optional Programming Productivity Tools E.1 VAX Language-Sensitive Editor (LSE) and the VAX Source Code Analyzer (SCA) E.1.1 Preparing an SCA Library E.1.2 Starting and Terminating an LSE or an SCA Session E.1.3 Compiling from Within LSE E.1.4 Notes on VAX COBOL Support E.1.4.1 Programming Language Placeholders and Tokens E.1.4.2 Placeholder and Design Comment Processing E.1.5 LSE and SCA Examples E.1.5.1 Data Definition E.1.5.2 IF Statement E.2 VAX CDD/Plus E.2.1 Overview of Data Dictionaries E.2.2 CDD/Plus Features E.2.3 CDD/Plus Concepts E.2.3.1 CDD/Plus Dictionary Formats E.2.3.2 Dictionary Path Names E.2.3.3 Dependency Recording E.2.3.4 Compiled Module Entities E.2.3.5 Entities E.2.3.6 Relationships E.2.3.7 Pieces Tracking E.2.3.8 Distributed Dictionary Access E.2.3.9 Data Security and Integrity E.2.3.10 CDD/Plus Call Interface E.2.4 Creating Data Definitions E.2.5 Accessing Data Definitions E.2.5.1 Using the COPY FROM DICTIONARY Statement E.2.5.2 Using the RECORD DEPENDENCY Statement E.2.6 Using the /DEPENDENCY_DATA Qualifier E.2.7 Viewing CDD/Plus Relationships E.2.8 VAX COBOL Support for CDD/Plus Data Types E.3 VAX COBOL GENERATOR E.3.1 VAX COBOL GENERATOR Features E.4 VAX Data Base Management System (VAX DBMS) E.5 VAX DEC/Test Manager E.6 VAX DEC/Code Management System (CMS) EXAMPLES 2-1 Main Program and Subprograms 2-2 Command Procedure to Link a Program as a Shareable Image 2-3 Transfer Vectors 2-4 Using Program Switches 3-1 Source Code Used in the Sample Debug Session 4-1 Success/Failure Test 5-1 Item Concatenation Using Two MOVE Statements 5-2 Sample Record Description Using the MOVE CORRESPONDING Statement 6-1 One-Dimensional Table 6-2 Multiple Data Items in a One-Dimensional Table 6-3 Defining a Table with an Index and an Ascending Search Key 6-4 Defining a Two-Dimensional Table 6-5 Defining a Three-Dimensional Table 6-6 Defining a Variable-Length Table 6-7 Sample Record Description Defining a Table 6-8 Record Description Containing a COMP SYNC Item 6-9 Adding an Item Without Changing the Table Size 6-10 How Adding 3 Bytes Adds 4 Bytes to the Element Length 6-11 Initializing Tables with the VALUE Clause 6-12 Initializing a Table with the OCCURS Clause 6-13 Initializing Mixed Usage Items 6-14 Initializing Alphanumeric Items 6-15 Using a Literal Subscript to Access a Table 6-16 Subscripting a Multidimensional Table 6-17 Subscripting with Index Name Items 6-18 Sample Table 6-19 A Serial Search 6-20 Using SEARCH and Varying an Index Other Than the First Index 6-21 Using SEARCH and Varying an Index Data Item 6-22 Using SEARCH and Varying an Index Not Associated with the Target Table 6-23 Doing a Serial Search Without Using the VARYING Phrase 6-24 A Multiple-Key Binary Search 7-1 Using the STRING Statement and Literals 7-2 Sample Overflow Condition 8-1 Sample Record Description 8-2 Determining Fixed-Length Record Size 8-3 Determining Fixed-Length Record Size for Files with Multiple Record Descriptions 8-4 Creating Variable-Length Records with the DEPENDING ON Phrase 8-5 Creating Variable-Length Records with the RECORD VARYING Phrase 8-6 Creating Variable-Length Records and Using the OCCURS Clause with the DEPENDING ON Phrase 8-7 Defining Fixed-Length Records with Multiple Record Descriptions 8-8 Defining a Disk File 8-9 Defining a Magnetic Tape File 8-10 How to Override or Supplement a File Specification at Run Time 8-11 Sequential File SELECT Statements 8-12 Relative File SELECT Statements 8-13 Indexed File SELECT Statements 9-1 Defining a Sequential File 9-2 Creating a Sequential File 9-3 Reading a Sequential File 9-4 Rewriting a Sequential File 9-5 Extending a Sequential File 10-1 Defining a Relative File 10-2 Creating a Relative File in Sequential Access Mode 10-3 Creating a Relative File in Random Access Mode 10-4 Reading a Relative File Sequentially 10-5 Reading a Relative File Randomly 10-6 Reading a Relative File Dynamically 10-7 Rewriting Relative Records in Sequential Access Mode 10-8 Rewriting Relative Records in Random Access Mode 10-9 Deleting Relative Records in Sequential Access Mode 10-10 Deleting Relative Records in Random Access Mode 11-1 Defining an Indexed File 11-2 Creating and Populating an Indexed File 11-3 Reading an Indexed File Sequentially 11-4 Reading an Indexed File Randomly 11-5 Reading an Indexed File Dynamically 11-6 Updating an Indexed File Sequentially 11-7 Updating an Indexed File Randomly 12-1 Handling the At End Condition 12-2 Handling the Invalid Key Condition 12-3 Defining a File Status for a File 12-4 Using the File Status Value in an Exception Handling Routine 12-5 Referencing RMS-STS, RMS-STV, RMS-CURRENT-STS, and RMS-CURRENT-STV Values 12-6 The Declarative Skeleton 12-7 A Declarative Procedure Skeleton 12-8 Five Types of Declarative Procedures 13-1 Two Access Streams to a Single File 13-2 Program Segment for RMS-STS File-Sharing Exceptions 13-3 Automatic Record Locking 13-4 Sample Program Using Manual Record Locking 14-1 INPUT and OUTPUT PROCEDURE Phrases 14-2 USING Phrase Replaces INPUT PROCEDURE Phrase 14-3 Overriding the COLLATING SEQUENCE IS Phrase 14-4 Using Two Sort Files 14-5 Using the AFTER STANDARD ERROR PROCEDURE 14-6 Using the MERGE Statement 14-7 Sorting a File with the USING and GIVING Phrases 14-8 Using the USING and OUTPUT PROCEDURE Phrases 14-9 Using the INPUT PROCEDURE and OUTPUT PROCEDURE Phrases 14-10 Using the COLLATING SEQUENCE IS Phrase 14-11 Creating a New Sort Key 14-12 Merging Files 15-1 Printing a Listing of a Simple Set 15-2 Using Forked Sets 15-3 Currency Indicators 15-4 Using the RETAINING Clause 15-5 ROLLBACK Statement 15-6 Owner and Member Test Condition 15-7 RECONNECT Statement 15-8 FREE CURRENT Statement 15-9 FETCH NEXT Loop 15-10 Using a FETCH NEXT Loop to Walk Through a Set Type 15-11 A Single USE Statement 15-12 Multiple USE Statements 15-13 Sample VAX COBOL DML Program Statements 15-14 Sample DML Program Statements 15-15 Populating a Database 15-16 Backing Up a Database 15-17 Accessing and Displaying Database Information 15-18 Sample Run of the PARTBOM Program 15-19 Creating Relationships Between Records of the Same Type 15-20 Creating New Record Relationships 15-21 Sample Run of PERSONNEL-UPDATE Before Promotion 15-22 Sample Run of PERSONNEL-UPDATE After Promotion 16-1 Checking for the Page-Overflow Condition 16-2 Page Advancing and Line Skipping 16-3 Checking for Page-Overflow on a 28-Line Logical Page 16-4 Programming a 20-Line Logical Page Defined by the LINAGE Clause 16-5 Sample Program 1 16-6 Sample Program 2 16-7 Sample Program 3 16-8 Sample Program 4 16-9 Sample Program 5 16-10 Printing Labels Four-Up 16-11 Printing Labels Four-Up in Sort Order 17-1 Erasing a Screen 17-2 Cursor Positioning 17-3 Using PLUS for Cursor Positioning 17-4 Using Character Attributes 17-5 Using the CONVERSION Clause 17-6 Using the ON EXCEPTION Clause 17-7 Using the SIZE Phrase 17-8 Using NO ECHO 17-9 Using the DEFAULT Phrase 17-10 Using the CONTROL KEY IN Phrase 17-11 EDITING Phrase Sample Code 18-1 Execution Sequence 18-2 Sequence of Messages Displayed 18-3 Calling a BASIC Program from VAX COBOL 18-4 BASIC Program APP and Output Data 18-5 Calling a FORTRAN Program from VAX COBOL 18-6 FORTRAN Subroutine SQROOT 18-7 Random Number Generator 18-8 Sample Run of RUNTIME 18-9 Using SYS$SETDDIR 18-10 Using $ASCTIM 18-11 Sample Run of CALLTIME B-1 Using RMS Special Registers to Detect Errors B-2 Using RMS-CURRENT Special Registers to Detect Errors D-1 INSPECT Statement Using Format 3 D-2 INSPECT Statement Using Formats 1 and 2 FIGURES 2-1 DCL Commands for Developing Programs 2-2 VAX COBOL Source Program Listing 2-3 Storage Map Portion of VAX COBOL Compiler Listing 2-4 Compilation Summary of a VAX COBOL Source Program Listing 2-5 VAX COBOL Listing Specifying /MACHINE_CODE Qualifier 2-6 VAX COBOL Listing of Contained Program 6-1 Organization of the One-Dimensional Table in Example 6-1 6-2 Organization of Multiple Data Items in a One-Dimensional Table 6-3 Organization of a Table with an Index and an Ascending Search Key 6-4 Organization of a Two-Dimensional Table 6-5 Organization of a Three-Dimensional Table 6-6 Memory Map for Example 6-7 6-7 Memory Map for Example 6-8 6-8 Memory Map for Example 6-9 6-9 Memory Map for Example 6-10 6-10 Memory Map for Example 6-11 6-11 Memory Map for Example 6-13 6-12 Memory Map for Example 6-14 7-1 Results of the STRING Operation 7-2 Matching Delimiter Characters to Characters in a Field 7-3 Sample INSPECT Statement 7-4 Typical REPLACING Phrase 7-5 The Replacement Argument 9-1 Sequential File Organization 9-2 A Multiple-Volume Sequential File 10-1 Relative File Organization 11-1 Indexed File Organization 13-1 Multiple Access to a File 13-2 Relationship of Record Locking to File Sharing 13-3 File-Sharing Options 13-4 Why a Record-Already-Exists Error Occurs 13-5 Valid and Invalid Combinations for Manual Record Locking 15-1 Database and Application Program Relationship 15-2 Bachman Diagram 15-3 Partial Bachman Diagram of the PARTSS1 Subschema 15-4 Bachman Diagram of the PARTSS3 Subschema 15-5 Sample Occurrence Diagram 1 15-6 Sample Occurrence Diagram 2 15-7 One Occurrence of Set PART_SUPPLY 15-8 Set Relationship 15-9 Set Relationships 15-10 Occurrence Diagram of a Relationship Between Two Set Types 15-11 Bachman Diagram of a System-Owned Set Type 15-12 Bachman Diagram of a Simple Set Type 15-13 Bachman Diagram of a Forked Set Type 15-14 Forked Set Occurrence 15-15 Bachman Diagram of a Many-to-Many Relationship Between Two Types of Records 15-16 Many-to-Many Relationship Between Two Types of Records 15-17 Bachman Diagram of a Many-to-Many Relationship Between Records of the Same Type 15-18 Current of PART_USES and PART_USED_ON 15-19 Retain PART_USES Currency 15-20 COMPONENT Is Connected to Both Set Types 15-21 Finding the Stool Legs While Keeping STOOL Current of PART_USES 15-22 Completed Bill of Materials 15-23 Occurrence Diagram of a Many-to-Many Relationship Between Records of the Same Type 15-24 Sample Parts Breakdown Report 15-25 One-to-Many Relationship Between Records of the Same Type 15-26 Sample Data Prior to Update 15-27 Sample Data After Update 15-28 Database Relationships 15-29 Currency Status by Executable DML Statement 15-30 Physical Representation of a Realm Without a RETAINING Clause 15-31 Physical Representation of a Realm with a RETAINING Clause 15-32 State of KEEPLIST-1 After Executing Line 000160 15-33 State of KEEPLIST-1 After Executing Lines 000190 and 000200 15-34 Transactions and Quiet Points 15-35 Using the COMMIT Statement 15-36 Occurrences of the RESPONSIBLE_FOR Set Type 15-37 Modifying Members of Sorted Sets 15-38 After Modifying MEMBER_B and Using RETAINING 15-39 Occurrence Diagram Prior to RECONNECT 15-40 Occurrence Diagram After RECONNECT 15-41 Results of an ERASE ALL 15-42 Results of an ERASE Record-Name (with Both OPTIONAL and FIXED Retention Classes) 15-43 Record Locking 15-44 Using FIND NEXT and FETCH NEXT Loops 15-45 Split Screen After FETCH FIRST PART USING PART_ID 15-46 Split Screen After FETCH NEXT WITHIN PART_SUPPLY 15-47 Split Screen After MODIFY SUP_RATING 15-48 Split Screen After FETCH OWNER WITHIN VENDOR_SUPPLY 15-49 Split Screen After FETCH CURRENT PART RETAINING PART_SUPPLY 15-50 Split Screen After FETCH NEXT WITHIN PART_SUPPLY 15-51 Split Screen After FETCH 2 WITHIN PART_SUPPLY 15-52 PARTSS1-PROGRAM Compiler Listing 15-53 PARTSS3-PROGRAM Compiler Listing 16-1 Sample Layout Worksheet 16-2 Components of a Report 16-3 Subtotals, Crossfoot Totals, and Rolled Forward Totals 16-4 Logical Page Area for a Conventional Report 16-5 A 20-Line Logical Page 16-6 A Double-Spaced Master Listing 16-7 Logical Page Areas for a Linage File Report 16-8 A 28-Line Logical Page 16-9 A 20-Line Logical Page 16-10 Presentation Order for a Logical Page 16-11 Sample Report Using All Seven Report Groups 16-12 First GENERATE Statement 16-13 Subsequent GENERATE Statements 16-14 TERMINATE Statement 16-15 CUSTMAST1.LIS 16-16 CUSTMAST2.LIS 16-17 CUSTMAST3.LIS 16-18 CUSTMAST4.LIS 16-19 CUSTMAST5.LIS 16-20 Printing Labels Four-Up 16-21 Printing Labels Four-Up in Sort Order 17-1 Adding Information to a Master File with a Video Form 17-2 Screen Before the ERASE Statement Executes 17-3 Screen After the ERASE Statement Executes 17-4 Positioning the Data on Line 19, Column 5 17-5 Cursor Positioning Using the PLUS Option 17-6 Screen Display with Character Attributes 17-7 Sample Run of Program CONVERT 17-8 Accepting Data with the ON EXCEPTION Option 17-9 Screen Display of NUM-DATA Using the PROTECTED Option 17-10 Accepting Data with the NO ECHO Option 17-11 Accepting Data with the DEFAULT Phrase 17-12 VAX COBOL Control Keys on the Standard VT52 Keypad 17-13 VAX COBOL Control Keys on the Standard VT100 Keypad 17-14 VAX COBOL Control Keys on the Standard VT200 and VT300 Keypad 17-15 Screen Display of Program SPECIAL 17-16 Form with ACCEPT WITH EDITING Phrase 18-1 Run Unit with Three Separately Compiled Programs 18-2 Run Unit with a Main Program and Two Contained Programs 18-3 Run Unit with Three Separately Compiled Programs and Two Contained Programs 18-4 Sharing Execution Control from a Main Program to Multiple Subprograms 18-5 CALL Statement Nesting 18-6 Accessing Another Program's Data Division 18-7 Defining Data Names in Linkage Section 18-8 Using the COMMON Clause 18-9 Sharing USE Procedures 18-10 Executing Declaratives with Contained Programs (Rule 1) 18-11 Executing Declaratives Within Contained Programs (Rule 2) 20-1 Execution of a SEARCH ALL Statement 20-2 Sharing Record Areas 20-3 Two-Level Primary Index B-1 Listing of Program CALL1 B-2 Listing of Program CALL2 TABLES 2-1 VMS File Maintenance Commands 2-2 COBOL Command Qualifiers and Defaults 2-3 Common LINK Qualifiers and Defaults 2-4 LINK Positional Qualifiers 3-1 Debugger Command Summary 4-1 Numeric Relational Operator Descriptions 4-2 Sign Tests 4-3 Numeric Editing 4-4 ROUNDING 5-1 Relational Operator Descriptions 5-2 Nonnumeric Elementary Moves 5-3 Data Movement with Editing Symbols 5-4 Data Movement with the JUSTIFIED Clause 6-1 Subscripting Rules for a Multidimensional Table 6-2 Subscripting with Data Names 7-1 Results of Sample Overflow Statements 7-2 Values Moved into the Receiving Items Based on the Sending Item Value 7-3 Handling a Short Sending Item 7-4 Results of Delimiting with an Asterisk 7-5 Results of Delimiting Multiple Receiving Items 7-6 Results of Delimiting with Two Asterisks 7-7 Results of Delimiting with ALL Asterisks 7-8 Results of Delimiting with ALL Double Asterisks 7-9 Results of Multiple Delimiters 7-10 Values Resulting from Implicit Redefinition 7-11 Relationship Among INSPECT Argument, Delimiter, Item Value, and Argument Active Position 7-12 LEADING Delimiter of the Inspection Operation 7-13 Results of the Scan with Separate Tallies 8-1 VAX COBOL File Organizations-Advantages and Disadvantages 9-1 Valid I/O Statements for Sequential Files 10-1 Valid I/O Statements for Relative Files 11-1 Valid I/O Statements for Indexed Files 13-1 File-Sharing Environment Codes 16-1 Results of Group Indicating 17-1 Cursor Positioning Requirements for ERASE Options 17-2 Available Character Attributes by Terminal Type 17-3 VAX COBOL Characters Returned for Cursor Positioning, Program Function, Function, and Auxiliary Keypad Keys 17-4 Key Functions for the EDITING Phrase 18-1 VAX Register Usage 18-2 Run-Time Library Facilities 18-3 System Services 18-4 VAX COBOL Implementation B-1 Information Contained in an Error Message D-1 Relationship Among VAX COBOL Modules, Subsets, and Levels D-2 PERFORM ... VARYING ... AFTER Identifier Values D-3 Table Values After a MOVE Statement D-4 New and Revised I-O Status Codes E-1 CDD/Plus Data Types