Guide to VMS Programming Resources

*HyperReader

  CONTENTS

  Title Page

  Copyright Page

  Preface

  1      Overview

  1.1     VMS Text Processors
    1.1.1      EDT Editor
      1.1.1.1      Keypad Editing Mode
      1.1.1.2      Line Editing Mode
      1.1.1.3      Nokeypad Editing Mode
    1.1.2      VAX Text Processing Utility
      1.1.2.1      EVE
      1.1.2.2      EDT Keypad Emulation in EVE
      1.1.2.3      VT100, WPS, and Numeric Keypad Emulation in EVE

  1.2     VAX Compilers, Interpreters, and the Assembler
    1.2.1      VAX Common Language Environment
    1.2.2      VAX Ada
    1.2.3      VAX APL
    1.2.4      VAX BASIC
    1.2.5      VAX BLISS-32
    1.2.6      VAX C
    1.2.7      VAX COBOL
    1.2.8      VAX DIBOL
    1.2.9      VAX FORTRAN
    1.2.10     VAX LISP
    1.2.11     VAX MACRO
    1.2.12     VAX PASCAL
    1.2.13     VAX PL/I
    1.2.14     VAX RPG II
    1.2.15     VAX SCAN

  1.3     Linker
    1.3.1      Using Options Files
    1.3.2      Using Image Maps
    1.3.3      Using LIBRARIAN with the Linker
    1.3.4      Linker Input and Output
    1.3.5      Linker Command Summary
    1.3.6      Additional Features

  1.4     Debuggers
    1.4.1      Symbolic Debugger
    1.4.2      Delta/XDelta Utility

  1.5     Programming Utilities
    1.5.1      Command Definition Utility
      1.5.1.1      Defining a New Command
      1.5.1.2      Modifying the Process and System Command Tables
      1.5.1.3      Creating a New Command Table
      1.5.1.4      Parsing the Command String
    1.5.2      Librarian Utility
      1.5.2.1      Types of Libraries
      1.5.2.2      Linking Your Program with Libraries
      1.5.2.3      Assigning Logical Names to Libraries
      1.5.2.4      Sharing Code Using Text Libraries
      1.5.2.5      Manipulating Libraries Using the LIBRARY Command
    1.5.3      Message Utility
    1.5.4      Patch Utility
    1.5.5      SUMSLP Utility
    1.5.6      System Dump Analyzer
    1.5.7      National Character Set Utility

  1.6     Callable System Routines
    1.6.1      I/O Operations
    1.6.2      Security Procedures
    1.6.3      File Management
    1.6.4      Memory Management
    1.6.5      Screen Management
    1.6.6      Math Operations
    1.6.7      Event Synchronization
    1.6.8      Calling Utility Routines
    1.6.9      Run-Time Library (RTL) Routines
    1.6.10     System Services
    1.6.11     Utility Routines
    1.6.12     VMS Record Management Services
      1.6.12.1     Device Support
      1.6.12.2     VMS RMS File Control Blocks
      1.6.12.3     VMS RMS Record Control Blocks
      1.6.12.4     VMS RMS Macros
    1.6.13     VMS Record Management Services Utilities
      1.6.13.1     ANALYZE/RMS_FILE
      1.6.13.2     CONVERT and CONVERT/RECLAIM
      1.6.13.3     CREATE/FDL and EDIT/FDL

  1.7     System Programming

  2      Using Processes

  2.1     Creating Processes
    2.1.1      Creating Spawned Subprocesses
      2.1.1.1      Creating a Spawned Subprocess Using LIB$SPAWN
      2.1.1.2      Creating a Spawned Subprocess Using SYS$CREPRC
      2.1.1.3      Creating a Spawned Subprocess Using PPL$SPAWN
      2.1.1.4      Debugging Within a Subprocess
    2.1.2      Creating Detached Processes

  2.2     Managing Processes
    2.2.1      Obtaining Process Information
    2.2.2      Setting Privileges
    2.2.3      Scheduling Processes
    2.2.4      Changing Process Names
    2.2.5      Controlling Process Execution
    2.2.6      Deleting Processes

  3      Communication

  3.1     Communicating Within a Process
    3.1.1      Local Event Flags
    3.1.2      Logical Names
      3.1.2.1      Using Logical Name Tables
      3.1.2.2      Access Modes
      3.1.2.3      Creating and Accessing Logical Names
    3.1.3      Command Language Interpreter Symbols
      3.1.3.1      When to Use Global Symbols
      3.1.3.2      When to Use Local Symbols
    3.1.4      Creating and Using Global Symbols
    3.1.5      Common Blocks
      3.1.5.1      How the Process Common Block Is Created
      3.1.5.2      Modifying or Deleting Data in the Common Block
      3.1.5.3      Specifying Other Types of Data

  3.2     Interprocess Communication
    3.2.1      Mailboxes
      3.2.1.1      Creating a Mailbox
      3.2.1.2      Temporary and Permanent Mailboxes
      3.2.1.3      Reading and Writing Data to a Mailbox
      3.2.1.4      Synchronous Mailbox I/O
      3.2.1.5      Immediate Mailbox I/O
      3.2.1.6      Asynchronous Mailbox I/O

  3.3     System Information
    3.3.1      Timer Statistics
    3.3.2      System Time
      3.3.2.1      Absolute Time Format
      3.3.2.2      Delta Time Format
      3.3.2.3      Current Time
      3.3.2.4      Time Manipulation

  3.4     Intersystem Communication
    3.4.1      Requesting a Network Connection
    3.4.2      Completing a Network Connection
    3.4.3      Exchanging Messages
    3.4.4      Terminating a Network Connection

  3.5     Using the DIGITAL Distributed Name Service
    3.5.1      Introduction to the Distributed Name Service
    3.5.2      The DECdns Namespace
      3.5.2.1      Planning Namespace Objects
      3.5.2.2      Restrictions
      3.5.2.3      Using the Namespace
      3.5.2.4      Object Names
      3.5.2.5      Object Attributes
    3.5.3      Structure of a Namespace
      3.5.3.1      Naming Syntax
      3.5.3.2      Logical Names
      3.5.3.3      Valid Characters for DECdns Names
    3.5.4      Creating Objects
    3.5.5      Modifying Objects
    3.5.6      Distributing the Namespace
      3.5.6.1      Replicating Directories
      3.5.6.2      Types of Directories
      3.5.6.3      Setting Confidence
      3.5.6.4      Maintaining Consistency in Data
    3.5.7      Requesting Information from DECdns
      3.5.7.1      Reading Objects
      3.5.7.2      Listing Information
      3.5.7.3      How the Clerk Locates Data
    3.5.8      DECdns System Services and Run-Time Library Routines
      3.5.8.1      DECdns System Services
      3.5.8.2      DECdns Run-Time Library Routines

  4      Synchronization

  4.1     Synchronizing Operations with Event Flags
    4.1.1      Types of Event Flags
    4.1.2      General Guidelines for Using Event Flags
    4.1.3      Using Local Event Flags
    4.1.4      Using Common Event Flags
      4.1.4.1      Associating a Name with a Common Event Flag Cluster
      4.1.4.2      Temporary Common Event Flag Clusters
      4.1.4.3      Permanent Common Event Flag Clusters

  4.2     Using Asynchronous System Traps

  4.3     Specifying a Time for Program Execution
    4.3.1      Using Processes for Timing
      4.3.1.1      Specified Time
      4.3.1.2      Timed Intervals
    4.3.2      Placing Entries in the System Timer Queue

  4.4     Synchronous and Asynchronous System Services

  4.5     Using the Lock Manager
    4.5.1      Requesting a Lock
    4.5.2      Requesting a Null Lock

  4.6     Using the Parallel Processing Run-time Library Routines
    4.6.1      Using Subprocesses
    4.6.2      Using Spin Locks
    4.6.3      Using Semaphores
    4.6.4      Using Barrier Synchronization

  4.7     Writing Applications for a VMS Multiprocessing Environment
    4.7.1      Writable Global Sections
    4.7.2      Synchronization Using Process Priority

  4.8     Ensuring the Consistency of Distributed Transactions
    4.8.1      Characteristics of Distributed Transactions
    4.8.2      Transaction Processing System Model
      4.8.2.1      Resource Manager
      4.8.2.2      Transaction Manager
      4.8.2.3      Log Manager
    4.8.3      Overview of Two-Phase Commit Protocol
    4.8.4      Managing DECdtm Services Using VMS Utilities
    4.8.5      New TRANSACTION_ID Data Type for Programming Routines
    4.8.6      Log Manager Control Program Utility (LMCP)
    4.8.7      Format of Transaction Log Files
    4.8.8      Monitoring Transactions Using the Monitor Utility (MONITOR)

  4.9     Passing Control to Another Image
    4.9.1      Invoking a Command Image
    4.9.2      Invoking a Noncommand Image

  5      Shareable Resources

  5.1     Sharing Program Code
    5.1.1      Object Libraries
      5.1.1.1      System- and User-Defined Default Object Libraries
      5.1.1.2      How the Linker Searches Libraries
      5.1.1.3      Creating an Object Library
      5.1.1.4      Managing an Object Library
    5.1.2      Text and Macro Libraries

  5.2     Shareable Images
    5.2.1      Transfer Vectors
      5.2.1.1      Why Use Transfer Vectors?
      5.2.1.2      Deleting Transfer Vectors
    5.2.2      GSMATCH Option
    5.2.3      UNIVERSAL Option
    5.2.4      Creating Shareable Images
    5.2.5      Shareable Image Libraries
      5.2.5.1      Adding or Replacing Shareable Images
      5.2.5.2      Listing or Deleting Shareable Images
    5.2.6      Linking Shareable Images
      5.2.6.1      Default File Type and Location of Shareable Images
      5.2.6.2      Alternate Location of Shareable Images
    5.2.7      Shared Images
      5.2.7.1      Creating a Shared Image
      5.2.7.2      If the Shared Image Is in Memory
      5.2.7.3      If the Shared Image Is Not in Memory

  5.3     Symbols
    5.3.1      Defining Symbols
    5.3.2      Local and Global Symbols
    5.3.3      Resolving Global Symbols
      5.3.3.1      Explicitly Named Modules and Libraries
      5.3.3.2      System Default Libraries
      5.3.3.3      User Default Libraries
      5.3.3.4      Making a Library Available for Systemwide Use
      5.3.3.5      Macro Libraries
    5.3.4      Sharing Data
      5.3.4.1      Installed Common Blocks
      5.3.4.2      Global Sections
      5.3.4.3      VMS RMS Shared Files

  6      Security Features

  6.1     Rights Database

  6.2     System Services and Security

  6.3     Privileged Images

  7      Input/Output Operations

  7.1     Choosing I/O Techniques
    7.1.1      Simple User I/O
    7.1.2      Complex User I/O
    7.1.3      Reading and Writing Data to Files
    7.1.4      Reading and Writing Data to Devices
    7.1.5      Broadcast Messages and Special I/O Actions

  7.2     Using SYS$INPUT and SYS$OUTPUT
    7.2.1      Default Input and Output Devices
    7.2.2      Reading and Writing to Alternate Devices and External Files

  7.3     Working with Simple User I/O
    7.3.1      Default Devices for Simple I/O
    7.3.2      Getting a Line of Input
    7.3.3      Getting Several Lines of Input
    7.3.4      Writing Simple Output

  7.4     Working with Complex User I/O
    7.4.1      Pasteboards
      7.4.1.1      Creating a Pasteboard
      7.4.1.2      Deleting a Pasteboard
      7.4.1.3      Setting Screen Dimensions and Background Color
    7.4.2      Virtual Displays
      7.4.2.1      Creating a Virtual Display
      7.4.2.2      Pasting Virtual Displays
      7.4.2.3      Rearranging Virtual Displays
      7.4.2.4      Removing Virtual Displays
      7.4.2.5      Modifying a Virtual Display
      7.4.2.6      Using Spawned Subprocesses
    7.4.3      Viewports
    7.4.4      Writing Text to Virtual Display
      7.4.4.1      Positioning the Cursor
      7.4.4.2      Writing Data Character by Character
      7.4.4.3      Writing Data Line by Line
      7.4.4.4      Drawing Lines
      7.4.4.5      Deleting Text
    7.4.5      Using Menus
    7.4.6      Reading Data
      7.4.6.1      Reading from a Display
      7.4.6.2      Reading from a Virtual Keyboard
      7.4.6.3      Reading from the Keypad
      7.4.6.4      Reading Composed Input
    7.4.7      Controlling Screen Updates
    7.4.8      Modularity

  7.5     Special Input/Ouput Actions
    7.5.1      CTRL/C and CTRL/Y Interrupts
    7.5.2      Unsolicited Input
    7.5.3      Type-Ahead Buffer
    7.5.4      Echo
    7.5.5      Timeout
    7.5.6      Lowercase to Uppercase Conversion
    7.5.7      Line Editing and Control Actions
    7.5.8      Broadcasts
      7.5.8.1      Default Handling of Broadcasts
      7.5.8.2      How to Create Alternate Broadcast Handlers

  7.6     SYS$QIO and SYS$QIOW System Services
    7.6.1      Read Operations
    7.6.2      Write Operations
    7.6.3      Checking the Device Type
    7.6.4      Terminal Characteristics
    7.6.5      Record Terminators
    7.6.6      File Terminators

  8      File I/O

  8.1     File Attributes

  8.2     File Access Strategies
    8.2.1      Complete Access
    8.2.2      Record-by-Record Access
    8.2.3      Discrete Records
    8.2.4      Sequential and Indexed Files
    8.2.5      Protection and Access
      8.2.5.1      Read Only Access
      8.2.5.2      Shared Access
    8.2.6      Specifying File Attributes

  8.3     Loading and Unloading a Database
    8.3.1      Using SYS$CRMPSC
      8.3.1.1      Mapping a File
      8.3.1.2      User-Open Routine
      8.3.1.3      Initializing a Mapped Database
      8.3.1.4      Saving a Mapped File
      8.3.1.5      Example of Per-Record Processing of Entire Database

  8.4     Sorting and Merging Sequential Files
    8.4.1      Using the File and Record Interface
    8.4.2      Multiple Sort Operations
    8.4.3      Passing Key Information
    8.4.4      Sorting with the File Interface
    8.4.5      Sorting with the Record Interface
    8.4.6      Merging with the File Interface
    8.4.7      Merging with the Record Interface

  8.5     Data Compression and Expansion
    8.5.1      Compression Routines
    8.5.2      Expansion Routines

  8.6     Librarian Utility Routines
    8.6.1      Creating, Opening, and Closing Libraries
    8.6.2      Adding Modules
    8.6.3      Deleting Modules
    8.6.4      Extracting Modules
    8.6.5      Using Multiple Keys and Multiple Indexes
    8.6.6      Accessing Module Headers
    8.6.7      Reading Library Headers
    8.6.8      Displaying Help Text
    8.6.9      Listing and Processing Index Entries

  8.7     File Definition Language
    8.7.1      Creating an FDL File
      8.7.1.1      Using the FDL Editor
      8.7.1.2      Using the Characteristics of an Existing Data File
    8.7.2      Applying an FDL File to a Data File
      8.7.2.1      Creating a New Data File
      8.7.2.2      Modifying an Existing Data File

  8.8     User-Open Routines
    8.8.1      Opening a File
      8.8.1.1      Specifying USEROPEN
      8.8.1.2      Writing the User-Open Routine
      8.8.1.3      Setting FAB and RAB Fields

  9      Condition Handling

  9.1     General Error Handling
    9.1.1      Condition Code and Message
    9.1.2      Return Status Convention
      9.1.2.1      Testing Returned Condition Codes
      9.1.2.2      Testing SS$_NOPRIV and SS$_EXQUOTA
    9.1.3      Signaling Mechanism
      9.1.3.1      Default Condition Handling
      9.1.3.2      Changing a Signal to a Return Status

  9.2     Defining Condition Codes and Messages
    9.2.1      Creating the Message Source File
      9.2.1.1      Specifying the Facility
      9.2.1.2      Specifying the Severity
      9.2.1.3      Specifying Condition Names and Messages
      9.2.1.4      Specifying Variables in the Message Text
    9.2.2      Compiling and Linking the Messages
      9.2.2.1      Linking the Message Object Module
      9.2.2.2      Accessing the Message Object Module from Multiple Programs
      9.2.2.3      Modifying a Message Source Module
      9.2.2.4      Accessing Modified Messages Without Relinking
    9.2.3      Signaling User-Defined Codes and Messages
      9.2.3.1      Signaling with Global Symbols
      9.2.3.2      Signaling with Local Symbols
      9.2.3.3      Specifying FAO Parameters

  9.3     Condition Handlers
    9.3.1      Establishing a Condition Handler
    9.3.2      Writing a Condition Handler
      9.3.2.1      The Signal Array
      9.3.2.2      The Mechanism Array
      9.3.2.3      Comparing the Signaled Condition with an Expected Condition
      9.3.2.4      Exiting From the Condition Handler
      9.3.2.5      Returning Control to the Program
    9.3.3      Debugging
    9.3.4      Condition Handler Functions
      9.3.4.1      Modifying Condition Codes
      9.3.4.2      Displaying Messages
      9.3.4.3      Chaining Messages
      9.3.4.4      Logging Messages
    9.3.5      System-Defined Arithmetic Condition Handlers

  9.4     Exit Handlers
    9.4.1      Establishing an Exit Handler
    9.4.2      Writing an Exit Handler
    9.4.3      Debugging an Exit Handler

  10     Memory Management

  10.1    Using RTL Routines

  10.2    Using System Sevices
    10.2.1     Working with Address Space
    10.2.2     Adjusting Working Sets

  11     Taking Advantage of Vector Processing Capabilities

  11.1    Overview of the Vector Processing Environment
    11.1.1     VAX Vector Processing Systems
    11.1.2     VMS Support for Vector Processing
      11.1.2.1     Life of a Vector Consumer
      11.1.2.2     VAX Vector Instruction Emulation Facility (VVIEF)

  11.2    Programming in a Vector Processing Environment
    11.2.1     Vector Routines in the MTH$ Run-Time Library
    11.2.2     Obtaining Information About a Vector Processing System
    11.2.3     Releasing the Vector Processor
    11.2.4     Preserving and Restoring a Routine's Vector State

  EXAMPLES

  1-1        Defining a New Command

  1-2        Message Source File

  2-1        Obtaining the Process Name

  2-2        Obtaining Different Types of Process Information

  3-1        Creating a Spawned Subprocess

  3-2        Opening a Mailbox

  3-3        Synchronous I/O Using a Mailbox

  3-4        Immediate I/O Using a Mailbox

  3-5        Asynchronous I/O Using a Mailbox

  3-6        Displaying and Writing Timer Statistics

  3-7        Calculating and Displaying the Time

  3-8        Exchanging Messages

  3-9        Creating an Object in the DECdns Namespace

  3-10       Modifying an Object in the DECdns Namespace

  3-11       Reading an Object Attribute

  3-12       Reading the Objects in a Directory

  4-1        Executing a Program Using Delta Time

  4-2        Executing a Program at Timed Intervals

  4-3        Requesting a Null Lock

  4-4        Sample Transaction Log File

  5-1        Interprocess Communication Using Global Sections

  7-1        Reading a Line of Data

  7-2        Reading a Varying Number of Input Records

  7-3        Associating a Pasteboard with a Terminal

  7-4        Modifying the Screen Dimensions and Background Color

  7-5        Defining and Pasting Virtual Displays

  7-6        Scrolling Forward Through a Display

  7-7        Scrolling Backward Through the Display

  7-8        Creating a Statistics Display

  7-9        Reading Data from a Virtual Keyboard

  7-10       Reading Data from the Keypad

  7-11       Redefining Keys

  7-12       Using Interrupts to Perform I/O

  7-13       Receiving Unsolicited Input from a Virtual Keyboard

  7-14       Trapping Broadcast Messages

  7-15       Reading Data from the Terminal Synchronously

  7-16       Reading Data from the Terminal Asynchronously

  7-17       Writing Character Data to a Terminal

  7-18       Using SYS$GETDVIW to Verify the Device Name

  7-19       Disabling the HOSTSYNCH Terminal Characteristic

  8-1        Mapping a Data File to the Common Block

  8-2        Using a User-Open Routine

  8-3        Closing a Mapped File

  8-4        Creating a Sequential File of Fixed-Length Records

  8-5        Updating a Sequential File

  8-6        Sorting a Sequential File Using the File Interface

  8-7        Sorting a Sequential File Using the Record Interface

  8-8        Merging Sequential Files Using the File Interface

  8-9        Merging Sequential Files Using the Record Interface

  8-10       Compressing Data

  8-11       Expanding Data

  8-12       Creating, Opening, and Closing a Text Library

  8-13       Adding Modules to a Text Library

  8-14       Deleting Modules from a Text Library

  8-15       Extracting Modules from a Text Library

  8-16       Associating Keys with Modules

  8-17       Listing Keys Associated with a Module

  8-18       Displaying the Module Header

  8-19       Reading Library Headers

  8-20       Displaying Text from a Help Library

  8-21       Displaying Index Entries

  8-22       Creating an FDL File

  FIGURES

  3-1        A DECdns Namespace

  3-2        Valid Character Codes for DECdns Simple Names

  3-3        Additional Character Codes Allowed in Quoted Simple Names

  3-4        A Partitioned Namespace

  3-5        A Namespace with Replicated Directories

  4-1        Sample Debit/Credit Transaction Execution

  4-2        Participants in a Distributed Transaction Example

  5-1        How the Linker Uses Transfer Vector Address

  7-1        Defining and Pasting Virtual Displays

  7-2        Moving a Virtual Display

  7-3        Repasting a Virtual Display

  7-4        Popping a Virtual Display

  7-5        Statistics Display

  9-1        Structure of a Condition Code

  9-2        Structure of a Signal Array

  9-3        Structure of a Mechanism Array

  9-4        Structure of an Exit Handler

  11-1       Life of a Vector Consumer

  TABLES

  1-1        Types of Libraries

  1-2        RTL General Programming Tasks (LIB$) Routines

  1-3        RTL Screen Management (SMG$) Routines

  1-4        Summary of System Services

  1-5        Utility Routine Summary

  1-6        User Control Blocks

  2-1        Detached Processes and Spawned Subprocesses

  2-2        Comparison of LIB$SPAWN, SYS$CREPRC, and PPL$SPAWN

  2-3        Routines and Commands for Managing Processes

  3-1        DECdns Run-Time Routines

  4-1        Event Flags

  4-2        Event Flag Routines

  4-3        Time Manipulation System Services

  4-4        Lock Manager Routines

  6-1        Security System Services

  7-1        SYS$INPUT and SYS$OUTPUT Values

  7-2        Setting Video Attributes

  9-1        Privilege Errors

  9-2        Quota Errors