CONTENTS Title Page Copyright Page Preface 1 Developing Command Procedures 1.1 Formatting Command Procedures 1.1.1 Documenting Command Procedures 1.1.2 Using Multiple Lines for a Single Command 1.1.3 Using Complete Command Names and Qualifier Names 1.1.4 Using Labels 1.2 Executing Command Procedures 1.2.1 Executing Command Procedures Interactively 1.2.2 Submitting Command Procedures for Batch Execution 1.2.3 Executing Command Procedures on a Remote Node 1.2.4 Changing Command Levels 1.3 Login Command Procedures 1.3.1 A System or Group-Defined Login Command Procedure 1.3.2 Your Personal Login Command Procedure 1.4 Using a Command Procedure to Define Parameters or Qualifiers 1.5 Testing and Debugging Command Procedures 1.6 Maintaining Command Procedures 2 DCL Concepts 2.1 Logical Names 2.1.1 Creating and Deleting Logical Names 2.1.2 Using Logical Names 2.1.3 Logical Name Tables 2.1.4 Displaying Logical Names 2.1.5 Access Modes and Attributes 2.1.6 Search Lists 2.1.7 System-Defined Logical Names 2.2 Process Permanent Files 2.2.1 Default Process Permanent Files 2.2.2 Redefining System-Defined Logical Names 2.3 Symbols 2.3.1 Types of Symbols 2.3.2 Creating Symbols 2.3.3 Displaying the Value of a Symbol 2.3.4 Masking the Value of Symbols 2.3.5 Deleting Symbols 2.4 Expressions 2.4.1 Values in Expressions 2.4.1.1 Character Strings 2.4.1.2 Integers 2.4.1.3 Symbols 2.4.1.4 Lexical Functions 2.4.2 Operators Used in Expressions 2.5 Symbol Substitution 2.5.1 Using Apostrophes as Substitution Operators 2.5.2 Using Ampersands as Substitution Operators 2.5.3 Distinguishing Between Symbols and Logical Names 3 Command Procedure Input/Output 3.1 Passing Data to Command Procedures 3.1.1 Passing Parameters 3.1.2 Prompting for Input 3.2 Passing Data to Commands and Images 3.2.1 Including Data in the Command Procedure 3.2.2 Supplying Data to an Image 3.2.3 Defining SYS$INPUT as a File 3.3 Directing Output from Command Procedures 3.3.1 Redirecting Output from Command Procedures 3.3.2 Redirecting Output from Commands and Images 3.3.3 Redirecting Error Messages 3.3.4 Using Global Symbols to Return Data 3.3.5 Using Logical Names to Return Data 3.3.6 Verifying Command Procedure Execution 3.4 Writing Data to the Terminal 3.4.1 Using the WRITE Command 3.4.2 Using the TYPE Command 4 Using Lexical Functions 4.1 Obtaining Information About Your Process 4.1.1 Changing Verification Settings 4.1.2 Changing Default Protection 4.2 Obtaining Information About the System 4.2.1 Determining Your Node Name 4.2.2 Obtaining Information About Queues 4.2.3 Obtaining Information About Processes 4.3 Obtaining Information About Files and Devices 4.3.1 Searching for Devices 4.3.2 Searching for a File in a Directory 4.3.3 Deleting Old Versions of Files 4.4 Translating Logical Names 4.5 Manipulating Strings 4.5.1 Determining if a String or Character is Present 4.5.2 Extracting Part of a String 4.5.3 Formatting Output Strings 4.6 Manipulating Data Types 4.6.1 Converting Data Types 4.6.2 Evaluating Expressions 4.6.3 Determining Whether a Symbol Exists 5 Design and Logic 5.1 Design 5.2 Coding 5.2.1 Obtaining Variables 5.2.2 Coding the General Design 5.2.3 Testing and Debugging 5.2.4 Filling in the Program Stubs 5.3 Techniques for Controlling Execution Flow 5.3.1 Label Scoping 5.3.2 IF Command 5.3.3 GOTO Command 5.3.4 GOSUB Command 5.3.5 CALL Command 5.3.6 Loops 5.3.7 Case Statements 5.4 Terminating Command Procedures 5.4.1 Using the EXIT Command 5.4.2 Passing Status Values with the EXIT Command 5.4.3 Using the STOP Command 6 File Input/Output 6.1 Commands for File I/O 6.1.1 OPEN Command 6.1.1.1 Opening a File for Reading 6.1.1.2 Opening a File for Writing 6.1.1.3 Opening a File for Reading and Writing 6.1.1.4 Opening Shareable Files 6.1.2 READ Command 6.1.2.1 Designing Read Loops 6.1.2.2 Reading Records Randomly from Indexed Sequential Files 6.1.3 WRITE Command 6.1.4 CLOSE Command 6.2 Modifying a File 6.2.1 Updating Records in a File 6.2.2 Creating a New Output File 6.2.3 Appending Records to a File 6.3 Handling I/O Errors 7 Controlling Error Conditions and CTRL/Y Interrupts 7.1 Detecting Errors in Command Procedures 7.1.1 Condition Codes and $STATUS 7.1.2 Severity Levels and $SEVERITY 7.1.3 Commands That Do Not Set $STATUS 7.2 Error Condition Handling 7.2.1 ON Command 7.2.2 Disabling Error Checking 7.3 Handling CTRL/Y Interrupts 7.3.1 Interrupting a Command Procedure 7.3.2 Setting a CTRL/Y Action Routine 7.3.3 Disabling and Enabling CTRL/Y Interruptions 8 Working with Batch Jobs 8.1 Submitting a Batch Job 8.1.1 Checking for Batch Jobs in Your Login Command Procedure 8.1.2 Submitting Multiple Command Procedures 8.1.3 Controlling a Batch Job 8.2 Passing Data to Batch Jobs 8.3 Batch Job Output 8.3.1 Saving the Log File 8.3.2 Reading the Log File 8.3.3 Including All Command Output in the Batch Job Log 8.4 Controlling Jobs in a Batch Queue 8.4.1 Changing Job Characteristics 8.4.2 Deleting and Stopping Batch Jobs 8.5 Restarting Batch Jobs 8.6 Synchronizing Batch Job Execution A Annotated Command Procedures A.1 CONVERT.COM A.2 REMINDER.COM A.3 DIR.COM A.4 SYS.COM A.5 GETPARMS.COM A.6 EDITALL.COM A.7 FORTUSER.COM A.8 LISTER.COM A.9 CALC.COM A.10 BATCH.COM A.11 COMPILE_FILE.COM B Summary of Lexical Functions C Commands Frequently Used in Command Procedures FIGURES 6-1 Symbol Substitution with the WRITE Command 7-1 ON Command Actions 7-2 Flow of Execution Following CTRL/Y Action 7-3 Default CTRL/Y Action for Nested Procedures 8-1 Synchronizing Batch Job Execution TABLES 2-1 Summary of Operators in Expressions 3-1 Commands Performed Within the Command Interpreter 4-1 Commonly Changed Process Characteristics 7-1 ON Command Keywords and Actions