4 VMS Programming Concepts Vol2
4 VMS Programming Concepts Vol2
April 2001
ZK6641
The Compaq OpenVMS documentation set is available on CD–ROM.
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
iii
18.5.2 Passing Arguments by Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–14
18.5.3 Passing Arguments by Descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–16
18.6 Passing Scalars as Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–18
18.7 Passing Arrays as Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–18
18.8 Passing Strings as Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–18
18.9 Combinations of Descriptor Class and Data Type . . . . . . . . . . . . . . . . . . . 18–19
18.10 Return of the Function Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–22
18.11 Return of the Condition Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–22
iv
21 STARLET Structures and Definitions for C Programmers
21.1 SYS$STARLET_C.TLB Equivalency to STARLETSD.TLB . . . . . . . . . . . . . 21–1
21.2 NEW STARLET Definitions for C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21–2
v
22.5.3 Using the Type-Ahead Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–39
22.5.4 Using Echo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–40
22.5.5 Using Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–41
22.5.6 Converting Lowercase to Uppercase . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–42
22.5.7 Performing Line Editing and Control Actions . . . . . . . . . . . . . . . . . . . 22–42
22.5.8 Using Broadcasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–43
22.5.8.1 Default Handling of Broadcasts . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–43
22.5.8.2 How to Create Alternate Broadcast Handlers . . . . . . . . . . . . . . . . 22–43
vi
23.17.1 Implicit Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–33
23.17.2 Deallocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–33
23.18 Mounting, Dismounting, and Initializing Volumes . . . . . . . . . . . . . . . . . . . 23–34
23.18.1 Mounting a Volume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–34
23.18.1.1 Calling the SYS$MOUNT System Service . . . . . . . . . . . . . . . . . . . 23–34
23.18.1.2 Calling the SYS$DISMOU System Service . . . . . . . . . . . . . . . . . . 23–36
23.18.2 Initializing Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–36
23.18.2.1 Calling the Initialize Volume System Service . . . . . . . . . . . . . . . . . 23–36
23.19 Formatting Output Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–38
23.20 Mailboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–39
23.20.1 Mailbox Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–43
23.20.2 System Mailboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–43
23.20.3 Mailboxes for Process Termination Messages . . . . . . . . . . . . . . . . . . . . 23–44
23.21 Example of Using I/O Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–45
23.22 Fast I/O and Fast Path Features (Alpha Only) . . . . . . . . . . . . . . . . . . . . . 23–48
23.22.1 Fast I/O (Alpha Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–48
23.22.1.1 Fast I/O Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–48
23.22.1.2 Buffer Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–49
23.22.2 Fast Path (Alpha Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–51
23.22.2.1 Fast Path Features and Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . 23–51
23.22.2.2 Additional Information About Fast Path . . . . . . . . . . . . . . . . . . . . 23–52
vii
25 Using Cross-Reference Routines
25.1 How to Use the Cross-Reference Routines . . . . . . . . . . . . . . . . . . . . . . . . . 25–1
25.2 $CRFCTLTABLE Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–2
25.3 $CRFFIELD Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–3
25.4 $CRFFIELDEND Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–4
25.5 Cross-Reference Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–4
25.6 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–6
25.6.1 Defining Control Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–6
25.6.2 Inserting Table Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–8
25.6.3 Formatting Information for Output . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–9
25.7 How to Link to the Cross-Reference Shareable Image . . . . . . . . . . . . . . . . 25–10
26 Shareable Resources
26.1 Sharing Program Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–1
26.1.1 Object Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–2
26.1.1.1 System- and User-Defined Default Object Libraries . . . . . . . . . . . . 26–2
26.1.1.2 How the Linker Searches Libraries . . . . . . . . . . . . . . . . . . . . . . . . 26–2
26.1.1.3 Creating an Object Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–2
26.1.1.4 Managing an Object Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–2
26.1.2 Text and Macro Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–3
26.2 Shareable Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–3
26.3 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–3
26.3.1 Defining Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–3
26.3.2 Local and Global Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–4
26.3.3 Resolving Global Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–4
26.3.3.1 Explicitly Named Modules and Libraries . . . . . . . . . . . . . . . . . . . . 26–5
26.3.3.2 System Default Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–5
26.3.3.3 User Default Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–5
26.3.3.4 Making a Library Available for Systemwide Use . . . . . . . . . . . . . . 26–5
26.3.3.5 Macro Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–5
26.3.4 Sharing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–6
26.3.4.1 Installed Common Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–6
26.3.4.2 Using Global Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–9
26.3.4.3 Synchronizing Access to Global Sections . . . . . . . . . . . . . . . . . . . . 26–13
26.3.4.4 RMS Shared Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26–13
viii
27.3.3 Setting the Current Time with SYS$SETIME . . . . . . . . . . . . . . . . . . . 27–11
27.4 Routines Used for Timer Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–13
27.4.1 Setting Timer Requests with SYS$SETIMR . . . . . . . . . . . . . . . . . . . . 27–14
27.4.2 Canceling a Timer Request with SYS$CANTIM . . . . . . . . . . . . . . . . . 27–16
27.4.3 Scheduling Wakeups with SYS$WAKE . . . . . . . . . . . . . . . . . . . . . . . . 27–16
27.4.4 Canceling a Scheduled Wakeup with SYS$CANWAK . . . . . . . . . . . . . . 27–17
27.4.5 Executing a Program at Timed Intervals . . . . . . . . . . . . . . . . . . . . . . . 27–18
27.5 Routines Used for Timer Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–18
27.6 Date/Time Formatting Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–21
27.6.1 Performing Date/Time Logical Initialization . . . . . . . . . . . . . . . . . . . . 27–21
27.6.2 Selecting a Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–24
27.6.2.1 Formatting Run-Time Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . 27–24
27.6.2.2 Specifying Formats at Run Time . . . . . . . . . . . . . . . . . . . . . . . . . . 27–26
27.6.2.3 Specifying Input Formats at Run Time . . . . . . . . . . . . . . . . . . . . . 27–26
27.6.2.4 Specifying Output Formats at Run Time . . . . . . . . . . . . . . . . . . . . 27–29
27.6.2.5 Specifying Formats at Compile Time . . . . . . . . . . . . . . . . . . . . . . . 27–31
27.6.2.6 Specifying Input Format Mnemonics at Compile Time . . . . . . . . . 27–32
27.6.2.7 Specifying Output Formats at Compile Time . . . . . . . . . . . . . . . . . 27–33
27.6.3 Converting with the LIB$CONVERT_DATE_STRING Routine . . . . . . 27–33
27.6.4 Retrieving with LIB$GET_DATE_FORMAT Routine . . . . . . . . . . . . . . 27–34
27.6.4.1 Using User-Defined Output Formats . . . . . . . . . . . . . . . . . . . . . . . 27–34
27.7 Coordinated Universal Time Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–36
28 File Operations
28.1 File Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–1
28.1.1 Specifying File Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–2
28.1.2 Using Extended File Specifications (Alpha Only) . . . . . . . . . . . . . . . . . 28–2
28.2 File Access Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–2
28.3 File Protection and Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–3
28.3.1 Read-Only Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–3
28.3.2 Shared Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–3
28.4 File Access and Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–4
28.4.1 Using SYS$CRMPSC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–4
28.4.1.1 Mapping a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–5
28.4.1.2 Using the User-Open Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–10
28.4.1.3 Initializing a Mapped Database . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–11
28.4.1.4 Saving a Mapped File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–11
28.5 Opening and Updating a Sequential File . . . . . . . . . . . . . . . . . . . . . . . . . . 28–12
28.6 User-Open Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–15
28.6.1 Opening a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–15
28.6.1.1 Specifying USEROPEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–15
28.6.1.2 Writing the User-Open Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–16
28.6.1.3 Setting FAB and RAB Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–17
ix
30 Creating User-Written System Services
30.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30–1
30.2 Writing a Privileged Routine (User-Written System Service) . . . . . . . . . . . 30–3
30.3 Creating a Privileged Shareable Image (VAX Only) . . . . . . . . . . . . . . . . . . 30–4
30.3.1 Creating User-Written Dispatch Routines on VAX Systems . . . . . . . . . 30–4
30.3.2 Creating a PLV on VAX Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30–5
30.3.3 Declaring Privileged Routines as Universal Symbols Using Transfer
Vectors on VAX Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30–9
30.4 Creating a User-Written System Service (Alpha Only) . . . . . . . . . . . . . . . 30–9
30.4.1 Creating a PLV on Alpha Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30–9
30.4.2 Declaring Privileged Routines as Universal Symbols Using Symbol
Vectors on Alpha Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30–13
x
31.8.1 Creating a Security Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–29
31.8.2 SYS$CHKPRO System Sevice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–29
31.8.3 SYS$CHECK_ACCESS System Service . . . . . . . . . . . . . . . . . . . . . . . . 31–29
31.9 SYS$CHECK_PRIVILEGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–30
31.10 Implementing Site-Specific Security Policies . . . . . . . . . . . . . . . . . . . . . . . 31–30
31.10.1 Creating Loadable Security Services . . . . . . . . . . . . . . . . . . . . . . . . . . 31–30
31.10.1.1 Preparing and Loading a System Service . . . . . . . . . . . . . . . . . . . . 31–31
31.10.1.2 Removing an Executive Loaded Image . . . . . . . . . . . . . . . . . . . . . . 31–32
31.10.2 Installing Filters for Site-Specific Password Policies . . . . . . . . . . . . . . 31–33
31.10.2.1 Creating a Shareable Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–33
31.10.2.2 Installing a Shareable Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–33
xi
33 Image Initialization
33.1 Initializing an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33–1
33.2 Initializing an Argument List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33–5
33.3 Declaring Initialization Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33–6
33.4 Dispatching to Initialization Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33–7
33.5 Initialization Routine Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33–7
33.6 Initialization Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33–7
xii
C.2.3 Requesting Information from DECdns . . . . . . . . . . . . . . . . . . . . . . . . . C–9
C.2.3.1 Using the Distributed File Service (DFS) . . . . . . . . . . . . . . . . . . . . C–9
C.2.3.2 Reading Attributes from DNS . . . . . . . . . . . . . . . . . . . . . . . . . . . . C–10
C.2.3.3 Enumerating DECdns Names and Attributes . . . . . . . . . . . . . . . . C–13
C.3 Using the DCL Command DEFINE with DECdns Logical Names . . . . . . . C–16
Index
Examples
20–1 Example of SYS$SYNCH System Service in FORTRAN . . . . . . . . . . . 20–6
20–2 System Service Call in Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20–11
20–3 System Service Call in BASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20–13
20–4 System Service Call in BLISS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20–14
20–5 System Service Call in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20–15
20–6 System Service Call in COBOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20–16
20–7 System Service Call in FORTRAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20–17
20–8 System Service Call in Pascal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20–19
20–9 System Service Call in VAX MACRO . . . . . . . . . . . . . . . . . . . . . . . . . . 20–20
22–1 Reading a Line of Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–5
22–2 Reading a Varying Number of Input Records . . . . . . . . . . . . . . . . . . . . 22–5
22–3 Associating a Pasteboard with a Terminal . . . . . . . . . . . . . . . . . . . . . . 22–10
22–4 Creating a Pasteboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–11
22–5 Modifying Screen Dimensions and Background Color . . . . . . . . . . . . . 22–11
22–6 Defining and Pasting a Virtual Display . . . . . . . . . . . . . . . . . . . . . . . . 22–13
22–7 Scrolling Forward Through a Display . . . . . . . . . . . . . . . . . . . . . . . . . 22–21
22–8 Scrolling Backward Through a Display . . . . . . . . . . . . . . . . . . . . . . . . 22–21
22–9 Creating a Statistics Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–22
22–10 Reading Data from a Virtual Keyboard . . . . . . . . . . . . . . . . . . . . . . . . 22–25
22–11 Reading Data from the Keypad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–27
22–12 Redefining Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–29
22–13 Using Interrupts to Perform I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–35
22–14 Receiving Unsolicited Input from a Virtual Keyboard . . . . . . . . . . . . . 22–37
22–15 Trapping Broadcast Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–44
23–1 Event Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–15
23–2 AST Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–16
23–3 I/O Status Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–17
23–4 Reading Data from the Terminal Synchronously . . . . . . . . . . . . . . . . . 23–20
23–5 Reading Data from the Terminal Asynchronously . . . . . . . . . . . . . . . . 23–21
23–6 Writing Character Data to a Terminal . . . . . . . . . . . . . . . . . . . . . . . . . 23–23
23–7 Using SYS$GETDVIW to Verify the Device Name . . . . . . . . . . . . . . . . 23–29
23–8 Disabling the HOSTSYNC Terminal Characteristic . . . . . . . . . . . . . . . 23–30
26–1 Interprocess Communication Using Global Sections . . . . . . . . . . . . . . 26–9
27–1 Calculating and Displaying the Time . . . . . . . . . . . . . . . . . . . . . . . . . . 27–5
27–2 Setting an Event Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–14
27–3 Specifying an AST Service Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–15
27–4 Displaying and Writing Timer Statistics . . . . . . . . . . . . . . . . . . . . . . . 27–19
xiii
28–1 Mapping a Data File to the Common Block on a VAX System . . . . . . . 28–6
28–2 Mapping a Data File to the Common Block on an Alpha System . . . . . 28–8
28–3 Using a User-Open Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–10
28–4 Closing a Mapped File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–12
28–5 Creating a Sequential File of Fixed-Length Records . . . . . . . . . . . . . . 28–13
28–6 Updating a Sequential File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28–14
30–1 Sample Dispatching Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30–5
30–2 Assigning Values to a PLV on a VAX System . . . . . . . . . . . . . . . . . . . . 30–8
30–3 Creating a PLV on Alpha Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30–12
30–4 Declaring Universal Symbols for Privileged Shareable Image on an
Alpha System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 30–13
A–1 Using Keywords with the $name_S Macro . . . . . . . . . . . . . . . . . . . . .. A–2
A–2 Specifying Arguments in Positional Order with the $name_S
Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. A–2
A–3 Using Keywords with the $name Macro . . . . . . . . . . . . . . . . . . . . . . .. A–3
A–4 Specifying Arguments in Positional Order with the $name Macro . . .. A–3
Figures
18–1 Call Frame Generated by CALLG and CALLS Instructions . . . . . . . . . 18–4
18–2 Fixed-Size Stack Frame Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–6
18–3 Variable-Size Stack Frame Format . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–8
18–4 Structure of a VAX Argument List . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–9
18–5 Alpha Argument List Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–10
18–6 Argument Information (AI) Register (R25) Format . . . . . . . . . . . . . . . 18–10
18–7 Alpha Procedure Argument-Passing Mechanisms . . . . . . . . . . . . . . . . 18–12
18–8 VAX Procedure Argument-Passing Mechanisms . . . . . . . . . . . . . . . . . . 18–13
18–9 Atomic Data Types and Descriptor Classes . . . . . . . . . . . . . . . . . . . . . 18–20
18–10 String Data Types and Descriptor Classes . . . . . . . . . . . . . . . . . . . . . . 18–21
18–11 Miscellaneous Data Types and Descriptor Classes . . . . . . . . . . . . . . . . 18–21
18–12 Condition Value Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–23
19–1 Calling the Run-Time Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19–2
22–1 Defining and Pasting Virtual Displays . . . . . . . . . . . . . . . . . . . . . . . . . 22–14
22–2 Moving a Virtual Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–15
22–3 Repasting a Virtual Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–16
22–4 Popping a Virtual Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–17
22–5 Statistics Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–22
23–1 Mailbox Protection Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–5
23–2 Physical I/O Access Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–7
23–3 Logical I/O Access Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–8
23–4 Physical, Logical, and Virtual I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–9
23–5 I/O Function Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–10
23–6 Function Modifier Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–11
23–7 I/O Status Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–24
23–8 SYS$MOUNT Item Descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–34
24–1 Format of a Variable-Length Bit Field . . . . . . . . . . . . . . . . . . . . . . . . . 24–11
25–1 Using Cross-Reference Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–2
xiv
25–2 Summary of Symbol Names and Values . . . . . . . . . . . . . . . . . . . . . . .. 25–5
25–3 Summary of Symbol Names, Values, and Name of Referring
Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–5
25–4 Summary Indicating Defining Module . . . . . . . . . . . . . . . . . . . . . . . . . 25–5
25–5 Output Line for LIB$CRF_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . 25–6
27–1 Predefined Output Date Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–23
27–2 Predefined Output Time Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–23
29–1 Participants in a Distributed Transaction . . . . . . . . . . . . . . . . . . . . . . 29–2
30–1 Flow of Control Accessing a Privileged Routine on VAX Systems . . . . . 30–6
30–2 Components of the Privileged Library Vector on VAX Systems . . . . . . 30–7
30–3 Linkage for a Privileged Routine After Image Activation . . . . . . . . . . . 30–10
31–1 ID Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–3
31–2 UIC Identifier Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–4
31–3 Facility-Specific Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–4
31–4 Format of the Identifier Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–8
31–5 Format of the Holder Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–9
31–6 Format of the Holder Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–13
31–7 Previous Per-Thread Security Model . . . . . . . . . . . . . . . . . . . . . . . . . . 31–21
31–8 Per-Thread Security Profile Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–22
33–1 Sequence of Events During Image Initialization on VAX Systems . . . . 33–4
33–2 Sequence of Events During Image Initialization on Alpha Systems . . . 33–5
Tables
17–1 Main Headings in the Documentation Format for System Routines . . 17–2
17–2 General Rules of Syntax for Procedure Call Formats . . . . . . . . . . . . . . 17–3
17–3 Standard Data Types and Their Descriptor Field Symbols . . . . . . . . . 17–7
17–4 Descriptor Classes of Passing Mechanisms . . . . . . . . . . . . . . . . . . . . . 17–10
18–1 VAX Register Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–1
18–2 Alpha Integer Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–2
18–3 Alpha Floating-Point Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–3
18–4 Contents of the Argument Information (AI) Register (Alpha only) . . . . 18–11
18–5 String-Passing Descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18–18
20–1 OpenVMS System Access Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20–3
20–2 Severity Codes of Condition Value Returned . . . . . . . . . . . . . . . . . . . . 20–7
21–1 Structures Used by _NEW_STARLET Prototypes . . . . . . . . . . . . . . . . 21–4
22–1 SYS$INPUT and SYS$OUTPUT Values . . . . . . . . . . . . . . . . . . . . . . . 22–3
22–2 Setting Video Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22–18
23–1 Read and Write I/O Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–10
23–2 Asynchronous Input/Output Services and Their Synchronous Versions
....................................................... 23–19
23–3 System Services for Translating Logical Names . . . . . . . . . . . . . . . . . . 23–27
23–4 Default Device Names for I/O Services . . . . . . . . . . . . . . . . . . . . . . . . 23–28
23–5 SYSGEN Buffer Object Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 23–50
24–1 System Service Access Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24–2
24–2 CLI Access Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24–2
24–3 Variable-Length Bit Field Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . 24–10
xv
24–4 Integer and Floating-Point Routines . . . . . . . . . . . . . . . . . . . . . . . . . . 24–12
24–5 Queue Access Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24–13
24–6 Character String Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24–14
24–7 Miscellaneous Instruction Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . 24–15
24–8 Processwide Resource Allocation Routines . . . . . . . . . . . . . . . . . . . . . . 24–16
24–9 Performance Measurement Routines . . . . . . . . . . . . . . . . . . . . . . . . . . 24–17
24–10 The Code Argument in LIB$SHOW_TIMER and
LIB$STAT_TIMER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24–18
24–11 Routines for Customizing Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24–20
24–12 Miscellaneous Interface Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24–21
25–1 Cross-Reference Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25–1
27–1 Time Conversion Routines and System Services . . . . . . . . . . . . . . . . . 27–3
27–2 Date/Time Manipulation Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–8
27–3 Timer RTLs and System Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–8
27–4 Timer System Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–13
27–5 Available Languages for Date/Time Formatting . . . . . . . . . . . . . . . . . . 27–22
27–6 Format Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–24
27–7 Input String Punctuation and Defaults . . . . . . . . . . . . . . . . . . . . . . . . 27–28
27–8 Predefined Output Date Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–29
27–9 Predefined Output Time Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–30
27–10 Available Components for Specifying Formats at Compile Time . . . . . 27–31
27–11 Legible Format Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–32
27–12 Sample Input Format Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27–34
30–1 Components of the VAX Privileged Library Vector . . . . . . . . . . . . . . . . 30–7
30–2 Components of the Alpha Privileged Library Vector . . . . . . . . . . . . . . . 30–11
31–1 Using System Services to Manipulate Elements of the Rights
Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... 31–10
31–2 Returned Records of SYS$IDTOASC, SYS$FIND_HELD, and
SYS$FIND_HOLDER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–17
31–3 Item Code Symbols and Meanings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31–26
32–1 Logical Name Services and DCL Commands . . . . . . . . . . . . . . . . . . . . 32–2
32–2 Summary of Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32–10
A–1 Generic Argument List Macros of the System Service Interface . . . . . A–1
B–1 OpenVMS Usage Data Type Entries . . . . . . . . . . . . . . . . . . . . . . . . . . B–2
B–2 Ada Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–17
B–3 APL Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–20
B–4 BASIC Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–22
B–5 BLISS Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–25
B–6 C and C++ Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–28
B–7 COBOL Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–31
B–8 FORTRAN Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–34
B–9 Pascal Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–39
B–10 PL/I Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–42
B–11 VAX MACRO Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–48
B–12 RPG II Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–50
B–13 SCAN Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–52
xvi
Preface
Intended Audience
This manual is intended for system and application programmers. It presumes
that its readers have some familiarity with the OpenVMS programming
environment, derived from the OpenVMS Programming Environment Manual
and OpenVMS high-level language documentation. The OpenVMS Programming
Environment Manual has been archived but is available on the OpenVMS
Documentation CD_ROM.
Document Structure
The printed copy of the OpenVMS Programming Concepts Manual is a two
volume manual. The second volume contains three parts; the three parts are as
follows:
• OpenVMS Programming Interfaces: Calling a System Routine
• I/O, System and Programming Routines
• Appendixes
The chapters in Volume II provide information about the programming features
of the OpenVMS operating system. A list of the chapters and a summary of their
content are as follows:
• Chapter 17, Call Format to OpenVMS Routines, describes the format used
to document system routine calls and explains where to find and how to
interpret information about routine calls.
• Chapter 18, Basic Calling Standard Conventions, describes the concepts and
conventions used by common languages to invoke routines and pass data
between them.
• Chapter 19, Calling Run-Time Library Routines, describes a set of language-
independent routines that establishes a common run-time environment for
user programs.
• Chapter 20, Calling System Services, describes the system services available
to application and system programs for use at run time.
• Chapter 21, STARLET Structures and Definitions for C Programmers,
describes the libraries that contain C header files for routines.
• Chapter 22, Run-Time Library Input/Output Operations, describes the
different I/O programming capabilities provided by the run-time library.
• Chapter 23, System Service Input/Output Operations, describes how to use
system services to perform input and output operations.
xvii
• Chapter 24, Using Run-Time Library Routines to Access Operating System
Components, describes the run-time library (RTL) routines that allow access
to various operating system components.
• Chapter 25, Using Cross-Reference Routines, describes how cross-reference
routines that are contained in a separate, shareable image are capable of
creating a cross-reference analysis of symbols.
• Chapter 26, Shareable Resources, describes the techniques available for
sharing data and program code among programs.
• Chapter 27, System Time Operations, describes the system time format,
and the manipulation of date/time and time conversion. It further describes
how to obtain and set the current date and time, how to set and cancel
timer requests, and how to schedule and cancel wakeups. The Coordinated
Universal Time (UTC) system is also described.
• Chapter 28, File Operations, describes file attributes, strategies to access
files, and file protection techniques.
• Chapter 29, Using the Distributed Transaction Manager, describes the use
of the DECdtm system services to ensure the integrity and consistency of
distributed transactions by implementing a two-phase commit protocol.
• Chapter 30, Creating User-Written System Services, describes how to create
user-written system services with privileged shareable images for both VAX
systems and Alpha systems.
• Chapter 31, System Security Services, describes the system services that
establish protection by using identifiers, rights databases, and access control
entries. This chapter also describes how to modify a rights list as well as
check access protection.
• Chapter 32, Logical Name and Logical Name Tables, describes how to create
and use logical name services, how to use logical and equivalence names, and
how to add and delete entries to a logical name table.
• Chapter 33, Image Initialization, describes how to use the LIB$INITIALIZE
routine to initialize an image.
• Appendix A, Generic Macros for Calling System Services, describes the use
of generic macros to specify argument lists with appropriate symbols and
conventions in the system services interface to MACRO assembles.
• Appendix B, OpenVMS Data Types, describes the data types that provide
compatibility between procedure calls that support many different high-level
languages.
• Appendix C, Distributed Name Service, describes the Digital Distributed
Name Service (DECdns) Clerk by introducing the functions of the DECdns
(SYS$DNS) system service and various run-time library routines.
Related Documents
For a detailed description of each run-time library and system service routine
mentioned in this manual, see the OpenVMS Run-Time Library documentation
and the OpenVMS System Services Reference Manual.
xviii
You can find additional information about calling OpenVMS system services and
Run-Time Library routines in your language processor documentation. You may
also find the following documents useful:
• OpenVMS DCL Dictionary
• OpenVMS User’s Manual
• Guide to OpenVMS File Applications
• OpenVMS Guide to System Security
• DECnet for OpenVMS Networking Manual
• OpenVMS Record Management Services documentation
• OpenVMS Utility Routines Manual
• OpenVMS I/O User’s Reference Manual
For additional information about OpenVMS products and services, access the
following World Wide Web address:
http://www.openvms.compaq.com/
Reader’s Comments
Compaq welcomes your comments on this manual. Please send comments to
either of the following addresses:
Internet [email protected]
Mail Compaq Computer Corporation
OSSG Documentation Group, ZKO3-4/U08
110 Spit Brook Rd.
Nashua, NH 03062-2698
Conventions
The following conventions are used in this manual:
Ctrl/x A sequence such as Ctrl/x indicates that you must hold down
the key labeled Ctrl while you press another key or a pointing
device button.
PF1 x A sequence such as PF1 x indicates that you must first press
and release the key labeled PF1 and then press and release
another key or a pointing device button.
Return In examples, a key name enclosed in a box indicates that
you press a key on the keyboard. (In text, a key name is not
enclosed in a box.)
In the HTML version of this document, this convention appears
as brackets, rather than a box.
xix
... A horizontal ellipsis in examples indicates one of the following
possibilities:
• Additional optional arguments in a statement have been
omitted.
• The preceding item or items can be repeated one or more
times.
• Additional parameters, values, or other information can be
entered.
xx
Part I
OpenVMS Programming Interfaces: Calling a
System Routine
This part of this second volume describes the basic calling format for OpenVMS
routines and system services. It also describes the STARLET structures and
definitions for C programmers.
17
Call Format to OpenVMS Routines
This chapter describes the format used to document system routine calls and
explains where to find and how to interpret information about routine calls.
Subsequent chapters provide more specific information about calling run-time
library (RTL) routines and system services.
Note
The documentation format described in this chapter is generic; portions
of it are used or not used, as appropriate, in the following OpenVMS
manuals that document system routines:
OpenVMS System Services Reference Manual: A–GETUAI
OpenVMS System Services Reference Manual: GETUTC–Z
OpenVMS Run-Time Library manuals
OpenVMS Utility Routines Manual
OpenVMS Record Management Services Reference Manual
17.1 Overview
This chapter provides additional explanations for the following documentation
categories for routines:
• Format
• Returns
• Arguments
• Condition values returned
However, some main categories in the routine format contain information
requiring no explanation beyond that given in Table 17–1.
Table 17–1 Main Headings in the Documentation Format for System Routines
Main Heading Description
Routine Name Always present. The routine entry point name appears at the
top of the first page. It is usually followed by the English text
name of the routine.
Routine Overview Always present. Appears directly below the routine name and
briefly explains what the routine does.
Format Always present. Follows the routine overview and gives the
routine entry point name and the routine argument list.
Returns Always present. Follows the routine format and explains what
information is returned by the routine.
Arguments Always present. Follows the Returns heading and gives
detailed information about each argument. If a routine takes
no arguments, the word None appears.
Description Optional. Follows the Arguments heading and contains
information about specific actions taken by the routine:
interaction between routine arguments, if any; operation of
the routine within the context of OpenVMS; user privileges
needed to call the routine, if any; system resources used by the
routine; and user quotas that might affect the operation of the
routine.
Note that any restrictions on the use of the routine are always
discussed first in the Description section. For example, any
required user privileges or necessary system resources are
explained first.
For some simple routines, a Description section is not
necessary because the routine overview provides the needed
information.
Condition Values Always present. Follows the Description section and lists the
Returned condition values (typically status or completion codes) that are
returned by the routine.
Example Optional. Follows the Condition Values Returned heading and
contains one or more programming examples that illustrate
how to use the routine, followed by an explanation.
All examples under this heading are complete. They have
been tested and should run when compiled (or assembled)
and linked. Throughout the manuals that document system
routines, examples are provided in as many different
programming languages as possible.
Format 2 When the argument list contains three or more optional arguments,
the syntax does not provide enough information. If you omit the optional
arguments arg3 and arg4 and specify the trailing argument arg5, you must use
commas to delimit the positions of the omitted arguments.
ROUTINE_NAME arg1, [arg2], nullarg, [arg3], [arg4], arg5
Typically, system services, utility routines, and run-time library routines contain
call formats with more than three arguments.
Format 3 In the following call format, the trailing four arguments are optional
as a group; that is, you specify either arg2, arg3, arg4, and arg5, or none of
them. Therefore, if you do not specify the optional arguments, you need not use
commas to delimit unoccupied positions.
However, if you specify a required argument or a separate optional argument
after arg5, you must use commas when arg2, arg3, arg4, and arg5 are omitted.
ROUTINE_NAME arg1[, arg2, arg3, arg4, arg5]
Format 4 In the following example, you can specify arg2 and omit arg3.
However, whenever you specify arg3, you must specify arg2.
ROUTINE_NAME arg1[, arg2[, arg3]]
For example, because the routine is returning actual data in the VAX or Alpha
registers, the registers cannot be used to convey completion status information.
All routines that return actual data in VAX or Alpha registers must signal the
condition value, which contains the completion status. Thus, the text under the
Returns heading points out that the routine signals its completion status.
Table 17–3 Standard Data Types and Their Descriptor Field Symbols
Data Type Symbolic Code
Absolute date and time DSC$K_DTYPE_ADT
Byte integer (signed) DSC$K_DTYPE_B
Bound label value DSC$K_DTYPE_BLV
1
Bound procedure value DSC$K_DTYPE_BPV
Byte (unsigned) DSC$K_DTYPE_BU
COBOL intermediate temporary DSC$K_DTYPE_CIT
D_floating DSC$K_DTYPE_D
D_floating complex DSC$K_DTYPE_DC
Descriptor DSC$K_DTYPE_DSC
F_floating DSC$K_DTYPE_F
F_floating complex DSC$K_DTYPE_FC
G_floating DSC$K_DTYPE_G
G_floating complex DSC$K_DTYPE_GC
H_floating1 DSC$K_DTYPE_H
1
H_floating complex DSC$K_DTYPE_HC
2
S_floating (32-bit IEEE) DSC$K_DTYPE_FS
1 VAX specific.
2 Alpha specific.
Table 17–3 (Cont.) Standard Data Types and Their Descriptor Field Symbols
Data Type Symbolic Code
2
T_floating (64-bit IEEE) DSC$K_DTYPE_FT
X_floating (128-bit IEEE)2 DSC$K_DTYPE_FX
2
S_floating complex DSC$K_DTYPE_FSC
2
T_floating complex DSC$K_DTYPE_FTC
X_floating complex2 DSC$K_DTYPE_FXC
Longword integer (signed) DSC$K_DTYPE_L
Longword (unsigned) DSC$K_DTYPE_LU
Numeric string, left separate sign DSC$K_DTYPE_NL
Numeric string, left overpunched sign DSC$K_DTYPE_NLO
Numeric string, right separate sign DSC$K_DTYPE_NR
Numeric string, right overpunched sign DSC$K_DTYPE_NRO
Numeric string, unsigned DSC$K_DTYPE_NU
Numeric string, zoned sign DSC$K_DTYPE_NZ
Octaword integer (signed) DSC$K_DTYPE_O
Octaword (unsigned) DSC$K_DTYPE_OU
Packed decimal string DSC$K_DTYPE_P
Quadword integer (signed) DSC$K_DTYPE_Q
Quadword (unsigned) DSC$K_DTYPE_QU
Character string DSC$K_DTYPE_T
Aligned bit string DSC$K_DTYPE_V
Varying character string DSC$K_DTYPE_VT
Unaligned bit string DSC$K_DTYPE_VU
Word integer (signed) DSC$K_DTYPE_W
Word (unsigned) DSC$K_DTYPE_WU
Unspecified DSC$K_DTYPE_Z
1
Procedure entry mask DSC$K_DTYPE_ZEM
1
Sequence of instruction DSC$K_DTYPE_ZI
1 VAX specific.
2 Alpha specific.
• Write only. Data that the called routine returns to the calling program must
be written into a location where the calling program can access it. Such
data is also called output data. When an argument specifies output data, the
access entry is write only.
In this context, the term only is present to indicate that the called routine
does not read the contents of the location either before or after it writes into
the location.
• Modify. When an argument specifies data that is both read and written by
the called routine, the access entry is modify. In this case, the called routine
reads the input data, which it uses in its operation, and then overwrites the
input data with the results (the output data) of the operation. Thus, when the
called routine completes execution, the input data specified by the argument
is lost.
Following is a complete list of access methods that can appear under the access
entry in an argument description:
• Read only
• Write only
• Modify
• Function call (before return)
• JMP after unwind
• Call after stack unwind
• Call without stack unwind
For more information, see the OpenVMS Calling Standard.
Table 17–4 lists the types of descriptors and their corresponding code names.
See the OpenVMS Calling Standard for a detailed description of each
descriptor class.
The OpenVMS Calling Standard defines the concepts and conventions used by
common languages to invoke routines and pass data between them. This chapter
briefly describes the following calling standard conventions:
• Register usage
• Stack usage
• Argument list
• Argument passing
• Returns
Refer to the OpenVMS Calling Standard for more detail on calling conventions
and for standards defining argument data types, descriptor formats, and
procedures for condition handling and stack unwinding.
By definition, any called routine can use registers R2 through R11 for
computation and the AP register as a temporary register.
• The stored address (program count) of the point at which the routine was
called. Specifically, this address is the program count from the program
counter (PC) of the instruction following the call to the current routine.
• The contents of other general registers. Based on a register save mask
specified in the control information of the second longword, the system
restores the saved contents of the identified registers to the calling routine
when control returns to it.
31 0
ZK−5249A−GE
The contents of the stack located at addresses following the call frame belong to
the calling program; they should not be read or written by the called procedure,
except as specified in the argument list. The contents of the stack located at
addresses lower than the call frame (at FP) belong to interrupt and exception
routines; they are modified continually and unpredictably.
The called procedure allocates local storage by subtracting the required number of
bytes from the stack provided on entry. This local storage is freed automatically
by the RET instruction.
Use of the arguments passed in memory appending the end of the frame is
described in Section 18.4. For more detail concerning the fixed-size stack frame,
see the OpenVMS Calling Standard.
octaword aligned
:0 (from SP)
:RSA_OFFSET
(from SP)
ZK−4650A−GE
stored in a target variable. When a procedure uses this area, the compiler
must keep track of its base and reset SP to the base to reclaim storage used by
temporaries.
The register save area is a set of consecutive quadwords in which registers
saved and restored by the current procedure are stored. The register save area
(RSA) begins at the location pointed to by the offset PDSC$W_RSA_OFFSET. The
contents of the return address register (R26) is always saved in the first register
field (SAVED_RETURN) of the register save area.
Use of the arguments passed in memory appending the end of the frame is
described in Section 18.4. For more detail concerning the variable-size stack
frame, see the OpenVMS Calling Standard.
octaword aligned
:0 (from SP)
:0 (from FP)
Procedure descriptor address
:8 (from FP)
:RSA_OFFSET
(from FP)
ZK−4651A−GE
31 0
Argument :arglst
Must be 0 count (n)
arg1
arg2
argn
ZK−4648A−GE
On Alpha systems, arguments are quadwords, and the calling program passes
arguments in an argument item sequence. Each quadword in the sequence
specifies a single argument. The argument item sequence is formed using R16–21
or F16–21 (a register for each argument). The argument item sequence can have
a mix of integer and floating-point items that use both register types but must
not repeat the same number. For example, an argument list might use R16,
R17, F18, and R19. If there are more than six arguments, the argument items
overflow to the end of the stack, as shown in Figure 18–5.
The calling procedure must pass to the called procedure information about the
argument list. For high-level languages, this is performed by the language
processor. In the argument information (AI) register (R25), the quadword format
is the structure shown in Figure 18–6. The AI register contains the argument
count in the first byte. Table 18–4 describes the argument information fields in
detail.
Alpha Registers
R16 (arg1)
R17 (arg2)
R18 (arg3)
R19 (arg4)
arg8
Arguments passed in
memory for more than
R30 (SP) six arguments
F16 (arg1)
F17 (arg2)
F18 (arg3)
F19 (arg4)
F20 (arg5)
F21 (arg6)
ZK−5273A−GE
64 25 7 0
Must be 0 ARG_REG_INFO
ARG_COUNT
ZK−6510A−GE
Table 18–4 Contents of the Argument Information (AI) Register (Alpha only)
Field Name Contents
AI$B_ARG_COUNT Unsigned byte <7:0> that specifies the number of 64-bit argument items in the
argument list (known as the argument count).
AI$V_ARG_REG_INFO An 18-bit vector field <25:8> divided into 6 groups of 3 bits that correspond to
the 6 arguments passed in registers. These groups describe how each of the first
six arguments are passed in registers with the first group <10:8> describing the
first argument. The encoding for each group for the argument register usage
follows:
argn pointer
Pointer
Data
argn pointer to DSC
D C B A
H G F E
ZK−5248A−GE
n :(AP)
arg1
arg2
Actual value
argn
n :(AP)
arg1
arg2
Pointer to
actual value Data
Actual Value
argn
Data (bytes)
Argument Passed by Descriptor
A
n B
:(AP)
arg1 C
arg2 D
Descriptor Length
Pointer to Class D Type Length E
descriptor
Pointer F
argn G
H
Note: arg1, arg2, and argn can be passed by value,
by reference, or by descriptor in any of these examples.
n = Number of arguments
ZK−1962−GE
Symbol Description
DSC$W_LENGTH Length of data (or DSC$W_MAXSTRLEN, maximum length, for
varying strings)
DSC$B_DTYPE Data type
DSC$B_CLASS Descriptor class code
DSC$A_POINTER Address at which the data begins
DSC$K_CLASS
_S _D _V _A _P _SD _NCA _VS _VSA _UBS _UBA _BFA
Data Type Value =1 =2 =3 =4 =5 =9 = 10 = 11 = 12 = 13 = 14 = 191
DSC$K_DTYPE_Z = 0 Yes − − Yes − − Yes − − Yes Yes −
DSC$K_DTYPE_BU = 2 Yes − − Yes Yes − Yes − − Yes Yes −
DSC$K_DTYPE_WU = 3 Yes − − Yes − − Yes − − Yes Yes −
DSC$K_DTYPE_LU = 4 Yes − − Yes − − Yes − − Yes Yes −
DSC$K_DTYPE_QU = 5 Yes − − Yes − − Yes − − − − −
DSC$K_DTYPE_OU = 25 Yes − − Yes − − Yes − − − − −
DSC$K_DTYPE_B = 6 Yes − − Yes Yes Yes Yes − − Yes Yes −
DSC$K_DTYPE_W = 7 Yes − − Yes Yes Yes Yes − − Yes Yes Yes
DSC$K_DTYPE_L = 8 Yes − − Yes Yes Yes Yes − − Yes Yes Yes
DSC$K_DTYPE_Q = 9 Yes − − Yes − Yes Yes − − − − −
DSC$K_DTYPE_O = 26 Yes − − Yes − Yes Yes − − − − −
DSC$K_DTYPE_F = 10 Yes − − Yes Yes Yes Yes − − Yes Yes Yes
DSC$K_DTYPE_D = 11 Yes − − Yes Yes Yes Yes − − − − Yes
DSC$K_DTYPE_G = 27 Yes − − Yes Yes Yes Yes − − − − −
DSC$K_DTYPE_H = 28 Yes − − Yes Yes Yes Yes − − − − −
DSC$K_DTYPE_FC = 12 Yes − − Yes Yes − Yes − − − − −
DSC$K_DTYPE_DC = 13 Yes − − Yes Yes − Yes − − − − −
DSC$K_DTYPE_GC = 29 Yes − − Yes Yes − Yes − − − − −
DSC$K_DTYPE_HC = 30 − − − − − − − − − − − −
DSC$K_DTYPE_FS = 52 Yes − − Yes Yes Yes Yes − − Yes Yes Yes
DSC$K_DTYPE_FT = 53 Yes − − Yes Yes Yes Yes − − − − −
DSC$K_DTYPE_FSC = 54 Yes − − Yes Yes − Yes − − − − −
DSC$K_DTYPE_FTC = 55 Yes − − Yes Yes − Yes − − − − −
DSC$K_DTYPE_FX = 57 Yes − − Yes Yes − Yes − − − − −
DSC$K_DTYPE_FXC = 58 Yes − − Yes Yes − Yes − − − − −
Yes The calling standard allows this combination of class and data type.
− The calling standard forbids the use of this combination of class and data type.
Higher−level languages and their run−time support must conform to this restriction.
= VAX specific
= Alpha specific
ZK−4267−GE
DSC$K_CLASS
_S _D _V _A _P _SD _NCA _VS _VSA _UBS _UBA _BFA
Data Type Value =1 =2 =3 =4 =5 =9 = 10 = 11 = 12 = 13 = 14 = 191
DSC$K_DTYPE_V = 1 Yes − − Yes − − Yes − − Yes Yes −
DSC$K_DTYPE_T = 14 Yes Yes − Yes Yes Yes Yes Yes Yes Yes Yes Yes
DSC$K_DTYPE_NU = 15 Yes − − − − Yes Yes − − − − −
DSC$K_DTYPE_NL = 16 Yes − − − − Yes Yes − − − − −
DSC$K_DTYPE_NLO = 17 Yes − − − − Yes Yes − − − − −
DSC$K_DTYPE_NR = 18 Yes − − − − Yes Yes − − − − −
DSC$K_DTYPE_NLR = 19 Yes − − − − Yes Yes − − − − −
DSC$K_DTYPE_NZ = 20 Yes − − − − Yes Yes − − − − −
DSC$K_DTYPE_P = 21 Yes − − − − Yes Yes − − − − −
DSC$K_DTYPE_VT = 37 − − − − − − − Yes Yes − − −
DSC$K_DTYPE_VU = 34 * * * * * * * * * * * *
Yes The calling standard allows this combination of class and data type.
− The calling standard forbids the use of this combination of class and data type.
Higher−level languages and their run−time support must conform to this restriction.
ZK−4266−GE
DSC$K_CLASS
_S _D _V _A _P _SD _NCA _VS _VSA _UBS _UBA _BFA
Data Type Value =1 =2 =3 =4 =5 =9 = 10 = 11 = 12 = 13 = 14 = 191
DSC$K_DTYPE_ZI = 22 Yes − − − − * − − − − − −
DSC$K_DTYPE_ZEM = 23 Yes − − − − * − − − − − −
DSC$K_DTYPE_DSC = 3 − − − Yes − * Yes − − − − −
DSC$K_DTYPE_BPV = 32 Yes − − − − * Yes − − − − −
DSC$K_DTYPE_BLV = 33 Yes − − − − * Yes − − − − −
Yes The calling standard allows this combination of class and data type.
− The calling standard forbids the use of this combination of class and data type.
Higher−level languages and their run−time support must conform to this restriction.
ZK−4265−GE
31 28 27 3 2 0
2 1 0
*S
27 16 15 3
*S = Success
ZK−1795−GE
When the completion code is signaled, the calling program must establish
a handler to get control and take appropriate action. (See the OpenVMS
Programming Concepts Manual or the OpenVMS Calling Standard for a
description of signaling and condition handling and for more information about
the condition value.)
19.1 Overview
When you call a run-time library routine from your program, you must furnish
whatever arguments the routine requires. When the routine completes execution,
in most cases it returns control to your program. If the routine returns a status
code, your program should check the value of the code to determine whether or
not the routine completed successfully. If the return status indicates an error,
you may want to change the flow of execution of your program to handle the error
before returning control to your program.
When you log in, the operating system creates a process that exists until you log
out. When you run a program, the system activates an executable image in your
process. This image consists of a set of user procedures.
From the run-time library’s point of view, user procedures are procedures that
exist outside the run-time library and that can call run-time library routines.
When you write a program that calls a run-time library routine, the run-time
library views your program as a user procedure. User procedures also can call
other user procedures that are either supplied by Compaq or written by you.
Because an OpenVMS native-mode language compiler program exists outside
the run-time library, compiler-generated programs that call any run-time library
routine are also defined as a set of user procedures.
The main program, or main procedure, is the first user procedure that the
system calls after calling a number of initialization procedures. A user program
consists of the main program and all of the other user procedures that it calls.
Figure 19–1 shows the calling relationships among a main program, other user
procedures, library routines, and the operating system. In this figure, Call
indicates that the calling procedures requested some information or action;
Return indicates that the called procedure returned the information to the calling
procedure or performed the action.
Call
Return
Library
Procedure
Return Return
Service Call
Return
ZK−4262−GE
Although library routines can always call either other library routines or the
operating system, they can call user procedures only in the following cases:
• When a user procedure establishes its own condition handler. For example,
LIB$SIGNAL operates by searching for and calling user procedures that have
been established as condition handlers (see the OpenVMS RTL Library (LIB$)
Manual for more information).
• When a user procedure passes to a routine the address of another procedure
that the library will call later. For example, when your program calls
LIB$SHOW_TIMER, you can pass the address of an action routine that
LIB$SHOW_TIMER will call to process timing statistics.
!+
! Initialize the fields of the string descriptor.
!-
MSGDESC[DSC$B_CLASS]=DSC$K_CLASS_S;
MSGDESC[DSC$B_DTYPE]=DSC$K_DTYPE_T;
MSGDESC[DSC$W_LENGTH]=80;
MSGDESC[DSC$A_POINTER]=MSGBUF[0]
$GETTIM(TIMADR=TIMEBUF); ! Get time as 64-bit integer
$FAOL(CTRSTR=FMTDESC, ! Format descriptor
OUTLEN=RSLT, ! Output length (only a word!)
OUTBUF=MSGDESC, ! Output buffer desc.
PRMLST= %REF(TIMEBUF)); ! Address of 64-bit
! time block
MSGDESC [DSC$W_LENGTH] = .RSLT; ! Modify output desc.
RETURN (LIB$PUT_OUTPUT(MSGDESC); ! Return status
END;
END
ELUDOM
The OpenVMS operating system kernel has many services that are made
available to application and system programs for use at run time. These system
services are procedures that the OpenVMS operating system uses to control
resources available to processes; to provide for communication among processes;
and to perform basic operating system functions, such as the coordination of
input/output operations. The OpenVMS Programming Concepts Manual defines
these functions further.
This chapter describes the basic methods and conventions for coding calls to
system services from OpenVMS high-level languages or from an assembly
language.
For more information about using the system services that support 64-bit
addressing and to see example programs that demonstrate the use of these
services, refer to Chapter 11.
20.1 Overview
System services are called by using the conventions of the OpenVMS Calling
Standard. The programming languages that generate VAX or Alpha native mode
instructions provide mechanisms for specifying the procedure calls.
When you call a system service from your program, you must furnish whatever
arguments the routine requires. When the system service procedure completes
execution, in most cases it returns control to your program. If the service returns
a status code, your program should check the value of the code to determine
whether or not the service completed successfully. If the return status indicates
an error, you may want to change the flow of execution of your program to handle
the error before returning control to your program.
When you write a program that calls a system service in the OpenVMS operating
system, the operating system views your program as a user procedure. User
procedures also can call other user procedures that are either supplied by
Compaq or written by you. Because an OpenVMS native-mode language compiler
program exists outside the operating system, compiler generated programs calling
any system service are also defined as a set of user procedures.
If you program in a high-level language, refer to Chapter 21 for information about
the SYS$LIBRARY:SYS$LIB_C.TLB file, which is an OpenVMS Alpha library of
C header files.
For VAX MACRO, system service macros generate argument lists and CALL
instructions to call system services. These macros are located in the system
library (see SYS$LIBRARY:STARLET.MLB). When you assemble a source
program, this library is searched automatically for unresolved references. (See
Appendix A for further details.) Similar macros are available for VAX BLISS and
are located in SYS$LIBRARY:STARLET.REQ.
In some system service calls, the access mode of the caller is checked. For
example, when a process tries to cancel timer requests, it can cancel only those
requests that were issued from the same or less privileged access modes. For
example, a process executing in user mode cannot cancel a timer request made
from supervisor, executive, or kernel mode.
Note that many system services use access modes to protect system resources,
and thus employ a special convention for interpreting access mode arguments.
You can specify an access mode using a numeric value or a symbolic name.
Table 20–1 shows the access modes and their numeric values, symbolic names,
and privilege ranks.
The symbolic names are defined by the symbolic definition macro SYS$PSLDEF.
System services that permit an access mode argument allow callers to specify
only an access mode of equal or lesser privilege than the access mode from which
the service was called. If the specified access mode is more privileged than the
access mode from which the service was called, the less privileged access mode is
always used.
To determine the mode to use, the operating system compares the specified access
mode with the access mode from which the service was called. Because this
operation results in an access mode with a higher numeric value (when the access
mode of the caller is different from the specified access mode), the access mode is
said to be maximized.
Because much of the code you write executes in user mode, you can omit the
access mode argument. The argument value defaults to 0 (kernel mode), and
when this value is compared with the value of the current execution mode
(3, user mode), the higher value ( 3 ) is used.
Each numeric condition value has a unique symbolic name in the following
format:
SS$_code
where code is a mnemonic describing the return condition.
For example, the following symbol usually indicates a successful return:
SS$_NORMAL
An example of an error return condition value is as follows:
SS$_ACCVIO
This condition value indicates that an access violation occurred because a service
could not read an input field or write an output field.
The symbolic definitions for condition values are included in the default system
library SYS$LIBRARY:STARLET.OLB. You can obtain a listing of these symbolic
codes at assembly time by invoking the system macro SYS$SSDEF. To check
return conditions, use the symbolic names for system condition values.
The OpenVMS operating system does not automatically handle system service
failure or warning conditions; you must test for them and handle them yourself.
This contrasts with the operating system’s handling of exception conditions
detected by the hardware or software; the system handles these exceptions
by default, although you can intervene in or override the default handling by
declaring a condition handler.
If your language has a method of obtaining values for these symbols, this method
is explained in the user’s guide.
If your language does not have such a method, you can do the following:
1. Write a short VAX MACRO program containing the desired macros.
2. Assemble or compile the program and generate a listing. Using the listing,
find the desired symbols and their hexadecimal values.
3. Define each symbol with its value within your source program.
For example, to use the Get Job/Process Information ($GETJPI) system service
to find out the accumulated CPU time (in 10-millisecond ticks) for a specified
process, you must obtain the value associated with the item identifier JPI$_
CPUTIM. You can do this in the following way:
1. Create the following three-line VAX MACRO program (named JPIDEF.MAR
here; you can choose any name you want):
.TITLE JPIDEF "Obtain values for $JPIDEF"
$JPIDEF GLOBAL ; These MUST be UPPERCASE
.END
2. Assemble and link the program to create the file JPIDEF.MAP as follows:
$ MACRO JPIDEF
$ LINK/NOEXE/MAP/FULL JPIDEF
%LINK-W-USRTFR, image NL:[].EXE; has no user transfer address
The file JPIDEF.MAP contains the symbols defined by $JPIDEF listed both
alphabetically and numerically.
To compile the program to create the JPIDEF.MAP, enter the following:
$ MACRO/MIGRATION JPIDEF
$ LINK/NOEXE/MAP/FULL JPIDEF
%LINK-W-USRTFR, image NL:[].EXE; has no user transfer address
3. Find the value of JPI$_CPUTIM and define the symbol in your program.
Error Meaning
SS$_ACCVIO The argument list cannot be read by the caller (using the
$name_G macro), and the service is not called.
This meaning of SS$_ACCVIO is different from its meaning
for individual services. When SS$_ACCVIO is returned from
individual services, the service is called, but one or more
arguments to the service cannot be read or written by the
caller.
SS$_INSFARG Not enough arguments were supplied to the service.
SS$_ILLSER An illegal system service was called.
Ada Notes
! The with clause names the predefined packages of declarations used in this
program. SYSTEM and TEXT_IO are standard Ada packages; STARLET
defines the OpenVMS system service routines, data types, and constants; and
CONDITION_HANDLING defines error-handling facilities.
" Enough space is allocated to EQUIV_NAME to hold the longest possible
logical name. NAME_LENGTH will receive the actual length of the
translated logical name. The VOLATILE pragma is required for variables
that will be modified by means other than an assignment statement or being
an output parameter to a routine call.
# ITEM_LIST_3_TYPE is a predeclared type in package STARLET that defines
the OpenVMS three-longword item list structure.
$ The dollar-sign character is not valid in Ada identifiers; package STARLET
defines the fac$ names by removing the dollar sign.
% COND_VALUE_TYPE is a predeclared type in package CONDITION_
HANDLING that is used for return status values.
& System services are defined in package STARLET using names that omit the
prefix SYS$. The passing mechanisms are specified in the routine declaration
in STARLET, so they need not be specified here.
’ In this example, any failure status from the SYS$TRNLNM service is
signaled as an error. Other means of error recovery are possible; see your
Ada language documentation for more details.
BASIC Notes
! The SUB statement defines the routine and its entry mask.
" The DECLARE WORD NAMLEN declaration reserves a 16-bit word for the
output value.
# The COMMON (BUF) STRING NAME_STRING = 255 declaration allocates
255 bytes for the output data in a static area. The compiler builds the
descriptor.
$ The SYS$ form invokes the system service as a function.
Enclose the arguments in parentheses and specify them in positional order
only. Specify a comma for each optional argument that you omit (including
trailing arguments).
% The input character string is specified directly in the system service call; the
compiler builds the descriptor.
& The IF statement performs a test on the low-order bit of the return status.
This form is recommended for all status returns.
BLISS Notes
! The macro is invoked by its service name, without a suffix.
Enclose the arguments in parentheses and specify them by keyword.
(Keyword names correspond to the names of the arguments shown in
lowercase in the system service format descriptions in the OpenVMS System
Services Reference Manual.)
" The return status, which is assigned to the variable STATUS, is tested for
TRUE or FALSE. FALSE (low bit = 0) indicates failure or warning.
#include <starlet.h> !
#include <lib$routines.h>
#include <ssdef.h>
#include <lnmdef.h>
#include <descrip.h>
#include <stdio.h>
typedef struct { "
unsigned short buffer_length;
unsigned short item_code;
char *buffer_addr;
short *return_len_addr;
unsigned terminator;
} item_list_t;
main ()
{ #
$DESCRIPTOR(table_name, "LNM$FILE_DEV");
$DESCRIPTOR(log_name, "CYGNUS");
char translated_name[255];
int status;
short return_length;
item_list_t item_list;
item_list.buffer_length = sizeof(translated_name); $
item_list.item_code = LNM$_STRING;
item_list.buffer_addr = translated_name;
item_list.return_len_addr = &return_length;
item_list.terminator = 0;
status = sys$trnlnm(0, &table_name, &log_name, 0, &item_list); %
if (!(status & 1)) &
lib$signal(status);
else
printf("The logical name %s is equivalent to %*s\n",
log_name.dsc$a_pointer,
return_length,
translated_name);
}
C Notes
! The C language header file starlet.h defines OpenVMS system services
entry points. The file lib$routines.h declares the LIB$ Run-Time Library
routines.
" The structure of an item list entry is defined.
# The $DESCRIPTOR macro declares and initializes a character string
descriptor. Here, two descriptors are created for use with the sys$trnlnm
system service.
$ The function sizeof is used to obtain the size of the string. The returned
length will be stored as a short integer in return_length.
% The sys$trnlnm routine is defined in starlet.h.
& The IF statement performs a logical test following the function reference to
determine whether the service completed successfully. If an error or warning
occurs during the service call, the error is signaled.
COBOL Notes
! The PROGRAM-ID paragraph identifies the program by specifying the
program name, which is the global symbol associated with the entry point.
The compiler builds the entry mask.
" Enough bytes are allocated for the alphanumeric output data. The compiler
generates a descriptor when you specify USING BY DESCRIPTOR in the
CALL statement.
# The value of the symbolic code LNM$STRING is 2. Section 20.4.5 explains
how to obtain values for symbolic codes.
$ This definition reserves a signed longword with COMP (binary) usage to
receive the output value.
% The service is called by the SYS$ form of the service name, and the name is
enclosed in quotation marks.
Specify arguments in positional order only, with the USING statement. You
cannot omit arguments; if you are accepting the default for an argument, you
must pass the default value explicitly (OMITTED in this example).
You can specify explicitly how each argument is being passed: by descriptor,
by reference (that is, by address), or by value. You can also implicitly
specify how an argument is being passed: through the default mechanism
(by reference), or through association with the last specified mechanism (thus,
the last two arguments in the example are implicitly passed by value).
& The input string is defined as alphanumeric (ASCII) data. The compiler
generates a descriptor when you specify USING BY DESCRIPTOR in the
CALL statement.
’ The IF statement tests RESULT for a failure status. In this case, control is
passed to the routine ERROR-CHECK.
FORTRAN Notes
! The module $SYSSRVNAM in the FORTRAN system default library
FORSYSDEF.TLB contains INTEGER and EXTERNAL declarations for each
of the system services, so you need not explicitly provide these declarations in
your program. Module $LNMDEF defines constants and data structures used
when calling the logical name services, and module LIB$ROUTINES contains
declarations for the LIB$ Run-Time Library routines.
" The structure of an OpenVMS 3-longword item list is declared and then used
to define the record variable ITEM_LIST. The second element will be used for
the terminator.
# The VOLATILE declaration is required for variables that are modified by
means other than a direct assignment or as an argument in a routine call.
$ Return status variables should always be declared as longword integers.
% The LEN intrinsic function returns the allocated length of EQUIV_NAME.
The %LOC built-in function returns the address of its argument.
& By default, FORTRAN passes arguments by reference, except for strings
which are passed by CLASS_S descriptor. Arguments are omitted in
FORTRAN by leaving the comma as a placeholder. All arguments must
be specified or explicitly omitted.
’ A condition value can be tested for success or failure by a true/false test. For
more information on testing return statuses, see the OpenVMS FORTRAN
documentation.
[INHERIT(’SYS$LIBRARY:STARLET’, !
’SYS$LIBRARY:PASCAL$LIB_ROUTINES’)]
PROGRAM ORION (OUTPUT);
TYPE
Item_List_Cell = RECORD CASE INTEGER OF "
1:( { Normal Cell }
Buffer_Length : [WORD] 0..65535;
Item_Code : [WORD] 0..65535;
Buffer_Addr : UNSIGNED;
Return_Addr : UNSIGNED
);
2:( { Terminator }
Terminator : UNSIGNED
);
END;
Item_List_Template(Count:INTEGER) = ARRAY [1..Count] OF Item_List_Cell;
VAR
Item_List : Item_List_Template(2);
Translated_Name : [VOLATILE] VARYING [255] OF CHAR; #
Status : INTEGER;
BEGIN
{ Specify the buffer to return the translation } $
Item_List[1].Buffer_Length := SIZE(Translated_Name.Body);
Item_List[1].Item_Code := LNM$_String;
Item_List[1].Buffer_Addr := IADDRESS(Translated_Name.Body);
Item_List[1].Return_Addr := IADDRESS(Translated_Name.Length);
{ Terminate the item list }
Item_List[2].Terminator := 0;
{ Translate the CYGNUS logical name }
Status := $trnlnm(Tabnam := ’LNM$FILE_DEV’, Lognam := ’CYGNUS’, %
Itmlst := Item_List);
IF NOT ODD(Status) &
THEN
LIB$SIGNAL(Status)
ELSE
WRITELN(’CYGNUS is equivalent to ’,Translated_Name);
END.
Pascal Notes
! The Pascal environment file STARLET.PEN defines OpenVMS system
services, data structures and constants. PASCAL$LIB_ROUTINES declares
the LIB$ Run-Time Library routines.
" The structure of an item list entry is defined using a variant record type.
# The VARYING OF CHAR type is a variable-length character string with two
components: a word-integer length and a character string body, which in this
example is 255 bytes long. The VOLATILE attribute is required for variables
that are modified by means other than a direct assignment or as an argument
in a routine call.
$ The functions SIZE and IADDRESS obtain the allocated size of the string
body and the address of the string body and length. The returned length will
be stored into the length field of the varying string Translated_Name, so that
it will appear to be the correct size.
This chapter describes the libraries that contain C header files for routines
supplied by the OpenVMS Alpha operating system.
You can define the _ _NEW_STARLET symbol with a Compaq C command line
qualifier or include the definition directly in your source program. For example:
• Define the _NEW_STARLET symbol with the Compaq C command line
qualifier as follows:
/DEFINE=(__NEW_STARLET=1)
or
• Define the _NEW_STARLET symbol in your C source program before
including the SYS$STARLET_C.TLB header files:
#define __NEW_STARLET 1
#include <starlet.h>
#include <vadef.h>
To see the currently available system service function prototypes in STARLET.H,
you can use the Librarian utility as shown in the following example:
$ LIBRARY/OUTPUT=STARLET.H SYS$LIBRARY:SYS$STARLET_C.TLB/EXTRACT=STARLET
The following example shows a new system service function prototype as it is
defined in STARLET.H:
#pragma __required_pointer_size __long
int sys$expreg_64(
struct _generic_64 *region_id_64,
unsigned __int64 length_64,
unsigned int acmode,
unsigned int flags,
void *(*(return_va_64)),
unsigned __int64 *return_length_64);
#pragma __required_pointer_size __short
For more information about Compaq C pointer size pragmas, see the DEC C
User’s Guide for OpenVMS Systems.
The following source code example shows the sys$expreg_64 function prototype
referenced in a program.
Table 21–1 lists the data structures that are used by the new function protypes.
This part of this second volume describes the I/O operations, and the system and
programming routines used by run-time libraries and system services.
22
Run-Time Library Input/Output Operations
This chapter describes the different I/O programming capabilities provided by the
run-time library and illustrates these capabilities with examples of common I/O
tasks. This chapter contains the following sections:
Section 22.1 describes the input and output operations within a program.
Section 22.2 describes using SYS$INPUT and SYS$OUTPUT.
Section 22.3 describes using LIB$GET_INPUT and LIB$PUT_OUTPUT for
simple user I/O.
Section 22.4 describes using the SMG$ run-time library routines for managing
the appearance of terminal screens.
Section 22.5 describes using screen management input routines and the SYS$QIO
and SYS$QIOW system services to perform special actions.
• RTL routines allow you either to read complex input from a user or to
send complex output to a user. By providing an extensive number of screen
management (SMG$) routines, the RTL allows you either to read multiple
lines of input from users or to send complex output to users. The SMG$
routines also allow you to create and modify complicated displays that accept
input and produce output. See Section 22.4 for more information.
• RTL routines allow you to use programming language I/O statements to send
data to and receive data from files. Program language I/O statements call
OpenVMS RMS routines to complete most file I/O. You can also use OpenVMS
RMS directly in your programs for accomplishing file I/O. See Chapter 28 for
more information.
• The SYS$QIO and SYS$QIOW system services allow you to send data to
and from devices with the most flexibility and control. You can use system
services to access devices not supported by your programming language or by
OpenVMS RMS.
You can perform other special I/O actions, such as using interrupts,
controlling echo, handling unsolicited input, using the type-ahead buffer,
using case conversion, and sending sytem broadcast messges, by using
SMG$ routines or, for example, by using SYS$BRKTHRU system service to
broadcast messages. See Section 22.5 for more information.
$LOOP:
$ SET DISPLAY/CREATE/NODE=remote
$ RUN SYS$SYSTEM:DECW$CLOCK
$ IF $STATUS THEN GOTO DONE
$ WAIT 0:0:5
$ GOTO LOOP
$DONE:
If the clock cannot be started for some reason, one WSA device will be created for
each failed attempt. These WSA devices will use up non-paged dynamic memory,
and eventually the process will exceed its BYTLM quota and enter a resource
wait state (if resource waiting is enabled, as it is by default).
$ SET DISPLAY/CREATE/NODE=remote
$LOOP:
$ RUN SYS$SYSTEM:DECW$CLOCK
$ IF $STATUS THEN GOTO DONE
$ WAIT 0:0:5
$ GOTO LOOP
$DONE:
$ SET DISPLAY/DELETE ’F$TRNLNM("DECW$DISPLAY")’
The SET DISPLAY/DELETE command deletes the WSA device that was created
at the beginning of the command procedure; the logical name DECW$DISPLAY
contains the name of the WSA device that was created.
For information about using OpenVMS Compaq DECwindows Motif, see
the Overview of DECwindows Motif for OpenVMS Documentation and the
DECwindows Motif Guide to Application Programming.
Example 22–3 associates a pasteboard with the terminal, creates a virtual display
the size of the terminal screen, and pastes the display to the pasteboard. When
text is written to the virtual display, the text appears on the terminal screen.
To use the SMG$ routines for input, you associate a virtual keyboard with a
physical device or file using the SMG$CREATE_VIRTUAL_KEYBOARD routine.
The SMG$ input routines can be used alone or with the output routines. This
section assumes that you are using the input routines with the output routines.
Section 22.5 describes how to use the input routines without the output routines.
The screen management facility keeps an internal representation of the screen
contents; therefore, it is important that you do not mix SMG$ routines with
other forms of terminal I/O. The following subsections contain guidelines for
using most of the SMG$ routines; for more details, see the OpenVMS RTL Screen
Management (SMG$) Manual.
22.4.3 Pasteboards
Use the SMG$CREATE_PASTEBOARD routine to create a pasteboard and
associate it with a physical device. SMG$CREATE_PASTEBOARD returns
a unique pasteboard identification number; use that number to refer to the
pasteboard in subsequent calls to SMG$ routines. After associating a pasteboard
with a device, your program references only the pasteboard. The screen
Figure 22–1 shows the screen that results from Example 22–6.
ZK−2044−GE
You can paste a single display to any number of pasteboards. Any time you
change the display, all pasteboards containing the display are automatically
updated.
A pasteboard can hold any number of virtual displays. You can paste virtual
displays over one another to any depth, occluding the displays underneath. The
displays underneath are only occluded to the extent that they are covered; that
is, the parts not occluded remain visible on the screen. (In Figure 22–2, displays
1 and 2 are partially occluded.) When you unpaste a virtual display that occludes
another virtual display, the occluded part of the display underneath becomes
visible again.
You can find out whether a display is occluded by using the SMG$CHECK_FOR_
OCCLUSION routine. The following example pastes a two-row summary display
over the last two rows of the statistics display, if the statistics display is not
already occluded. If the statistics display is occluded, the example assumes that
it is occluded by the summary display and unpastes the summary display, making
the last two rows of the statistics display visible again.
11 1
aaaaaaaaa aaaaaaaaa
aaaaaaaaa aaaaaaaaa
2
aaaaaaaaa aaaaaaaaa 2
aaaaaaaaa
bbbbbbbb bbbbbbbb
aaaaaaaaa
aaaaaaaaa
bbbbbbbb bbbbbbbb
aaaaaaaaa
bbbbbbbb 3 3
bbbbbbbb
bbbbbbbbccccccccc ccccccccc
bbbbbbbb
bbbbbbbbccccccccc ccccccccc
bbbbbbbb
ccccccccc ccccccccc
ccccccccc ccccccccc
ccccccccc ccccccccc
ZK−2045−GE
11 1
aaaaaaaaa aaaaaaaaa
aaaaaaaaa aaaaaaaaa
2
aaaaaaaaa aaaaaaaaa 2
aaaaaaaaa
bbbbbbbb bbbbbbbb
aaaaaaaaa
bbbbbbbb
aaaaaaaaa bbbbbbbb
aaaaaaaaa
bbbbbbbb 3 3
bbbbbbbb
bbbbbbbbccccccccc bbbbbbbb cc
bbbbbbbbccccccccc bbbbbbbb cc
ccccccccc cc
ccccccccc ccccccccc
ccccccccc ccccccccc
ZK−2046−GE
You can obtain the pasting order of the virtual displays using SMG$LIST_
PASTING_ORDER. This routine returns the identifiers of all the virtual displays
pasted to a specified pasteboard.
22.4.4.4 Removing Virtual Displays
You can remove a virtual display from a pasteboard in a number of different
ways:
• Erase a virtual display—Invoking SMG$UNPASTE_VIRTUAL_DISPLAY
erases a virtual display from the screen but retains its contents in memory.
The following example erases the statistics display:
STATUS = SMG$UNPASTE_VIRTUAL_DISPLAY (STATS_VDID,
2 PBID)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
• Delete a virtual display—Invoking SMG$DELETE_VIRTUAL_DISPLAY
removes a virtual display from the screen and removes its contents from
memory. The following example deletes the statistics display:
STATUS = SMG$DELETE_VIRTUAL_DISPLAY (STATS_VDID)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
• Delete several virtual displays—Invoking SMG$POP_VIRTUAL_DISPLAY
removes a specified virtual display and any virtual displays pasted after that
display from the screen and removes the contents of those displays from
memory. The following example ‘‘pops’’ display 2. Figure 22–4 shows the
screen before and after popping. (Note that display 3 is deleted because it
was pasted after display 2, and not because it is occluding display 2.)
STATUS = SMG$POP_VIRTUAL_DISPLAY (STATS_VDID,
2 PBID)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
11 1
aaaaaaaaa aaaaaaaaa
aaaaaaaaa aaaaaaaaa
2
aaaaaaaaa aaaaaaaaa
aaaaaaaaa
bbbbbbbb aaaaaaaaa
bbbbbbbb
aaaaaaaaa aaaaaaaaa
bbbbbbbb 3
bbbbbbbbccccccccc
bbbbbbbbccccccccc
ccccccccc
ccccccccc
ccccccccc
ZK−2047−GE
In the preceding example, the reverse video attribute is set in the rendition-
complement argument but not in the rendition-set argument, thus specifying
that SMG$CHANGE_RENDITION use the complement of the display’s default
setting to ensure that the selected portion of the display is easily seen.
Note that the resulting attributes are based on the display’s default attributes,
not its current attributes. If you use SMG$ routines that explicitly set video
attributes, the current attributes of the display may not match its default
attributes.
22.4.4.6 Using Spawned Subprocesses
You can create a spawned subprocess directly with an SMG$ routine to
allow execution of a DCL command from an application. Only one spawned
subprocess is allowed per virtual display. Use the following routines to work with
subprocesses:
• SMG$CREATE_SUBPROCESS—Creates a DCL spawned subprocess and
associates it with a virtual display.
• SMG$EXECUTE_COMMAND—Allows execution of a specified command in
the created spawned subprocess by using mailboxes. Some restrictions apply
to specifying the following commands:
SPAWN, GOTO, or LOGOUT cannot be used and will result in
unpredictable results.
Single-character commands such as Ctrl/C have no effect. You can
signal an end-of-file (that is, press Ctrl/Z) command by setting the flags
argument.
A dollar sign ($) must be specified as the first character of any DCL
command.
• SMG$DELETE_SUBPROCESS—Deletes the subprocess created by
SMG$CREATE_SUBPROCESS.
22.4.5 Viewports
Viewports allow you to view different pieces of a virtual display by moving a
rectangular area around on the virtual display. Only one viewport is allowed for
each virtual display. Once you have associated a viewport with a virtual display,
the only part of the virtual display that is viewable is contained in the viewport.
The SMG$ routines for working with viewports include the following:
• SMG$CREATE_VIEWPORT—Creates a viewport and associates it with
a virtual display. You must create the virtual display first. To view the
viewport, you must paste the virtual display first with SMG$PASTE_
VIRTUAL_DISPLAY.
• SMG$SCROLL_VIEWPORT—Scrolls the viewport within the virtual display.
If you try to move the viewport outside of the virtual display, the viewport is
truncated to stay within the virtual display. This routine allows you to specify
the direction and extent of the scroll.
• SMG$CHANGE_VIEWPORT—Moves the viewport to a new starting location
and changes the size of the viewport.
• SMG$DELETE_VIEWPORT—Deletes the viewport and dissociates it from the
virtual display. The viewport is automatically unpasted. The virtual display
associated with the viewport remains intact. You can unpaste a viewport
without deleting it by using SMG$UNPASTE_VIRTUAL_DISPLAY.
ZK−2048−GE
Example 22–9 shows how you can create a statistics display using SMG$DRAW_
LINE and SMG$DRAW_RECTANGLE.
terminator is a character string. You must calculate the length of the character
string read operation yourself.
The following example reads the current contents of the first line in the STATS_
VDID display:
CHARACTER*4 STRING
INTEGER*4 SIZE
.
.
.
STATUS = SMG$HOME_CURSOR (STATS_VDID)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
STATUS = SMG$READ_FROM_DISPLAY (STATS_VDID,
2 STRING)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
SIZE = 55
DO WHILE ((STRING (SIZE:SIZE) .EQ. ’ ’) .AND.
2 (SIZE .GT. 1))
SIZE = SIZE - 1
END DO
22.4.8.2 Reading from a Virtual Keyboard
The SMG$CREATE_VIRTUAL_KEYBOARD routine establishes a device for input
operations; the default device is the user’s terminal. The routine SMG$READ_
STRING reads characters typed on the screen either until the user types a
terminator or until the maximum size (which defaults to 512 characters) is
exceeded. (The terminator is usually a carriage return; see the routine description
in the OpenVMS RTL Screen Management (SMG$) Manual for a complete list of
terminators.) The current cursor location for the display determines where the
read operation begins.
The operating system’s terminal driver processes carriage returns differently
than the SMG$ routines. Therefore, in order to scroll input accurately, you must
keep track of your vertical position in the display area. Explicitly set the cursor
position and scroll the display. If a read operation takes place on a row other
than the last row of the display, advance the cursor to the beginning of the next
row before the next operation. If a read operation takes place on the last row of
the display, scroll the display with SMG$SCROLL_DISPLAY_AREA and then set
the cursor to the beginning of the row. Modify the read operation with TRM$M_
TM_NOTRMECHO to ensure that no extraneous scrolling occurs.
Example 22–10 reads input until Ctrl/Z is pressed.
Note
Because you are controlling the scrolling, SMG$PUT_LINE and
SMG$PUT_LINE_MULTI might not scroll as expected. When scrolling a
mix of input and output, you can prevent problems by using SMG$PUT_
CHARS.
See Section 22.4.8.1 for the guidelines for reading from the display.
service for the appropriate channel. You can dequeue all Ctrl/Y ASTs on a
channel by issuing the SYS$DASSGN system service for the appropriate
channel.
• You can use SMG$ routines—You can connect to the terminal using the SMG$
routines from either AST level or mainline code. Do not attempt to connect to
the terminal from AST level if you do so in your mainline code.
Example 22–13 permits the terminal user to interrupt a display to see how many
lines have been typed up to that point.
CHARACTER*512 INPUT
INCLUDE ’($TRMDEF)’
STATUS = SMG$CREATE_VIRTUAL_KEYBOARD (VKID,
2 ’SYS$INPUT’) ! I/O device
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
STATUS = SMG$READ_STRING (VKID, ! Keyboard ID
2 INPUT, ! Data read
2 ’Prompt> ’,
2 512,
2 TRM$M_TM_PURGE,
2 ,,
2 INPUT_SIZE)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
You can also clear the type-ahead buffer with a QIO read operation modified by
IO$M_PURGE (defined in $IODEF). You can turn off the type-ahead buffer for
further read operations with a QIO set mode operation that specifies TT$M_
NOTYPEAHD as a basic terminal characteristic.
You can examine the type-ahead buffer by issuing a QIO sense mode operation
modified by IO$M_TYPEAHDCNT. The number of characters in the type-ahead
buffer and the value of the first character are returned to the P1 argument.
The size of the type-ahead buffer is determined by the TTY_TYPAHDSZ system
parameter. You can specify an alternative type-ahead buffer by turning on the
ALTYPEAHD terminal characteristic; the size of the alternative type-ahead
buffer is determined by the TTY_ALTYPAHD system parameter.
You can also turn off echoing with a QIO read operation modified by IO$M_
NOECHO (defined in $IODEF). You can turn off echoing for further read
operations with a QIO set mode operation that specifies TT$M_NOECHO as
a basic terminal characteristic.
This chapter describes how to use system services to perform input and output
operations. It contains the following sections:
Section 23.1 describes the QIO operation.
Section 23.2 describes the use of quotas, privileges, and protection.
Section 23.3 describes device addressing modes.
Section 23.4 describes I/O function encoding.
Section 23.5 describes how to assign channels.
Section 23.6 describes how to queue I/O requests.
Section 23.7 describes how to synchronize I/O completions.
Section 23.8 describes the routine to use to wait for completion of an
asynchronous event.
Section 23.9 describes executing I/O services synchronously or asynchronously.
Section 23.10 describes the completion status of an I/O operation.
Section 23.11 describes how to deassign I/O channels.
Section 23.12 presents a program example of a complete input and output
operation.
Section 23.13 describes how to cancel I/O requests.
Section 23.14 describes how to use logical names and physical device names for
I/O operations.
Section 23.15 describes how to use device name defaults.
Section 23.16 describes how to obtain information about physical devices.
Section 23.17 describes device allocation.
Section 23.18 describes how to mount, dismount, and initialize disk and tape
volumes.
Section 23.19 describes format output strings.
Section 23.20 describes how to use mailboxes for I/O operations.
Section 23.21 provides a program example of using I/O system services.
Section 23.22 describes the Fast I/O and Fast Path features that improve I/O
performance.
Examples are provided to show you how to use the I/O services for simple
functions, such as terminal input and output operations. If you plan to write
device-dependent I/O routines, see the OpenVMS I/O User’s Reference Manual.
On VAX systems, if you want to write your own device driver or connect to a
device interrupt vector, see the OpenVMS VAX Device Support Reference Manual.
The OpenVMS VAX Device Support Reference Manual has been archived but is
available on the OpenVMS Documentation CD–ROM.
Besides using I/O system services, you can use OpenVMS Record Management
Services (RMS). OpenVMS RMS provides a set of routines for general-purpose,
device-independent functions such as data storage, retrieval, and modification.
Unlike RMS services, I/O system services permit you to use the I/O resources of
the operating system directly in a device-dependent manner. I/O services also
provide some specialized functions not available in OpenVMS RMS. Using I/O
services requires more programming knowledge than using OpenVMS RMS, but
can result in more efficient input/output operations.
The different types of I/O-related quotas, privilege, and protection are described
in the following sections.
11 10 9 8
Figure 23–4 shows the relationship of physical, logical, and virtual I/O to the
driver.
Start
Yes Physical
I/O
Privilege
?
No
Logical No
I/O
Privilege
?
Yes
No File
Device
?
Yes
Device No
Mounted
?
Yes
Physical I/O No
Permitted*
?
Yes
Allow Deny
Access Access
Start
Yes Physical
I/O
Privilege
?
No
Yes Logical No
I/O
Privilege
?
No Spooled
Device
?
No File Yes
Device
?
Yes
Device No
Mounted
?
Yes
Logical I/O No
Permitted*
?
Yes
Allow Deny
Access Access
QIO
Request
No Physical Yes
I/O
Request
?
Logical Yes
I/O
Request
?
No
Translate Logical
Block Address
to Physical
Block Address
Virtual Yes
I/O
Request
?
No Map Virtual Block I/O
Address to Logical Driver
Block Address
Error
ACP No
Intervention*
?
Yes
Go to
ACP
Wake ACP to
Change Mapping
Window
15 6 5 0
ZK−0628−GE
Note
You should determine the device class before performing any QIO
function, because the requested function might be incompatible with some
devices. For example, the SYS$INPUT device could be a terminal, a disk,
or some other device. Unless this device is a terminal, an IO$_SETMODE
request that enables a Ctrl/C AST is not performed.
15 13 12 6 0
Device/Function Device/Function
Independent Dependent
ZK−0629−GE
As shown in Figure 23–6, bits <15:13> are device- or function-independent bits,
and bits <12:6> are device- or function-dependent bits. Device- or function-
dependent bits have the same meaning, whenever possible, for different device
classes. For example, the function modifier IO$M_ACCESS is used with both disk
and magnetic tape devices to cause a file to be accessed during a create operation.
Device- or function-dependent bits always have the same function within the
same device class.
There are two device- or function-independent modifier bits: IO$M_INHRETRY
and IO$M_DATACHECK (a third bit is reserved). IO$M_INHRETRY is used to
inhibit all error recovery. If any error occurs and this modifier bit is specified, the
operation is terminated immediately and a failure status is returned in the I/O
status block (see Section 23.10). Use IO$M_DATACHECK to compare the data in
memory with that on a disk or magnetic tape.
#include <descrip.h>
#include <lib$routines.h>
#include <ssdef.h>
#include <starlet.h>
#include <stdio.h>
#include <stsdef.h>
main() {
unsigned int status;
unsigned short ttchan;
$DESCRIPTOR(ttname,"TTA2:");
/* Assign a channel to a device */
status = SYS$ASSIGN( &ttname, /* devnam - device name */
&ttchan, /* chan - channel number */
0, /* acmode - access mode */
0, /* mbxnam - logical name for mailbox */
0 ); /* flags */
if (!$VMS_STATUS_SUCCESS(status))
LIB$SIGNAL(status);
return SS$_NORMAL;
}
To assign a channel to the current default input or output device, use the logical
name SYS$INPUT or SYS$OUTPUT.
For more details on how SYS$ASSIGN and other I/O services handle logical
names, see Section 23.2.5.
23.5.1 Using the Share Privilege with the SYS$ASSIGN and SYS$DASSGN
Services
Use of SHARE privilege should be made only with caution, as applications,
application protocols, and device drivers coded to expect only exclusive access can
encounter unexpected and potentially errant behavior when access to the device
is unexpectedly shared via use of SHARE privilege.
If you use the SHARE privilege to override the exclusivity requested by another
process’s call to the system service SYS$ASSIGN, and the original process then
attempts to deassign its channels via explicit calls to SYS$DASSGN or via the
implicit calls to SYS$DASSGN made during image or process rundown, the
OpenVMS last-channel-deassign code may not operate as expected due to the
assignment of the additional I/O channels to the device. The presence of these
extra channels will prevent the last-channel-deassign code from releasing the
ownership of the device, potentially resulting in a device owned by the process
identification (PID) of a nonexistent process.
Unless its use is explicitly supported by the application, the application protocol,
and the device driver, the use of SHARE privilege is generally discouraged.
operating system processes the request, the program that issued the request can
continue execution.
The format for SYS$QIO is as follows:
SYS$QIO([efn],chan,func[,iosb][,astadr][,astprm][,p1][,p2][,p3][,p4][,p5][,p6]
Required arguments to the SYS$QIO service include the channel number
assigned to the device on which the I/O is to be performed, and a function code
(expressed symbolically) that indicates the specific operation to be performed.
Depending on the function code, one to six additional parameters may be
required.
For example, the IO$_WRITEVBLK and IO$_READVBLK function codes are
device-independent codes used to read and write single records or virtual
blocks. These function codes are suitable for simple terminal I/O. They require
parameters indicating the address of an input or output buffer and the buffer
length. A call to SYS$QIO to write a line to a terminal may look like the
following:
#include <starlet.h>
unsigned int status, func=IO$_WRITEVBLK;
.
.
.
status = SYS$QIO(0, /* efn - event flag */
ttchan, /* chan - channel number */
func, /* func - function modifier */
0, /* iosb - I/O status block */
0, /* astadr - AST routine */
0, /* astprm - AST parameter */
buffadr, /* p1 - output buffer */
buflen); /* p2 - length of message */
Function codes are defined for all supported device types, and most of the codes
are device dependent; that is, they perform functions specific to a particular
device. The $IODEF macro defines symbolic names for these function codes.
For information about how to obtain a listing of these symbolic names, see
Appendix A. For details about all function codes and an explanation of the
parameters required by each, see the OpenVMS I/O User’s Reference Manual.
To read from or write to a terminal with the SYS$QIO or SYS$QIOW system
service, you must first associate the terminal name with an I/O channel by
calling the SYS$ASSIGN system service, then use the assigned channel in the
SYS$QIO or SYS$QIOW system service. To read from SYS$INPUT or write to
SYS$OUTPUT, specify the appropriate logical name as the terminal name in
the SYS$ASSIGN system service. In general, use SYS$QIO for asynchronous
operations, and use SYS$QIOW for all other operations.
! When you specify an event flag number as an argument, SYS$QIO clears the
event flag when it queues the I/O request. When the I/O completes, the flag
is set.
" In this example, the program issues two Queue I/O requests. A different
event flag is specified for each request.
# The Wait for Logical AND of Event Flags (SYS$WFLAND) system service
places the process in a wait state until both I/O operations are complete. The
efn argument indicates that the event flags are both in cluster 0; the mask
argument indicates the flags for which the process is to wait.
$ Note that the SYS$WFLAND system service (and the other wait system
services) wait for the event flag to be set; they do not wait for the I/O
operation to complete. If some other event were to set the required event
flags, the wait for event flag would complete too soon. You must coordinate
the use of event flags carefully. (See Section 23.8 for a discussion of the
recommended method for testing I/O completion.)
#include <lib$routines.h>
#include <starlet.h>
#include <stsdef.h>
unsigned int status, astprm=1;
.
.
.
status = SYS$QIO( . . . &ttast, /* I/O request with AST */ !
astprm . . . );
if (!$VMS_STATUS_SUCCESS( status )) /* Queued successfully? */
LIB$SIGNAL( status );
.
.
.
}
void ttast ( int astprm ) { /* AST service routine */ "
/* Handle I/O completion */
.
.
.
return;
} /* End of AST routine */
! When you specify the astadr argument to the SYS$QIO system service, the
system interrupts the process when the I/O completes and passes control to
the specified AST service routine.
The SYS$QIO system service call specifies the address of the AST routine,
TTAST, and a parameter to pass as an argument to the AST service routine.
When $QIO returns control, the process continues execution.
" When the I/O completes, the AST routine TTAST is called, and it responds to
the I/O completion. By examining the AST parameter, TTAST can determine
the origin of the I/O request.
When this routine is finished executing, control returns to the process at the
point at which it was interrupted. If you specify the astadr argument in your
call to SYS$QIO, you should also specify the iosb argument so that the AST
routine can evaluate whether the I/O completed successfully.
! An I/O status block is a quadword structure that the system uses to post
the status of an I/O operation. You must define the quadword area in your
program. TTIOSB defines the I/O status block for this I/O operation. The
iosb argument in the SYS$QIO system service refers to this quadword.
" Instead of polling the low-order word of the I/O status block for the completion
status, the program uses the preferred method of using an event flag and
calling SYS$SYNCH to determine I/O completion.
# The process polls the I/O status block. If the low-order word still contains
zero, the I/O operation has not yet completed. In this example, the program
loops until the request is complete.
.
.
.
#include <lib$routines.h>
#include <starlet.h>
unsigned int status, event_flag = 1;
struct {
short int iostat, iolen;
unsigned int dev_info;
}ttiosb;
.
.
.
/* Request I/O */
status = SYS$QIO (event_flag, . . . , &ttiosb . . . );
if (!$VMS_STATUS_SUCCESS(status))
LIB$SIGNAL( status );
.
.
.
/* Wait until I/O completes */
status = SYS$SYNCH (event_flag, &ttiosb );
if (!$VMS_STATUS_SUCCESS(status))
LIB$SIGNAL( status );
.
.
.
Note
The SYS$QIOW service provides a combination of SYS$QIO and
SYS$SYNCH.
Note
Do not use the SYS$QIO and SYS$QIOW system services for input from
a file or nonterminal device.
The SYS$QIO and SYS$QIOW system services place the data read in the variable
specified in the 1 argument. The second word of the status block contains the
offset from the beginning of the buffer to the terminator—hence, it equals the size
of the data read. Always reference the data as a substring, using the offset to the
terminator as the position of the last character (that is, the size of the substring).
If you reference the entire buffer, your data will include the terminator for
the operation (for example, the CR character) and any excess characters from
a previous operation using the buffer. (The only exception to the substring
guideline is if you deliberately overflow the buffer to terminate the I/O operation.)
Example 23–4 shows use of the SYS$QIOW system service and reads a line of
data from the terminal and waits for the I/O to complete.
Be sure to check the status of the I/O operation as returned in the I/O status
block. In an asynchronous operation, you can check this status only after the I/O
operation is complete (that is, after the call to SYS$SYNCH).
31 16 15 0
Count Condition value
Device−dependent information
ZK−0856−GE
Figure 23–7 illustrates the format for the SYS$QIO system service of the
information written in the IOSB.
The first word contains a system status code indicating the success or failure of
the operation. The status codes used are the same as for all returns from system
services; for example, SS$_NORMAL indicates successful completion.
The second word contains the number of bytes actually transferred in the I/O
operation. Note that for some devices this word contains only the low-order word
of the count. For information about specific devices, see the OpenVMS I/O User’s
Reference Manual.
The second longword contains device-dependent return information.
System services other than SYS$QIO use the quadword I/O status block, but the
format is different. See the description of each system service in the OpenVMS
System Services Reference Manual for the format of the information written in
the IOSB for that service.
To ensure successful I/O completion and the integrity of data transfers, you
should check the IOSB following I/O requests, particularly for device-dependent
I/O functions. For complete details about how to use the I/O status block, see the
OpenVMS I/O User’s Reference Manual.
#include <descrip.h>
#include <iodef.h>
#include <lib$routines.h>
#include <ssdef.h>
#include <starlet.h>
#include <stdio.h>
#include <string.h>
#define BUFSIZ 80
/* I/O status block */
struct { !
unsigned short iostat, ttiolen;
unsigned int dev_info;
}ttiosb;
main() {
unsigned int status ,outlen, inlen = BUFSIZ;
unsigned short ttchan;
char buffer[BUFSIZ]; "
$DESCRIPTOR(ttname,"SYS$INPUT"); #
/* Assign a channel */
status = SYS$ASSIGN(&ttname, /* devnam - device number */ $
&ttchan, /* chan - channel number */
0, 0, 0);
if (!$VMS_STATUS_SUCCESS(status))
LIB$SIGNAL( status );
/* Request I/O */
status = SYS$QIOW(0, /* efn - event flag */
ttchan, /* chan - channel number */
IO$_READVBLK, /* func - function modifier */
&ttiosb, /* iosb - I/O status block */
0, /* astadr - AST routine */
0, /* astprm - AST parameter */
buffer, /* p1 - buffer */
inlen, /* p2 - length of buffer */
0, 0, 0, 0); %
if (!$VMS_STATUS_SUCCESS( status )) &
LIB$SIGNAL( status );
/* Get length from IOSB */
outlen = ttiosb.ttiolen; ’
status = SYS$QIOW(0, ttchan, IO$_WRITEVBLK, &ttiosb, 0, 0, buffer, outlen,
0, 0, 0, 0);
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status ); (
/* Deassign the channel */
status = SYS$DASSGN( ttchan ); /* chan - channel */ )
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status );
}
! The IOSB for the I/O operations is structured so that the program can easily
check for the completion status (in the first word) and the length of the input
string returned (in the second word).
" The string will be read into the buffer BUFFER; the longword OUTLEN will
contain the length of the string for the output operation.
# The TTNAME label is a character string descriptor for the logical device
SYS$INPUT, and TTCHAN is a word to receive the channel number assigned
to it.
$ The $ASSIGN service assigns a channel and writes the channel number at
TTCHAN.
% If the $ASSIGN service completes successfully, the $QIOW macro reads a line
from the terminal, and requests that the completion status be posted in the
I/O status block defined at TTIOSB.
& The process waits until the I/O is complete, then checks the first word in the
I/O status block for a successful return. If unsuccessful, the program takes an
error path.
’ The length of the string read is moved into the longword at OUTLEN, because
the $QIOW macro requires a longword argument. However, the length field
of the I/O status block is only 1 word long. The $QIOW macro writes the line
just read to the terminal.
( The program performs error checks. First, it ensures that the $OUTPUT
macro successfully queued the I/O request; then, when the request is
completed, it ensures that the I/O was successful.
) When all I/O operations on the channel are finished, the channel is
deassigned.
In this example, the SYS$CANCEL system service initiates the cancellation of all
pending I/O requests to the channel whose number is located at TTCHAN.
The SYS$CANCEL system service returns after initiating the cancellation of the
I/O requests. If the call to SYS$QIO specified either an event flag, AST service
routine, or I/O status block, the system sets either the flag, delivers the AST, or
posts the I/O status block as appropriate when the cancellation is completed.
In each translation, the logical name tables defined by the logical name
LNM$FILE_DEV are searched in order. These tables, listed in search order,
are normally LNM$PROCESS, LNM$JOB, LNM$GROUP, and LNM$SYSTEM. If
a physical device name is located, the I/O request is performed for that device.
If the services do not locate an entry for the logical name, the I/O service treats
the name specified as a physical device name. When you specify the name of an
actual physical device in a call to one of these services, include the underscore
character to bypass the logical name translation.
When the SYS$ALLOC system service returns the device name of the physical
device that has been allocated, the device name string returned is prefixed
with an underscore character. When this name is used for the subsequent
SYS$ASSIGN system service, the SYS$ASSIGN service does not attempt to
translate the device name.
If you use logical names in I/O service calls, you must be sure to establish a
valid device name equivalence before program execution. You can do this either
by issuing a DEFINE command from the command stream, or by having the
program establish the equivalence name before the I/O service call with the
Create Logical Name (SYS$CRELNM) system service.
For details about how to create and use logical names, see Chapter 32.
dd—Specified device type (capital letters indicate a specific controller; numbers indicate a specific
unit)
c—Specified controller
x—Any controller
u—Specified unit number
y—Any unit number
The operating system also supports a device called the null device for program
development. The mnemonic for the null device is NL. Its characteristics are as
follows:
• A read from NL returns an end-of-file error (SS$_ENDOFFILE).
• A write to NL immediately returns a success message (SS$_NORMAL).
The null device functions as a virtual device to which you can direct output but
from which the data does not return.
If you modify terminal characteristics with set mode QIO operations, you should
save the characteristics buffer that you obtain on the first sense mode operation,
and restore those characteristics with a set mode operation before exiting.
(Resetting is not necessary if you just use modifiers on each read operation.) To
ensure that the restoration is performed if the program aborts (for example, if
the user presses Ctrl/Y), you should restore the user’s environment in an exit
handler. See Chapter 9 for a description of exit handlers.
#include <descrip.h>
#include <lib$routines.h>
#include <ssdef.h>
#include <starlet.h>
#include <stdio.h>
main() {
unsigned int status;
char devstr[64];
unsigned short phylen, tapechan;
$DESCRIPTOR(logdev,"TAPE"); /* Descriptor for logical name */
$DESCRIPTOR(devdesc,devstr); /* Descriptor for physical name */
/* Allocate a device */
status = SYS$ALLOC( &logdev, /* devnam - device name */ !
&phylen, /* phylen - length device name string */
&devdesc, /* phybuf - buffer for devnam string */
0, 0);
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status );
/* Assign a channel to the device */
status = SYS$ASSIGN( &devdesc, /* devnam - device name */ "
&tapechan, /* chan - channel number */
0, 0, 0);
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status );
/* Deassign the channel */
status = SYS$DASSGN( tapechan ); /* chan - channel number */#
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status );
/* Deallocate the device */
status = SYS$DALLOC( &devdesc, /* devnam - device name */
0 ); /* acmode - access mode */
if (!$VMS_STATUS_SUCCESS( status ))
LIB$SIGNAL( status );
}
! The SYS$ALLOC system service call requests allocation of a device
corresponding to the logical name TAPE, defined by the character string
descriptor LOGDEV. The argument DEVDESC refers to the buffer provided
to receive the physical device name of the device that is allocated and the
length of the name string. The SYS$ALLOC service translates the logical
name TAPE and returns the equivalence name string of the device actually
allocated into the buffer at DEVDESC. It writes the length of the string in
the first word of DEVDESC.
" The SYS$ASSIGN command uses the character string returned by the
SYS$ALLOC system service as the input device name argument, and
requests that the channel number be written into TAPECHAN.
# When I/O operations are completed, the SYS$DASSGN system service
deassigns the channel, and the SYS$DALLOC system service deallocates the
device. The channel must be deassigned before the device can be deallocated.
23.17.2 Deallocation
When the program has finished using an allocated device, it should release the
device with the Deallocate Device (SYS$DALLOC) system service to make it
available for other processes.
At image exit, the system automatically deallocates devices allocated by the
image.
31 15 0
Buffer address
ZK−1705−GE
Most item descriptors do not have to be in any order. To mount volume sets,
you must specify one item descriptor per device and one item descriptor per
volume; you must specify the descriptors for the volumes in the same order as the
descriptors for the devices on which the volumes are loaded.
For item descriptors other than device and volume names, if you specify the same
item descriptor more than once, the last occurrence of the descriptor is used.
The following example illustrates a call to SYS$MOUNT. The call is equivalent to
the DCL command that precedes the example.
#include <descrip.h>
#include <lib$routines.h>
#include <mntdef.h>
#include <starlet.h>
#include <stdio.h>
.
.
.
struct {
unsigned short buflen, item_code;
void *bufaddr;
int *retlenaddr;
}itm;
struct itm itm[7];
main() {
.
.
.
unsigned int status, flags;
$DESCRIPTOR(dev1,"DRA4:");
$DESCRIPTOR(vol1,"USER01");
$DESCRIPTOR(dev2,"DRA5:");
$DESCRIPTOR(vol2,"USER02");
$DESCRIPTOR(log,"USERD$:");
flags = MNT$M_SYSTEM | MNT$M_NODISKQ;
i = 0;
itm[i].buflen = sizeof( flags );
itm[i].item_code = MNT$_FLAGS;
itm[i].bufaddr = flags;
itm[i++].retlenaddr = NULL;
itm[i].buflen = dev1.dsc$w_length;
itm[i].item_code = MNT$_DEVNAM;
itm[i].bufaddr = dev1.dsc$a_pointer;
itm[i++].retlenaddr = NULL;
itm[i].buflen = vol1.dsc$w_length;
itm[i].item_code = MNT$_VOLNAM;
itm[i].bufaddr = vol1.dsc$a_pointer;
itm[i++].retlenaddr = NULL;
itm[i].buflen = dev2.dsc$w_length;
itm[i].item_code = MNT$_DEVNAM;
itm[i].bufaddr = dev2.dsc$a_pointer;
itm[i++].retlenaddr = NULL;
itm[i].buflen = vol2.dsc$w_length;
itm[i].item_code = MNT$_VOLNAM;
itm[i].bufaddr = vol2.dsc$a_pointer;
itm[i++].retlenaddr = NULL;
itm[i].buflen = log.dsc$w_length;
itm[i].item_code = MNT$_LOGNAM;
itm[i].bufaddr = log.dsc$a_pointer;
itm[i++].retlenaddr = NULL;
itm[i].buflen = 0;
itm[i].item_code = 0;
itm[i].bufaddr = NULL;
itm[i++].retlenaddr = NULL;
.
.
.
status = SYS$MOUNT ( itm );
if (!$VMS_STATUS_SUCCESS(status))
LIB$SIGNAL( status );
.
.
.
}
23.18.1.2 Calling the SYS$DISMOU System Service
The SYS$DISMOU system service allows a process to dismount a volume or
volume set. When you call SYS$DISMOU, you must specify a device name. If the
volume mounted on the device is part of a fully mounted volume set, and you do
not specify flags, the whole volume set is dismounted.
The following example illustrates a call to SYS$DISMOU. The call dismounts the
volume set mounted in the previous example.
$DESCRIPTOR(dev1_desc,"DRA4:");
.
.
.
status = SYS$DISMOU(&dev1_desc); /* devnam - device */
.
.
.
#include <descrip.h>
#include <initdef.h>
#include <lib$routines.h>
#include <starlet.h>
#include <stsdef.h>
struct item_descrip_3
{
unsigned short buffer_size;
unsigned short item_code;
void *buffer_address;
unsigned short *return_length;
};
main ()
{
unsigned long
density_code,
status;
$DESCRIPTOR(drive_dsc, "MUA0:");
$DESCRIPTOR(label_dsc, "USER01");
struct
{
struct item_descrip_3 density_item;
long terminator;
} init_itmlst;
/*
** Initialize the input item list.
*/
density_code = INIT$K_DENSITY_6250_BPI;
init_itmlst.density_item.buffer_size = 4;
init_itmlst.density_item.item_code = INIT$_DENSITY;
init_itmlst.density_item.buffer_address = &density_code;
init_itmlst.terminator = 0;
/*
** Initialize the volume.
*/
status = SYS$INIT_VOL (&drive_dsc, &label_dsc, &init_itmlst);
/*
** Report an error if one occurred.
*/
if (!$VMS_STATUS_SUCCESS (status ))
LIB$STOP (status);
}
The following example illustrates a call to SYS$INIT_VOL from VAX BASIC:
RECORD ITEM_DESC
VARIANT
CASE
WORD BUFLEN
WORD ITMCOD
LONG BUFADR
LONG LENADR
CASE
LONG TERMINATOR
END VARIANT
END RECORD
DECLARE LONG RET_STATUS, &
ITEM_DESC INIT_ITMLST(2)
! Initialize the input item list.
INIT_ITMLST(0)::ITMCOD = INIT$_READCHECK
INIT_ITMLST(1)::TERMINATOR = 0
! Initialize the volume.
RET_STATUS = SYS$INIT_VOL ("DJA21:" BY DESC, "USERVOLUME" BY DESC,
INIT_ITMLST() BY REF)
#include <descrip.h>
#include <lib$routines.h>
#include <ssdef.h>
#include <starlet.h>
#include <stdio.h>
#include <stsdef.h>
main() {
23.20 Mailboxes
Mailboxes are virtual devices that can be used for communication among
processes. You accomplish actual data transfer by using OpenVMS RMS or I/O
services. When the Create Mailbox and Assign Channel (SYS$CREMBX) system
service creates a mailbox, it also assigns a channel to it for use by the creating
process. Other processes can then assign channels to the mailbox using either
the SYS$CREMBX or SYS$ASSIGN system service.
The SYS$CREMBX system service creates the mailbox. The SYS$CREMBX
system service identifies a mailbox by a user-specified logical name and assigns
it an equivalence name. The equivalence name is a physical device name in the
format MBAn, where n is a unit number. The equivalence name has the terminal
attribute.
When another process assigns a channel to the mailbox with the SYS$CREMBX
or SYS$ASSIGN system service, it can identify the mailbox by its logical name.
The service automatically translates the logical name. The process can obtain
the MBAn name either by translating the logical name (with the SYS$TRNLNM
system service), or by calling the Get Device/Volume Information (SYS$GETDVI)
system service to obtain the unit number and the physical device name.
On VAX systems, channels assigned to mailboxes can be either bidirectional or
unidirectional. Bidirectional channels (read/write) allow both SYS$QIO read and
SYS$QIO write requests to be issued to the channel. Unidirectional channels
(read-only or write-only) allow only a read request or a write request to the
channel. The unidirectional channels and unidirectional $QIO function modifiers
provide for greater synchronization between users of the mailbox.
On VAX systems, the Create Mailbox and Assign Channel (SYS$CREMBX) and
Assign I/O Channel (SYS$ASSIGN) system services use the flags argument to
enable unidirectional channels. If the flags argument is not specified or is zero,
then the channel assigned to the mailbox is bidirectional (read/write). For more
information, see the discussion and programming examples in the mailbox driver
chapter in the OpenVMS I/O User’s Reference Manual. Chapter 3 of this manual
also discusses the use of mailboxes.
Mailboxes are either temporary or permanent. You need the user privileges
TMPMBX and PRMMBX to create temporary and permanent mailboxes,
respectively.
For a temporary mailbox, the SYS$CREMBX service enters the logical name and
equivalence name in the logical name table LNM$TEMPORARY_MAILBOX. This
logical name table name usually specifies the LNM$JOB logical name table name.
The system deletes a temporary mailbox when no more channels are assigned to
it.
For a permanent mailbox, the SYS$CREMBX service enters the logical name and
equivalence name in the logical name table LNM$PERMANENT_MAILBOX. This
logical name table name usually specifies the LNM$SYSTEM logical name table
name. Permanent mailboxes continue to exist until they are specifically marked
for deletion with the Delete Mailbox (SYS$DELMBX) system service.
The following example shows how processes can communicate by means of a
mailbox:
/* Process ORION */
#include <descrip.h>
#include <iodef.h>
#include <lib$routines.h>
#include <ssdef.h>
#include <starlet.h>
#include <stdio.h>
#define MBXBUFSIZ 128
#define MBXBUFQUO 384
/* I/O status block */
struct {
unsigned short iostat, iolen;
unsigned int remainder;
}mbxiosb;
main() {
void *p1, mbxast();
char mbuffer[MBXBUFSIZ], prmflg=0;
unsigned short mbxchan, mbxiosb;
unsigned int status, outlen;
unsigned int mbuflen=MBXBUFSIZ, bufquo=MBXBUFQUO, promsk=0;
$DESCRIPTOR(mblognam,"GROUP100_MAILBOX");
/* Create a mailbox */
status = SYS$CREMBX( prmflg, /* Permanent or temporary */ !
&mbxchan, /* chan - channel number */
mbuflen, /* maxmsg - buffer length */
bufquo, /* bufquo - quota */
promsk, /* promsk - protection mask */
0, /* acmode - access mode */
&mblognam, /* lognam - mailbox logical name */
0); /* flags - options */
if (!$VMS_STATUS_SUCCESS(status))
LIB$SIGNAL(status);
.
.
.
/* Request I/O */
status = SYS$QIO(0, /* efn - event flag */ "
mbxchan, /* chan - channel number */
IO$_READVBLK, /* func - function modifier */
&mbxiosb, /* iosb - I/O status block */
&mbxast, /* astadr - AST routine */
&mbuffer, /* p1 - output buffer */
mbuflen); /* p2 - length of buffer */
if (!$VMS_STATUS_SUCCESS(status))
LIB$SIGNAL(status);
.
.
.
}
void mbxast(void) { #
if (mbxiosb.iostat != SS$_NORMAL)
status = SYS$QIOW( . . . , &mbuffer, &outlen, . . . )
if (!$VMS_STATUS_SUCCESS(status))
LIB$SIGNAL(status);
return;
}
/* Process Cygnus */
#include <descrip.h>
#include <iodef.h>
#include <lib$routines.h>
#include <ssdef.h>
#include <starlet.h>
#include <stdio.h>
#include <stsdef.h>
#define MBXBUFSIZ 128
main() {
unsigned short int mailchan;
unsigned int status, outlen;
char outbuf[MBXBUFSIZ];
$DESCRIPTOR(mailbox,"GROUP100_MAILBOX");
The symbolic names included in the $MSGDEF macro and their meanings are as
follows:
SEND.FOR
INTEGER STATUS
! Name and channel number for mailbox
CHARACTER*(*) MBX_NAME
PARAMETER (MBX_NAME = ’MAIL_BOX’)
INTEGER*2 MBX_CHAN
! Mailbox message
CHARACTER*80 MBX_MESSAGE
INTEGER LEN
CHARACTER*80 MESSAGES (255)
INTEGER MESSAGE_LEN (255)
INTEGER MAX_MESSAGE
PARAMETER (MAX_MESSAGE = 255)
! I/O function codes and status block
INCLUDE ’($IODEF)’
INTEGER*4 WRITE_CODE
INTEGER*2 IOSTAT,
2 MSG_LEN
INTEGER READER_PID
COMMON /IOBLOCK/ IOSTAT,
2 MSG_LEN,
2 READER_PID
! System routines
INTEGER SYS$CREMBX,
2 SYS$ASCEFC,
2 SYS$WAITFR,
2 SYS$QIOW
! Create the mailbox.
STATUS = SYS$CREMBX (,
2 MBX_CHAN,
2 ,,,,
2 MBX_NAME)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
! Fill MESSAGES array
.
.
.
RECEIVE.FOR
INTEGER STATUS
INCLUDE ’($IODEF)’
INCLUDE ’($SSDEF)’
! Name and channel number for mailbox
CHARACTER*(*) MBX_NAME
PARAMETER (MBX_NAME = ’MAIL_BOX’)
INTEGER*2 MBX_CHAN
! QIO function code
INTEGER READ_CODE
! Mailbox message
CHARACTER*80 MBX_MESSAGE
INTEGER*4 LEN
! Message arrays
CHARACTER*80 MESSAGES (255)
INTEGER*4 MESSAGE_LEN (255)
! I/O status block
INTEGER*2 IOSTAT,
2 MSG_LEN
INTEGER READER_PID
COMMON /IOBLOCK/ IOSTAT,
2 MSG_LEN,
2 READER_PID
! System routines
INTEGER SYS$ASSIGN,
2 SYS$ASCEFC,
2 SYS$SETEF,
2 SYS$QIOW
! Create the mailbox and let the other process know
STATUS = SYS$ASSIGN (MBX_NAME,
2 MBX_CHAN,,,)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
STATUS = SYS$ASCEFC (%VAL(64),
2 ’CLUSTER’,,)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
STATUS = SYS$SETEF (%VAL(64))
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
! Read first message
READ_CODE = IO$_READVBLK .OR. IO$M_NOW
LEN = 80
STATUS = SYS$QIOW (,
2 %VAL(MBX_CHAN), ! Channel
2 %VAL(READ_CODE), ! Function code
2 IOSTAT, ! Status block
2 ,,
2 %REF(MBX_MESSAGE), ! P1
2 %VAL(LEN),,,,) ! P2
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
IF ((.NOT. IOSTAT) .AND.
2 (IOSTAT .NE. SS$_ENDOFFILE)) THEN
CALL LIB$SIGNAL (%VAL(IOSTAT))
ELSE IF (IOSTAT .NE. SS$_ENDOFFILE) THEN
I = 1
MESSAGES(I) = MBX_MESSAGE
MESSAGE_LEN(I) = MSG_LEN
END IF
! Read messages until cooperating process writes end-of-file
DO WHILE (.NOT. ((IOSTAT .EQ. SS$_ENDOFFILE) .AND.
2 (READER_PID .NE. 0)))
STATUS = SYS$QIOW (,
2 %VAL(MBX_CHAN), ! Channel
2 %VAL(READ_CODE), ! Function code
2 IOSTAT, ! Status block
2 ,,
2 %REF(MBX_MESSAGE), ! P1
2 %VAL(LEN),,,,) ! P2
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
IF ((.NOT. IOSTAT) .AND.
2 (IOSTAT .NE. SS$_ENDOFFILE)) THEN
CALL LIB$SIGNAL (%VAL(IOSTAT))
ELSE IF (IOSTAT .NE. SS$_ENDOFFILE) THEN
I = I + 1
MESSAGES(I) = MBX_MESSAGE
MESSAGE_LEN(I) = MSG_LEN
END IF
END DO
.
.
.
This chapter describes the run-time library (RTL) routines that allow access to
various operating system components and it contains the following sections:
Section 24.1 describes how to use RTL routines to make system services return
different types of strings.
Section 24.2 describes how to use RTL routines to provide access to the command
language interpreter.
Section 24.3 describes how to use RTL routines to allow high-level language
programs to use most VAX machine instructions or their Alpha equivalent.
Section 24.4 describes how to use RTL routines to allocate processwide resources
to a single operating system process.
Section 24.5 describes how to use RTL routines to measure performance.
Section 24.6 describes how to use RTL routines to control output formatting.
Section 24.7 describes how to use RTL routines for miscellaneous interface
routines.
Run-time library routines allow access to the following operating system
components:
• System services
• Command language interpreter
• Some VAX machine instructions
The following routines execute only when the current CLI is DCL:
LIB$GET_SYMBOL
LIB$SET_SYMBOL
LIB$DELETE_SYMBOL
LIB$DISABLE_CTRL
LIB$ENABLE_CTRL
LIB$SPAWN
LIB$ATTACH
• If the image is invoked by the DCL command RUN, you can use LIB$GET_
FOREIGN to prompt for additional text.
• If the image is not invoked by a foreign command or by MCR, or if there is no
information remaining on the command line, and the user-supplied prompt
is present, LIB$GET_INPUT is called to prompt for a command line. If the
prompt is not present, LIB$GET_FOREIGN returns a zero-length string.
Example
The following PL/I example illustrates the use of the optional force-prompt
argument to permit repeated calls to LIB$GET_FOREIGN. The command line
text is retrieved on the first pass only; after this, the program prompts from
SYS$INPUT.
Now assume that a user runs the image by typing the foreign command and
giving ‘‘subcommands’’ that the program displays:
$ EXAMP Subcommand 1
Command was SUBCOMMAND 1
Input: Subcommand 2
Command was SUBCOMMAND 2
Input: ^Z
$
In this example, Subcommand 1 was obtained from the command line; the
program prompts the user for the second subcommand. The program terminated
when the user pressed the Ctrl/Z key sequence (displayed as ^Z) to indicate
end-of-file.
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 PROG-NAME PIC X(9) VALUE "PROG2.EXE".
01 STAT PIC 9(9) COMP.
88 SUCCESSFUL VALUE 1.
ROUTINE DIVISION.
001-MAIN.
CALL "LIB$RUN_PROGRAM"
USING BY DESCRIPTOR PROG-NAME
GIVING STAT.
IF NOT SUCCESSFUL
DISPLAY "ATTEMPT TO CHAIN UNSUCCESSFUL"
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG2.
ENVIRONMENT DIVISION.
DATA DIVISION.
ROUTINE DIVISION.
001-MAIN.
DISPLAY " ".
DISPLAY "THIS MESSAGE DISPLAYED BY PROGRAM PROG2".
DISPLAY " ".
DISPLAY "WHICH WAS RUN BY PROGRAM PROG1".
DISPLAY " ".
DISPLAY "USING LIB$RUN_PROGRAM".
STOP RUN.
What you type after this prompt determines the action of LIB$DO_COMMAND.
LIB$DO_COMMAND executes any command that is entered as a valid string
according to the syntax of PL/I. If the command you enter is incomplete, you
are prompted for the rest of the command. For example, if you enter the SHOW
command, you receive the following prompt:
$_Show what?:
P+S−1 P 8 7 0
.. .. :A
Bit fields are zero-origin, which means that the routine regards the first bit in
the field as being the zero position. For more detailed information about VAX bit
numbering and data formats, see the VAX Architecture Reference Manual.
The attributes of the bit field are passed to an RTL routine in the form of three
arguments in the following order:
pos
Operating system usage: longword_signed
type: longword integer (signed)
access: read only
mechanism: by reference
Bit position relative to the base address. The pos argument is the address of a
signed longword integer that contains this bit position.
size
Operating system usage: byte_unsigned
type: byte (unsigned)
access: read only
mechanism: by reference
Size of the bit field. The size argument is the address of an unsigned byte that
contains this size.
base
Operating system usage: longword_unsigned
type: longword (unsigned)
access: read only
mechanism: by reference
Base address. The base argument contains the address of the base address.
Example
The following BASIC example illustrates three RTL routines. It opens the
terminal as a file and specifies HEX> as the prompt. This prompt allows you to
obtain input from the terminal without the question mark that VAX BASIC
normally adds to the prompt in an INPUT statement. The program calls
OTS$CVT_TZ_L to convert the character string input to a longword. It then
calls LIB$EXTZV once for each position in the longword to extract the bit in
that position. Because LIB$EXTVZ is called with a function reference within the
PRINT statement, the bits are displayed.
Examples
LIB$INSQHI
In BASIC and Fortran, queues can be quadword aligned in a named COMMON
block by using a linker option file to specify alignment of program sections. The
LIB$GET_VM routine returns memory that is quadword aligned. Therefore,
you should use LIB$GET_VM to allocate the virtual memory for a queue. For
instance, to create a COMMON block called QUEUES, use the LINK command
with the FILE/OPTIONS qualifier, where FILE.OPT is a linker option file
containing the line:
PSECT = QUEUES, QUAD
A Fortran application using processor-shared memory follows:
INTEGER*4 FUNCTION INSERT_Q (QENTRY)
COMMON/QUEUES/QHEADER
INTEGER*4 QENTRY(10), QHEADER(2)
INSERT_Q = LIB$INSQHI (QENTRY, QHEADER)
RETURN
END
A BASIC application using processor-shared memory follows:
COM (QUEUES) QENTRY%(9), QHEADER%(1)
EXTERNAL INTEGER FUNCTION LIB$INSQHI
IF LIB$INSQHI (QENTRY%() BY REF, QHEADER%() BY REF) AND 1%
THEN GOTO 1000
.
.
.
1000 REM INSERTED OK
LIB$REMQHI
In Fortran, the address of the removed queue entry can be passed to another
routine as an array using the %VAL built-in function.
In the following example, queue entries are 10 longwords, including the two
longword pointers at the beginning of each entry:
COMMON/QUEUES/QHEADER
INTEGER*4 QHEADER(2), ISTAT
ISTAT = LIB$REMQHI (QHEADER, ADDR)
IF (ISTAT) THEN
CALL PROC (%VAL (ADDR)) ! Process removed entry
GO TO ...
ELSE IF (ISTAT .EQ. %LOC(LIB$_QUEWASEMP)) THEN
GO TO ... ! Queue was empty
ELSE IF
... ! Secondary interlock failed
END IF
.
.
.
END
SUBROUTINE PROC (QENTRY)
INTEGER*4 QENTRY(10)
.
.
.
RETURN
END
The OpenVMS RTL String Manipulation (STR$) Manual describes STR$ string
manipulation routines.
Example
This COBOL program uses LIB$LOCC to return the position of a given letter of
the alphabet.
IDENTIFICATION DIVISION.
PROGRAM-ID. LIBLOC.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 SEARCH-STRING PIC X(26)
VALUE "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
01 SEARCH-CHAR PIC X.
01 IND-POS PIC 9(9) USAGE IS COMP.
01 DISP-IND PIC 9(9).
ROUTINE DIVISION.
001-MAIN.
MOVE SPACE TO SEARCH-CHAR.
DISPLAY " ".
DISPLAY "ENTER SEARCH CHARACTER: " WITH NO ADVANCING.
ACCEPT SEARCH-CHAR.
CALL "LIB$LOCC"
USING BY DESCRIPTOR SEARCH-CHAR, SEARCH-STRING
GIVING IND-POS.
IF IND-POS = ZERO
DISPLAY
"CHAR ENTERED (" SEARCH-CHAR ") NOT A VALID SEARCH CHAR"
STOP RUN.
MOVE IND-POS TO DISP-IND.
DISPLAY
"SEARCH CHAR (" SEARCH-CHAR ") WAS FOUND IN POSITION "
DISP-IND.
GO TO 001-MAIN.
LIB$CALLG
The LIB$CALLG routine gives your program access to the CALLG instruction.
This instruction calls a routine using an argument list stored as an array in
memory, as opposed to the CALLS instruction, in which the argument list is
pushed on the stack.
LIB$CRC
The LIB$CRC routine allows your high-level language program to use the CRC
instruction, which calculates the cyclic redundancy check. This instruction checks
the integrity of a data stream by comparing its state at the sending point and the
receiving point. Each character in the data stream is used to generate a value
based on a polynomial. The values for each character are then added together.
This operation is performed at both ends of the data transmission, and the two
result values are compared. If the results disagree, then an error occurred during
the transmission.
LIB$CRC_TABLE
The LIB$CRC_TABLE routine takes a polynomial as its input and builds the
table that LIB$CRC uses to calculate the CRC. You must specify the polynomial
to be used.
For more details, see the VAX Architecture Reference Manual.
available number. This ensures that your BASIC or Fortran routine does not
use a logical unit that is already being used by a calling program. Therefore,
you should use this routine whenever your program calls or is called by another
program that also allocates LUNs. Logical unit numbers 100 to 119 are available
to modular routines through these entry points.
To allocate an LUN, call LIB$GET_LUN and use the value returned as the LUN
for your I/O statements. If no LUNs are available, an error status is returned
and the logical unit is set to 01. When the program unit exits, it should use
LIB$FREE_LUN to free any LUNs that have been allocated by LIB$GET_LUN.
If it does not free any LUNs, the available pool of numbers is freed for use.
If your called routine contains a call to LIB$FREE_LUN to free the LUNs upon
exit, and your routine fails to execute normally, the LUNs will not be freed.
For this reason, you should make sure to establish a condition handler to call
LIB$FREE_LUN before resignaling or unwinding. Otherwise, the allocated LUN
is lost until the image exits.
• Elapsed time
• CPU time
• Buffered I/O count
• Direct I/O count
• Page faults
The LIB$SHOW_TIMER and LIB$STAT_TIMER routine are relatively simple
tools for testing the performance of a new application. To obtain more detailed
information, use the system services SYS$GETTIM (Get Time) and SYS$GETJPI
(Get Job/Process Information).
The simplest way to use the run-time library routines is to call LIB$INIT_TIMER
with no arguments at the beginning of the portion of code to be monitored. This
causes the statistics to be placed in OWN storage. To get the statistics from OWN
storage, call LIB$SHOW_TIMER (with no arguments) at the end of the portion of
code to be monitored.
If you want a particular statistic, you must include a code argument with a call
to LIB$SHOW_TIMER or LIB$STAT_TIMER. LIB$SHOW_TIMER returns the
specified statistic(s) in formatted form and sends them to SYS$OUTPUT. On
each call, LIB$STAT_TIMER returns one statistic to the calling program as an
unsigned longword or quadword value.
Table 24–10 shows the code argument in LIB$SHOW_TIMER or LIB$STAT_
TIMER.
When you call LIB$INIT_TIMER, you must use the optional handler argument
only if you want to keep several sets of statistics simultaneously. This argument
points to a block in heap storage where the statistics are to be stored. You need to
call LIB$FREE_TIMER only if you have specified handler in LIB$INIT_TIMER
and you want to deallocate all heap storage resources. In most cases, the implicit
deallocation when the image exits is sufficient.
The LIB$STAT_TIMER routine returns only one of the five statistics for each call,
and it returns that statistic in the form of an unsigned quadword or longword.
LIB$SHOW_TIMER returns the virtual address of the stored information,
which BASIC cannot directly access. Therefore, a BASIC program must call
LITERAL
TRUE = 1, ! Success
FALSE = 0; ! Failure
%SBTTL ’EXAMPLE_START - Sample program main routine’;
ROUTINE EXAMPLE_START =
BEGIN
!+
! This program reads a file specification and default file
! specification from SYS$INPUT. It then prints all the files that
! match that specification and prompts for another file specification.
! After the first file specification no default specification is requested,
! and the previous resulting file specification becomes the related
! file specification.
!-
LOCAL
LINEDESC : $BBLOCK[DSC$C_S_BLN], ! String desc. for input line
RESULT_DESC : $BBLOCK[DSC$C_S_BLN], ! String desc. for result file
CONTEXT, ! LIB$FIND_FILE context pointer
DEFAULT_DESC : $BBLOCK[DSC$C_S_BLN], ! String desc. for default spec
RELATED_DESC : $BBLOCK[DSC$C_S_BLN], ! String desc. for related spec
HAVE_DEFAULT,
STATUS;
!+
! Make all string descriptors dynamic.
!-
CH$FILL(0,DSC$C_S_BLN,LINEDESC);
LINEDESC[DSC$B_CLASS] = DSC$K_CLASS_D;
CH$MOVE(DSC$C_S_BLN,LINEDESC,RESULT_DESC);
CH$MOVE(DSC$C_S_BLN,LINEDESC,DEFAULT_DESC);
CH$MOVE(DSC$C_S_BLN,LINEDESC,RELATED_DESC);
HAVE_DEFAULT = FALSE;
CONTEXT = 0;
!+
! Read file specification, default file specification, and
! related file specification.
!-
WHILE (STATUS = LIB$GET_INPUT(LINEDESC,
$DESCRIPTOR(’FILE SPECIFICATION: ’))) NEQ RMS$_EOF
DO BEGIN
IF NOT .STATUS
THEN SIGNAL_STOP(.STATUS);
!+
! If default file specification was not obtained, do so now.
!-
IF NOT .HAVE_DEFAULT
THEN BEGIN
STATUS = LIB$GET_INPUT(DEFAULT_DESC,
$DESCRIPTOR(’DEFAULT FILE SPECIFICATION: ’));
IF NOT .STATUS
THEN SIGNAL_STOP(.STATUS);
HAVE_DEFAULT = TRUE;
END;
!+
! CALL LIB$FIND_FILE until RMS$_NMF (no more files) is returned.
! If an error other than RMS$_NMF is returned, it is signaled.
! Print out the file specification if the call is successful.
!-
WHILE (STATUS = LIB$FIND_FILE(LINEDESC,RESULT_DESC,CONTEXT,
DEFAULT_DESC,RELATED_DESC)) NEQ RMS$_NMF
DO IF NOT .STATUS
THEN SIGNAL(CLI$_PARSEFAIL,1,RESULT_DESC,.STATUS)
ELSE LIB$PUT_OUTPUT(RESULT_DESC);
!+
! Make this resultant file specification the related file
$NAM_INIT(NAM=RELNAM);
RELNAM[NAM$B_RSL] = .RELATED_DESC[DSC$W_LENGTH];
RELNAM[NAM$L_RSA] = .RELATED_DESC[DSC$A_POINTER];
!+
! Call LIB$FILE_SCAN. Note that errors need not be checked
! here because LIB$FILE_SCAN calls error_rtn for all errors.
!-
LIB$FILE_SCAN(IFAB,SUCCESS_RTN,ERROR_RTN);
!+
! Call LIB$FILE_SCAN_END to deallocate virtual memory used for
! file scan structures.
!-
STATUS = LIB$FILE_SCAN_END (IFAB);
IF NOT .STATUS
THEN SIGNAL_STOP (.STATUS);
RETURN 1
END; ! End of main program
ROUTINE SUCCESS_RTN (IFAB : REF BBLOCK) =
BEGIN
!+
! This routine is called by LIB$FILE_SCAN for each file that it
! successfully finds in the search sequence.
!
! Inputs:
!
! IFAB Address of a fab
!
! Outputs:
!
! file specification printed on SYS$OUTPUT
!-
LOCAL
DESC : BBLOCK[DSC$C_S_BLN]; ! A local string descriptor
BIND
INAM = .IFAB[FAB$L_NAM] : BBLOCK; ! Find NAM block
! from pointer in FAB
CH$FILL(0,DSC$C_S_BLN,DESC); ! Make static
! string descriptor
DESC[DSC$W_LENGTH] = .INAM[NAM$B_RSL]; ! Get string length
! from NAM block
DESC[DSC$A_POINTER] = .INAM[NAM$L_RSA]; ! Get pointer to the string
RETURN LIB$PUT_OUTPUT(DESC) ! Print name on SYS$OUTPUT
! and return
END;
ROUTINE ERROR_RTN (IFAB : REF BBLOCK) =
BEGIN
!+
! This routine is called by LIB$FILE_SCAN for each file specification that
! produces an error.
!
! Inputs:
!
! ifab Address of a fab
!
! Outputs:
!
! Error message is signaled
!-
LOCAL
DESC : BBLOCK[DSC$C_S_BLN]; ! A local string descriptor
BIND
INAM = .IFAB[FAB$L_NAM] : BBLOCK; ! Get NAM block pointer
! from FAB
CH$FILL(0,DSC$C_S_BLN,DESC); ! Create static
! string descriptor
DESC[DSC$W_LENGTH] = .INAM[NAM$B_RSL];
DESC[DSC$A_POINTER] = .INAM[NAM$L_RSA];
!+
! Signal the error using the shared message PARSEFAIL
! and the CLI facility code. The second part of the SIGNAL
! is the RMS STS and STV error codes.
!-
RETURN SIGNAL((SHR$_PARSEFAIL+3^16),1,DESC,
.IFAB[FAB$L_STS],.IFAB[FAB$L_STV])
END;
END ! End of module
ELUDOM
FORWARD ROUTINE
TREE_START, ! Main program
ALLOC_NODE, ! Allocate memory for a node
COMPARE_NODE, ! Compare two nodes
PRINT_NODE; ! Print a node (action routine
! for LIB$TRAVERSE_TREE)
!+
! INCLUDE FILES:
!-
LIBRARY ’SYS$LIBRARY:STARLET.L32’; ! System symbols
!+
! Define VMS block structures (BLOCK[,BYTE]).
!-
STRUCTURE
BBLOCK [O, P, S, E; N] =
[N]
(BBLOCK + O) <P, S, E>;
!+
! MACROS:
!-
MACRO
NODE$L_LEFT = 0,0,32,0%, ! Left subtree pointer in node
NODE$L_RIGHT = 4,0,32,0%, ! Right subtree pointer
NODE$W_BAL = 8,0,16,0%, ! Balance this node
NODE$B_NAMLNG = 10,0,8,0%, ! Length of name in this node
NODE$T_NAME = 11,0,0,0%; ! Start of name (variable length)
LITERAL
NODE$C_LENGTH = 11; ! Length of fixed part of node
!+
! EXTERNAL REFERENCES:
!-
EXTERNAL ROUTINE
LIB$GET_INPUT, ! Read from SYS$INPUT
LIB$GET_VM, ! Allocate virtual memory
LIB$INSERT_TREE, ! Insert into binary tree
LIB$LOOKUP_TREE, ! Lookup in binary tree
LIB$PUT_OUTPUT, ! Write to SYS$OUTPUT
LIB$TRAVERSE_TREE, ! Traverse a binary tree
STR$UPCASE, ! Convert string to all uppercase
SYS$FAO; ! Formatted ASCII output routine
%SBTTL ’TREE_START - Sample program main routine’;
ROUTINE TREE_START =
BEGIN
!+
! This program reads from SYS$INPUT and stores each data line
! as an entry in a binary tree. When end-of-file character (CTRL/Z)
! is entered, the tree will be printed in sorted order.
!-
LOCAL
NODE : REF BBLOCK, ! Address of allocated node
TREEHEAD, ! List head of binary tree
LINEDESC : BBLOCK[DSC$C_S_BLN], ! String descriptor for input line
STATUS;
STATUS = LIB$GET_VM(%REF(NODE$C_LENGTH+.KEYDESC[DSC$W_LENGTH]),NODE);
IF NOT .STATUS
THEN RETURN .STATUS
ELSE BEGIN
NODE[NODE$B_NAMLNG] = .KEYDESC[DSC$W_LENGTH]; ! Set name length
CH$MOVE(.KEYDESC[DSC$W_LENGTH], ! Copy in the name
.KEYDESC[DSC$A_POINTER],
NODE[NODE$T_NAME]);
RETDESC[0] = .NODE; ! Return address to caller
END;
RETURN .STATUS
END;
LOCAL
OUTBUF : BBLOCK[512], ! FAO output buffer
OUTDESC : BBLOCK[DSC$C_S_BLN], ! Output buffer descriptor
STATUS;
CH$FILL(0,DSC$C_S_BLN,OUTDESC); ! Zero descriptor
OUTDESC[DSC$W_LENGTH] = 512;
OUTDESC[DSC$A_POINTER] = OUTBUF;
IF NOT (STATUS = SYS$FAO($DESCRIPTOR(’!XL !XL !XL !XW !AC’),
OUTDESC,OUTDESC,
.NODE,.NODE[NODE$L_LEFT],
.NODE[NODE$L_RIGHT],
.NODE[NODE$W_BAL],
NODE[NODE$B_NAMLNG]))
THEN SIGNAL(.STATUS)
ELSE BEGIN
STATUS = LIB$PUT_OUTPUT(OUTDESC); ! Output the line
IF NOT .STATUS
THEN SIGNAL(.STATUS);
END;
RETURN SS$_NORMAL
END;
END ! End of module TREE_EXAMPLE
ELUDOM
ZK−1970−GE
Figure 25–1 illustrates the steps required in using the cross-reference routines.
The Run-Time Library provides three macros to initialize the data structures
used by the cross-reference routines:
1. $CRFCTLTABLE defines a table of control information.
2. $CRFFIELD defines each field of the output format definition table. Multiple
$CRFFIELD macro instructions can be issued in defining one particular field.
3. $CRFFIELDEND ends a set of $CRFFIELD macro instructions (a format
table).
label
The address of the control table. You must specify a control table address in all
calls to the cross-reference routines.
keytype
The type of key to enter into the table. The following key types are defined:
ASCIC Keys are counted ASCII strings, with a maximum of 31 characters (symbol
name).
BIN_U32 Keys are 32-bit unsigned binary values. The binary-to-ASCII conversion is
done by $FAO using the format string for the KEY1 field.
output
The address of the routine that you supply to print a formatted output line. The
output line is passed to the output routine by descriptor.
error
The address of an error routine to execute if the called cross-reference routine
encounters an error. The error code (longword) is passed to the error routine by
value. In other words, it is a copy of the constant on the stack. A value of zero
indicates that no error routine is supplied.
memexp
The number of pages by which to expand region when needed. The default is 50.
key1table
The address of the field descriptor table for the KEY1 field. A value of zero
indicates that the field is not to be included in the output line.
The remaining arguments provide the address of the field descriptor tables for
the KEY2, VAL1, VAL2, REF1, and REF2 fields, respectively, of the output line.
You can use these argument names as keywords in the macros. For example, you
can use KEYTYPE as a keyword when issuing the $CRFCTLTABLE macro.
label
The address of the field descriptor table generated as a result of this set of
$CRFFIELD macro instructions. The label field can be omitted after the first
macro of the set. These addresses correspond to the field descriptor table
addresses in the $CRFCTLTABLE macro.
bit_mask
A 16-bit mask. When the user enters a key or reference, the cross-reference
routine stores flag information with the entry. When preparing the output line,
LIB$CRF_OUTPUT performs an AND operation on the 16-bit mask in the field
descriptor table with the flag stored with the entry. Any number of bit masks can
be defined for a field. $CRFFIELD macro instructions are used to define multiple
bit patterns for a flag field. The high-order bit is reserved to the cross-reference
routines.
fao_string
The $FAO command string. LIB$CRF_OUTPUT uses this string to determine the
$FAO format when formatting this field for output.
field_width
The maximum width of the output field.
set_clear
The indicator used to determine whether the bit mask is to be tested as set or
clear when determining which flag to use. SET indicates test for set; CLEAR
indicates test for clear.
You can use the argument names shown here as keywords in your program.
In the following example, one bit pattern is defined twice; once indicating a string
that is to be printed if the pattern is set, and once indicating that spaces are to
appear if the pattern is clear.
$CRFFIELD BIT_MASK=SYM$M_REL, FAO_STRING=3_\##_\,-
SET_CLEAR=CLEAR, FIELD_WIDTH=2
$CRFFIELD BIT_MASK=SYM$M_REL, FAO_STRING=_\-R_\,-
SET_CLEAR=SET, FIELD_WIDTH=2
If more than one set of flags is defined for a field, each FAO string must print the
same number of characters; otherwise, the output is not aligned in columns.
The fields for the symbol name, symbol value, and references are always
formatted using the first descriptor in the corresponding table.
ZK−1973−GE
Figure 25–3 Summary of Symbol Names, Values, and Name of Referring Modules
ZK−1971−GE
Figure 25–5 shows that any of these fields can be omitted from the output.
ZK−1972−GE
25.6 Example
The VAX Linker uses the cross-reference routines to generate cross-reference
listings. This section uses the linker’s code as an example of using the cross-
reference routines in a MACRO program.
After setting up the control tables, the linker defines each field of the cross-
reference output line, using the $CRFFIELD macro. After each set of definitions
for a field, it calls $CRFFIELDEND to mark the end of the field.
Note particularly the following two features of this set of definitions:
• The definition of LNK$VAL2 describes a flag to be associated with VAL1. The
definition contains alternative bit patterns, depending on the bit mask. When
an entry is made to the table, the entry contains flag information. Then,
when LIB$CRF_OUTPUT is called to format the data, the routine checks
each entry, matching the flags argument against the bit masks specified
in the control table. When LIB$CRF_OUTPUT finds a match, it uses that
definition to determine the format of the entry in the output table. For
example, BIT_MASK=SYM$M_DEF marks an entry as the defining reference.
The corresponding VAL1 entry is placed in the output table with an asterisk
in its flags field.
• The FAO control strings are defined to produce an output of the maximum
character size for each field. This ensures that the columns will line up
correctly in the output. For example, !15AC produces the variable symbol
name left-aligned and right-filled with spaces. Another example is the three
sets of characters to be printed for field VAL2. Each FAO control string
produces two characters, which is the maximum size of the field.
LNK$KEY1:
$CRFFIELD BIT_MASK=0, FAO_STRING=\!15AC\,-
SET_CLEAR=SET,FIELD_WIDTH=15
$CRFFIELDEND
LNK$KEY2:
$CRFFIELD BIT_MASK=0,FAO_STRING=\ \,-
SET_CLEAR=SET, FIELD_WIDTH=1
$CRFFIELDEND
LNK$VAL1:
$CRFFIELD BIT_MASK=0,FAO_STRING=\!XL\,-
SET_CLEAR=SET,FIELD_WIDTH=8
$CRFFIELDEND
LNK$VAL2:
$CRFFIELD BIT_MASK=0, FAO_STRING=\!2* \,-
SET_CLEAR=SET,FIELD_WIDTH=2
$CRFFIELD BIT_MASK=SYM$M_REL,FAO_STRING=\-R\,-
SET_CLEAR=SET,FIELD_WIDTH=2
$CRFFIELD BIT_MASK=SYM$M_DEF, FAO_STRING=\-*\,-
SET_CLEAR=CLEAR,FIELD_WIDTH=2
$CRFFIELDEND
LNK$REF1:
$CRFFIELD BIT_MASK=0,FAO_STRING=\!6* \,-
SET_CLEAR=SET,FIELD_WIDTH=6
$CRFFIELD BIT_MASK=SYM$M_WEAK,FAO_STRING=\!3* WK-\,-
SET_CLEAR=SET,FIELD_WIDTH=6
$CRFFIELDEND
LNK$REF2:
$CRFFIELD BIT_MASK=0,FAO_STRING=\!16AC\,-
SET_CLEAR=SET,FIELD_WIDTH=16
$CRFFIELDEND
After initializing the symbol-by-name table, the linker sets up a second control
table. This table defines the output for a symbol-by-value synopsis. For this
output, the value fields are eliminated. The symbols having this value are
entered as reference indicators. None is specified as the defining reference. The
control table uses the field descriptors set up previously. The following macro
instructions are used:
LNK$VALTAB:
$CRFCTLTABLE KEYTYPE=BIN_U32, ERROR=LNK$ERR_RTN,-
OUTPUT=LNK$MAPOUT,KEY1TABLE=LNK$VAL1,-
KEY2TABLE=LNK$VAL2,VAL1TABLE=0,-
VAL2TABLE=0,REF1TABLE=LNK$REF1,-
REF2TABLE=LNK$REF2
After it has performed symbol relocation for the module being linked, the linker
calls LIB$CRF_INS_REF to build a table ordered by value.
PUSHAB REF
PUSHAB REF_FLAGS
PUSHAB REF_ADDR
PUSHAB VAL_ADDR
PUSHAB LNK$VALTAB
CALLS #5,G^LIB$CRF_INS_REF
LNK$VALTAB Is the address of the control table for the symbol synopsis by value
VAL_ADDR Is the address of the value (binary longword key)
REF_ADDR Is the address of the symbol name having the value contained in
VAL_ADDR
REF_FLAGS Is the address of a word whose bits are used to select special
characters to print beside the value
CRF$K_REF Is the indicator that this is not a defining reference
This chapter describes the techniques available for sharing data and program
code among programs. It contains the following sections:
Section 26.1 describes how to share code among programs.
Section 26.2 describes shareable images.
Section 26.3 defines and describes how to use local and global symbols to share
images.
The operating system provides the following techniques for sharing data and
program code among programs:
• DCL symbols and logical names
• Libraries
• Shareable images
• Global sections
• Common blocks installed in a shareable image
• OpenVMS Record Management Services (RMS) shared files
Symbols and logical names are also used for intraprocess and interprocess
communication; therefore, they are discussed in Chapter 32.
Libraries and shareable images are used for sharing program code.
Global sections, common blocks stored in shareable images, and RMS shared
files are used for sharing data. You can also use common blocks for interprocess
communication. For more information, refer to Chapter 3.
Use the /DELETE qualifier to delete a library module and the /EXTRACT
qualifier to recreate an object file. If you delete many modules, you should
also compress (/COMPRESS qualifier) and purge (PURGE command) the library.
Note that the /ONLY, /DELETE, and /EXTRACT qualifiers require the names of
modules—not file names—and that the names are specified as qualifier values,
not parameter values.
26.3 Symbols
Symbols are names that represent locations (addresses) in virtual memory. More
precisely, a symbol’s value is the address of the first, or low-order, byte of a
defined area of virtual memory, while the characteristics of the defined area
provide the number of bytes referred to. For example, if you define TOTAL_
HOUSES as an integer, the symbol TOTAL_HOUSES is assigned the address of
the low-order byte of a 4-byte area in virtual memory. Some system components
(for example, the debugger) permit you to refer to areas of virtual memory by
their actual addresses, but symbolic references are always recommended.
.TITLE macro-name
macro-name GLOBAL
.
.
.
.END
The following example is a macro program that includes two system macros:
LBRDEF.MAR
.TITLE $LBRDEF
$LBRDEF GLOBAL
$LHIDEF GLOBAL
.END
Assemble the routine containing the macros with the MACRO command. You can
place the resultant object modules in a default library or in a library that you
specify in the LINK command, or you can specify the object modules in the LINK
command. The following example places the $LBRDEF and $LHIDEF modules in
a library before performing a link operation:
$ MACRO LBRDEF
$ LIBRARY/REPLACE INCOME LBRDEF
$ DELETE LBRDEF.OBJ;*
$ LINK INCOME,INCOME/LIBRARY
The following LINK command uses the object file directly:
$ LINK INCOME,LBRDEF,INCOME/LIBRARY
Note
A disk containing an installed image cannot be dismounted. To remove an
installed image, invoke the Install utility and enter DELETE followed by
the complete file specification of the image. The DELETE subcommand
does not delete the file from the disk; it removes the file from the list of
known installed images.
Perform the following steps to write or read the data in an installed common
block from within any program:
1. Include the same variable and common block definitions in the program.
2. Compile the program.
For Alpha only, when compiling the program that contains the common block
declarations, consistently use the same /ALIGNMENT and /GRANULARITY
qualifiers used to compile the common block data declaration program
that has been installed as a shareable image. For more information, see
Section 26.3.4.3.
3. Link the program against the shareable image that contains the common
block. (Linking against a shareable image requires an options file.)
$ LINK INCOME, DATA/OPTION
$ LINK REPORT, DATA/OPTION
DATA.OPT
INC_COMMON/SHAREABLE
For Alpha only, linking is as follows:
INC_COMMON/SHAREABLE
PSECT_ATTR=WORK_AREA, SHR
If a !DEC$ PSECT (cDEC$ PSECT) directive specified the SHR PSECT
attribute, the linker options file INCOME.OPT would contain the following
line:
INC_COMMON/SHAREABLE
The source line containing the !DEC$ PSECT directive would be as follows:
!DEC$ PSECT /INC_COMMON/ SHR
In the previous series of examples, the two programs INCOME and REPORT
access the same area of memory through the installed common block INCOME_
DATA (defined in INC_COMMON.FOR).
Typically, programs that access shared data use common event flag clusters
to synchronize read and write access to the data. Refer to Chapter 7 for more
information about using event flags for program synchronization.
26.3.4.2 Using Global Sections
To share data by using global sections, each process that plans to access the data
includes a common block of the same name, which contains the variables for
the data. The first process to reference the data declares the common block as a
global section and, optionally, maps data to the section. (Data in global sections,
as in private sections, must be page aligned.)
To create a global section, invoke SYS$CRMPSC and add the following:
• Additional argument—Specify the name of the global section (argument 5). A
program uses this name to access a global section.
• Additional flag—Set the SEC$V_GBL bit of the flags argument to indicate
that the section is a global section.
As other programs need to reference the data, each can use either SYS$CRMPSC
or SYS$MGBLSC to map data into the global section. If you know that the global
section exists, the best practice is to use the SYS$MGBLSC system service.
The format for SYS$MGBLSC is as follows:
SYS$MGBLSC (inadr ,[retadr] ,[acmode] ,[flags] ,gsdnam ,[ident] ,[relpag])
Refer to the OpenVMS System Services Reference Manual for complete
information about this system service.
In Example 26–1, one image, DEVICE.FOR, passes device names to another
image, GETDEVINF.FOR. GETDEVINF.FOR returns the process name and
the terminal associated with the process that allocated each device. The two
processes use the global section GLOBAL_SEC to communicate. GLOBAL_SEC is
mapped to the common block named DATA, which is page aligned by the options
file DATA.OPT. Event flags are used to synchronize the exchange of information.
UFO_CREATE.FOR, DATA.OPT, and DEVICE.FOR are included here for easy
reference. Refer to Section 28.4 for additional information about global sections.
By default, a global section is deleted when no image is mapped to it. Such global
sections are called temporary global sections. If you have the PRMGBL privilege,
you can create a permanent global section (set the SEC$V_PERM bit of the flags
argument when you invoke SYS$CRMPSC). A permanent global section is not
deleted until after it is marked for deletion with the SYS$DGBLSC system service
(requires PRMGBL). Once a permanent section is marked for deletion, it is like a
temporary section; when no image is mapped to it, the section is deleted.
26.3.4.3 Synchronizing Access to Global Sections
On Alpha systems, if more than one process or thread will write to a shared
global section containing COMMON block data, the user program may need to
synchronize access to COMMON block variables.
On Alpha systems, compile all programs referencing the shared common area
with the same value for the /ALIGNMENT and /GRANULARITY qualifiers, as
shown in the following:
$ F90 /ALIGN=COMMONS=NATURAL /GRANULARITY=LONGWORD INC_COMMON
On Alpha systems, using /GRANULARITY=LONGWORD for 4-byte variables
or /GRANULARITY=QUADWORD for 8-byte variables ensures that adjacent
data is not accidentally effected. To ensure access to 1-byte variables, specify
/GRANULARITY=BYTE. Because accessing data items less than four bytes slows
run-time performance, you might want to considering synchronizing read and
write access to the data on the same node.
One way for programs accessing shared data is to use common event flag clusters
to synchronize read and write access to the data on the same node. In the
simplest case, one event flag in a common event flag cluster might indicate that
a program is writing data, and a second event flag in the cluster might indicate
that a program is reading data. Before accessing the shared data, a program
must examine the common event flag cluster to ensure that accessing the data
does not conflict with an operation already in progress.
Other ways of synchronizing access on a single node include using the following
OpenVMS system services:
• The lock manager system services (SYS$ENQ and SYS$DEQ)
• The hibernate and wake system services (SYS$HIBER and SYS$WAKE)
You could also use Assembler code for synchronization.
26.3.4.4 RMS Shared Files
RMS allows concurrent access to a file. Shared files can be one of the following
formats:
• Indexed files
• Relative files
• Sequential files with 512-byte fixed-length records
To coordinate access to a file, RMS uses the lock manager. You can override the
RMS lock manager by controlling access yourself. Refer to Chapter 7 for more
information about synchronizing access to resources.
This chapter describes the types of system time operations performed by the
operating system and contains the following sections:
Section 27.1 describes the system time format.
Section 27.2 describes time conversion and date/time manipulation.
Section 27.3 describes how to get the current date and time and set the current
time.
Section 27.4 describes how to set and cancel timer requests and how to schedule
and cancel wakeups.
Section 27.5 describes using run-time library (RTL) routines to collect timer
statistics.
Section 27.6 describes using date/time formatting routines.
Section 27.7 describes the Coordinated Universal Time (UTC) system.
You can use the SYS$GETTIM system service to get the current time in internal
format, or you can use SYS$BINTIM to convert a formatted time to an internal
time, as shown in Section 27.3.2. You can also use the LIB$DATE_TIME routine
to obtain the time, LIB$CVT_FROM_INTERNAL_TIME to convert an internal
time to an external time, and LIB$CVT_TO_INTERNAL to convert from an
external time to an internal time.
27.2.1.1 Calculating and Displaying Time with SYS$GETTIM and LIB$SUBX
Example 27–1 calculates differences between the current time and a time input
in absolute format, and then displays the result as delta time. If the input time
is later than the current time, the difference is a negative value (delta time) and
can be displayed directly. If the input time is an earlier time, the difference is a
positive value (absolute time) and must be converted to delta time before being
displayed. To change an absolute time to a delta time, negate the time array
by subtracting it from 0 (specified as an integer array) using the LIB$SUBX
routine, which performs subtraction on signed two’s complement integers of
arbitrary length. For the absolute or delta time format, see Section 27.1.1 and
Section 27.1.2.
If you are ignoring the time portion of date/time (that is, working just at the date
level), the LIB$DAY routine might simplify your calculations. LIB$DAY returns
to you the number of days from the base system date to a given date.
If you are programming in VAX MACRO, you can also specify approximate
delta time values when you assemble a program, using two MACRO .LONG
directives to represent a time value in 100-ns units. The arithmetic is based on
the following formula:
1 second = 10 million * 100 ns
For example, the following statement defines a delta time value of 5 seconds:
FIVESEC: .LONG -10*1000*1000*5,-1 ; Five seconds
The value 10 million is expressed as 10*1000*1000 for readability. Note that the
delta time value is negative.
If you use this notation, however, you are limited to the maximum number of
100-ns units that can be expressed in a longword. In time values this is slightly
more than 7 minutes.
27.2.1.4 Obtaining Numeric and ASCII Time with SYS$NUMTIM
The Convert Binary Time to Numeric Time (SYS$NUMTIM) system service
converts a time in the system format into binary integer values. The service
returns each of the components of the time (year, month, day, hour, and so on)
into a separate word of a 7-word buffer. The SYS$NUMTIM system service and
the format of the information returned are described in the OpenVMS System
Services Reference Manual.
You use the SYS$ASCTIM system service to format the time in ASCII for
inclusion in an output string. The SYS$ASCTIM service accepts as an argument
the address of a quadword that contains the time in system format and returns
the date and time in ASCII format.
If you want to include the date and time in a character string that contains
additional data, you can format the output string with the Formatted ASCII
Output (SYS$FAO) system service. The SYS$FAO system service converts binary
values to ASCII representations, and substitutes the results in character strings
according to directives supplied in an input control string. Among these directives
are !%T and !%D, which convert a quadword time value to an ASCII string and
substitute the result in an output string. For examples of how to do this, see the
discussion of $FAO in the OpenVMS System Services Reference Manual.
#include <stdio.h>
#include <descrip.h>
struct {
unsigned int buff1, buff2;
}time_value;
main() {
unsigned int status;
char timestr[23];
$DESCRIPTOR(atimenow, timestr);
/* Get binary time */
status = SYS$GETTIM(&time_value);
if ((status & 1) != 1)
LIB$SIGNAL( status );
/* Convert binary time to ASCII */
status = SYS$ASCTIM(0, /* timlen - Length of ASCII string */
&atimenow, /* timbuf - ASCII time buffer */
&time_value, /* timadr - Binary time */
0); /* cvtflags - Conversion indicator */
if ((status & 1) != 1)
LIB$SIGNAL( status );
Because the address of a 64-bit time value is not supplied, the default value, 0, is
used.
The string the service returns has the following format:
dd-MMM-yyyy hh:mm:ss.cc
#include <stdio.h>
#include <descrip.h>
#include <ssdef.h>
#include <stdlib.h>
void gemini (int x);
unsigned int status;
/* Buffers to receive binary times */
struct {
unsigned int buff1, buff2;
}abs_binary, delta_binary;
main() {
$DESCRIPTOR(abs_time,"-- 19:37:00.00"); /* 9 am absolute time */
$DESCRIPTOR(delta_time,"0 :00:30"); /* 5-min delta time */
/* Convert ASCII absolute time to binary format */
status = SYS$BINTIM( &abs_time, /* ASCII absolute time */
&abs_binary); /* Converted to binary */
if (status == SS$_NORMAL)
{
status = SYS$SETIMR(0, /* efn - event flag */
&abs_binary, /* daytim - expiration time */
&gemini, /* astadr - AST routine */
1, /* reqidt - timer request id */
0); /* flags */
if (status == SS$_NORMAL)
printf("Setting system timer A\n");
}
else
LIB$SIGNAL( status );
/* Convert ASCII delta time to binary format */
status = SYS$BINTIM( &delta_time, /* ASCII delta time */
&delta_binary); /* Converted to binary */
if (status == SS$_NORMAL)
{
printf("Converting delta time to binary format\n");
status = SYS$SETIMR(0, /* efn - event flag */
&delta_binary, /* daytim - expiration time */
&gemini, /* astadr - AST routine */
2, /* reqidt - timer request id */
0); /* flags */
if (status == SS$_NORMAL)
printf("Setting system timer B\n");
else
LIB$SIGNAL( status );
}
else
LIB$SIGNAL( status );
status = SYS$HIBER();
}
The following example shows the output received from the preceding program.
Assume the program starts execution at 8:45. Seconds later, the system time is
set to 9:15. The timer request that specified an absolute time of 9:00 executes
immediately, because 9:00 has passed. The request that specified a delta time of
5 minutes times out at 9:20.
$ SHOW TIME
30-DEC-1993 8:45:04.56 +----------------------+
$ RUN SCORPIO | operator sets system |
<-----------------------------------------------| time to 9:15 |
Request ID number 1 executed at 09:15:00.00 +----------------------+
Request ID number 2 executed at 09:20:00.02
$
/* Wait 30 seconds */
status = SYS$WAITFR( efn ); "
if ((status & 1) != 1)
LIB$SIGNAL( status );
else
printf("Timer expires...\n");
}
The following example shows a process scheduling a wakeup for itself prior to
hibernating:
#include <stdio.h>
#include <descrip.h>
struct {
unsigned int buff1, buff2;
}btensec;
main() {
unsigned int status;
$DESCRIPTOR(atensec,"0 00:00:10.00");
/* Convert time */
status = SYS$BINTIM(&atensec, /* timbuf - ASCII time */
&btensec);/* timadr - binary time */
if ((status & 1 ) != 1)
LIB$SIGNAL( status );
/* Schedule wakeup */
status = SYS$SCHDWK(0, /* pidadr - process id */
0, /* prcnam - process name */
&btensec, /* daytim - wake up time */
0); /* reptim - repeat interval */
if ((status & 1 ) != 1)
LIB$SIGNAL( status );
/* Sleep ten seconds */
status = SYS$HIBER();
if ((status & 1 ) != 1)
LIB$SIGNAL( status );
}
Note that a suitably privileged process can wake or schedule a wakeup request
for another process; thus, cooperating processes can synchronize activity using
hibernation and scheduled wakeups. Moreover, when you use the SYS$SCHDWK
system service in a program, you can specify that the wakeup request be repeated
at fixed time intervals. See Chapter 4 for more information on hibernation and
wakeup.
You can use the SYS$GETSYI system service to obtain more detailed system
information about boot time, the cluster, processor type, emulated instructions,
nodes, paging files, swapping files, and hardware and software versions. With
SYS$GETQUI and LIB$GETQUI, you can obtain queue information.
For example, if the system managers want the spellings for French, German, and
Italian languages to be defined, they must define SYS$LANGUAGES as shown,
prior to invoking LIB$DT_STARTUP.COM:
$ DEFINE SYS$LANGUAGES FRENCH, GERMAN, ITALIAN
If the user requires an additional language, for example FINNISH, then the
system manager must add FINNISH to the definition of SYS$LANGUAGES and
reexecute the command procedure.
Date/Time Manipulation Option
The Date/Time Manipulation option provides date/time spelling support for
four new languages. Users or application programmers can select the desired
language by defining the logical name SYS$LANGUAGES. The new languages
and their equivalent names are as follows:
Note
LIB$DATE_FORMAT_042 and LIB$DATE_FORMAT_043 support the
DEC Hanzi coded character set.
LIB$DATE_FORMAT_044 and LIB$DATE_FORMAT_045 support the
DEC Hanyu coded character set.
LIB$DATE_FORMAT_046 and LIB$DATE_FORMAT_047 support the
DEC Hangul coded character set.
Figure 27–2 lists the new predefined time format logical names in the first
column, their formats in the second column, and examples of the output generated
using these formats in the third column.
Note
LIB$TIME_FORMAT_021 supports the DEC Hanzi coded character set.
LIB$TIME_FORMAT_022 supports the DEC Hanyu coded character set.
LIB$TIME_FORMAT_023 supports the DEC Hangul coded character set.
Thus, to select a particular format for a date or time, or both, you can define the
LIB$DT_FORMAT logical name using the following logicals:
• LIB$DATE_FORMAT_nnn, where nnn can range from 001 to 047
• LIB$TIME_FORMAT_nnn, where nnn can range from 001 to 023
Time Explanation
!H04 Hours; zero-filled, 24-hour clock
!HH4 Hours; no fill, 24-hour clock
!HB4 Hours; blank-filled, 24-hour clock
!H02 Hours; zero-filled, 12-hour clock
!HH2 Hours; no fill, 12-hour clock
!HB2 Hours; blank-filled, 12-hour clock
!M0 Minutes; zero-filled
!MM Minutes; no fill
!MB Minutes; blank-filled
!S0 Seconds; zero-filled
!SS Seconds; no fill
!SB Seconds; blank-filled
!C7 Fractional seconds; 7 digits
!C6 Fractional seconds; 6 digits
!C5 Fractional seconds; 5 digits
!C4 Fractional seconds; 4 digits
(continued on next page)
• White space
White space includes any combination of spaces and tabs. In the
interpretation of the format string, any white space is condensed to a single
space. When parsing an input string, white space is generally noted as
synchronizing punctuation and is skipped; however, white space is significant
in some situations, such as with blank-filled numbers.
• Explicit
Explicit punctuation refers to any string of one or more characters that is
used as punctuation and is not solely comprised of white space. Any white
space appearing within an explicit punctuation string is interpreted literally;
in other words, the white space is not compressed. In the format string, you
can use explicit punctuation to denote a particular format and to guide the
parser in parsing the input string. In the input string, you can use explicit
punctuation to synchronize the parse of the input string against the format
string. The explicit punctuation used should not be a subset of the valid input
of any field that it precedes or follows it.
Punctuation is especially important in providing guidelines for the parser to
translate the input date/time string properly.
Default Date/Time Fields
Punctuation in a date/time string is also useful for specifying which fields you
want to omit in order to accept the default values. That is, you can control the
parsing of the input string by supplying punctuation without the appropriate
field values. If only the punctuation is supplied and a user-supplied default is not
specified, the value of the omitted field defaults according to the following rules:
• For the date group, the default is the current date.
• For the time group, the default is 00:00:00.00.
Table 27–7 gives some examples of input strings (using punctuation to indicate
defaulted fields) and their full translations (assuming a current date of 25-FEB-
1993 and using the default input format).
Table 27–9 lists all predefined time format logical names, their formats, and
examples of the output generated using those formats.
LIB$K_WEEKDAY_NAME 7
LIB$K_WEEKDAY_NAME_ABB 7
LIB$K_RELATIVE_DAY_NAME 3
LIB$K_MERIDIEM_INDICATOR 2
LIB$K_OUTPUT_FORMAT 2
LIB$K_INPUT_FORMAT 1
LIB$K_LANGUAGE 1
To specify the actual values for these elements, you must use an initialization
string in the following format:
"[delim][string-1][delim][string-2][delim]...[delim][string-n][delim]"
In this format, [-] is a delimiting character that is not in any of the strings, and
[string-n] is the spelling of the nth instance of the component.
For example, a string passed to this routine to specify the English spellings of the
abbreviated month names might be as follows:
"|JAN|FEB|MAR|APR|MAY|JUN
|JUL|AUG|SEP|OCT|NOV|DEC|"
The string must contain the exact number of elements for the associated
component; otherwise the error LIB$_NUMELEMENTS is returned. Note that
the string begins and ends with a delimiter. Thus, there is one more delimiter
than the number of string elements in the initialization string.
27.6.2.6 Specifying Input Format Mnemonics at Compile Time
To specify the input format mnemonics at compile time, the user must initialize
the component LIB$K_FORMAT_MNEMONICS with the appropriate values.
Table 27–11 lists the nine fields that must be initialized, in the appropriate order,
along with their default (English) values.
|YYYY|MM|DD|HH|MM|SS|CC|AM/PM|MONTH|
If the user were entering the same string using Austrian as the natural language,
the definition of the component LIB$K_FORMAT_MNEMONICS would be as
follows:
|JJJJ|MM|TT|SS|MM|SS|HH| |MONAT|
27.6.2.7 Specifying Output Formats at Compile Time
To specify an output format at compile time, the user must preinitialize the
component LIB$K_OUTPUT_FORMAT. Two elements are associated with this
output format string. One describes the date format fields, the other the time
format fields. The order in which they appear in the string determines the order
in which they are output. A single space is inserted into the output stream
between the two elements, if the call to LIB$FORMAT_DATE_TIME specifies
that both be output. For example:
" | !DB-!MAAU-!Y4 | !H04:!M0:!S0.!C2 | "
(These mnemonics are listed in Table 27–6.) This format string represents the
format used by the $ASCTIM system service for outputting times. Note that the
middle delimiter is replaced by a space in the resultant output.
13-JAN-1993 14:54:09:24
Date Explanation
!Z4 Year; 4 digits
!Z3 Year; 3 digits
!Z2 Year; 2 digits (New behavior for the LIB$CONVERT_DATE_STRING routine)
!Z1 Year; 1 digit
After the system manager defines the desired formats, the user can access them
by using the following commands:
$ DEFINE SYS$LANGUAGE FRENCH
$ DEFINE LIB$DT_FORMAT LIB$DATE_FORMAT_501, LIB$TIME_FORMAT_501
After completing these steps, a program outputting the date and time provides
the following results:
mardi, le 20 janvier 1993 13 heures et 50 minutes
In addition to creating their own date and time formats, users can also define
their own language tables (provided they have the SYSNAM, SYSPRV and
CMEXEC privileges). To create a language table, a user must define all the
logical names required.
The following example defines a portion of the Dutch language table. This table
is included in its entirety in the set of predefined languages provided with the
international date/time formatting routines.
$ CREATE/NAME/PARENT=LNM$SYSTEM_DIRECTORY/EXEC/PROT=(S:RWED,G:R,W:R) -
_$ LNM$LANGUAGE_DUTCH
$ DEFINE/EXEC/TABLE=LNM$LANGUAGE_DUTCH LIB$WEEKDAYS_L -
_$ "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", -
_$ "zaterdag", "zondag"
$ DEFINE/EXEC/TABLE=LNM$LANGUAGE_DUTCH LIB$WEEKDAY_ABBREVIATIONS_L -
_$ "maa", "din", "woe", "don", "vri", "zat", "zon"
$ DEFINE/EXEC/TABLE=LNM$LANGUAGE_DUTCH LIB$MONTHS_L "januari", -
_$ "februari", "maart", "april", "mei", "juni", "juli", "augustus", -
_$ "september", "oktober", "november", "december"
$ DEFINE/EXEC/TABLE=LNM$LANGUAGE_DUTCH LIB$MONTH_ABBREVIATIONS_L -
_$ "jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", -
_$ "okt", "nov", "dec"
$ DEFINE/EXEC/TABLE=LNM$LANGUAGE_AUSTRIAN LIB$RELATIVE_DAYS_L -
_$ "gisteren", "vandaag", "morgen"
All logical names that are used to build a language are as follows:
LIB$WEEKDAYS_[U | L | C]
These logical names supply the names of the weekdays, spelled out in full
(uppercase, lowercase, or mixed case). Weekdays must be defined in order,
starting with Monday.
LIB$WEEKDAY_ABBREVIATIONS_[U | L | C]
These logical names supply the abbreviated names of the weekdays (uppercase,
lowercase, or mixed case). Weekday abbreviations must be defined in order,
starting with Monday.
LIB$MONTHS_[U | L | C]
These logical names supply the names of the months, spelled out in full
(uppercase, lowercase, or mixed case). Months must be defined in order, starting
with January.
LIB$MONTH_ABBREVIATIONS_[U | L | C]
These logical names supply the abbreviated names of the months (uppercase,
lowercase, or mixed case). Month abbreviations must be defined in order, starting
with January.
LIB$MI_[U | L | C]
These logical names supply the spellings for the meridiem indicators (uppercase,
lowercase, or mixed case). Meridiem indicators must be defined in order; the first
indicator represents the hours 0:00:0.0 to 11:59:59.99, and the second indicator
represents the hours 12:00:00.00 to 23:59:59.99.
LIB$RELATIVE_DAYS_[U | L | C]
These logical names supply the spellings for the relative days (uppercase,
lowercase, or mixed case). Relative days must be defined in order: yesterday,
today, and tomorrow, respectively.
LIB$FORMAT_MNEMONICS
This logical name supplies the abbreviations for the appropriate format
mnemonics. That is, the information supplied in this logical name is used
to specify a desired input format in the user-defined language. The format
mnemonics, along with their English values, are listed in the order in which they
must be defined.
1. Year (YYYY)
2. Numeric month (MM)
3. Day of the month (DD)
4. Hour of the day (HH)
5. Minutes of the hour (MM)
6. Seconds of the minute (SS)
7. Parts of the second (CC)
8. Meridiem indicator (AM/PM)
9. Alphabetic month (MONTH)
The English definition of LIB$FORMAT_MNEMONIC is therefore as follows:
$ DEFINE/EXEC/TABLE=LNM$LANGUAGE_ENGLISH LIB$FORMAT_MNEMONICS -
_$ "YYYY", "MM", "DD", "HH", "MM", "SS", "CC", "AM/PM ", "MONTH"
The UTC system services allow applications to gain the benefits of a Coordinated
Universal Time reference. The UTC system services enable applications to
reference a common time standard independent of the host’s location and local
date and time value.
By calling the UTC system services, applications can perform the following
functions:
• Obtain binary representations of UTC in the binary UTC format
• Convert the binary operating system format date and time to binary
UTC-format date and time
• Convert binary UTC-format date and time to the binary operating system
date and time
• Convert ASCII-format date and time to binary UTC-format date and time
• Convert binary UTC-format date and time to ASCII-format date and time
System services that implement the UTC-format date and time are:
• SYS$ASCUTC—Convert UTC to ASCII
• SYS$BINUTC—Convert ASCII String to UTC Binary Time
• SYS$GETUTC—Get UTC Time
• SYS$NUMUTC—Convert UTC Time to Numeric Components
• SYS$TIMCON—Time Converter
For specific implementation information about the UTC system services, see the
OpenVMS System Services Reference Manual.
This chapter describes file operations that support file input/output (I/O) and
file I/O instructions of the operating system’s high-level languages. This chapter
contains the following sections:
Section 28.1 describes file attributes.
Section 28.2 describes strategies to access files.
Section 28.3 describes protection and access of files.
Section 28.4 describes file mapping.
Section 28.5 describes how to open and update a sequential file.
Section 28.6 describes using the Fortran user-open routines.
I/O statements transfer data between records in files and variables in your
program. The I/O statement determines the operation to be performed; the
I/O control list specifies the file, record, and format attributes; and the I/O list
contains the variables to be acted upon.
Note
Some confusion might arise between records in a file and record variables.
Where this chapter refers to a record variable, the term record variable is
used; otherwise, record refers to a record in a file.
END IF
END IF
.
.
.
In Fortran, each time you access a record in a shared file, that record is
automatically locked either until you perform another I/O operation on the
same logical unit, or until you explicitly unlock the record using the UNLOCK
statement. If you plan to modify a record, you should do so before unlocking it;
otherwise, you should unlock the record as soon as possible.
Note
Files created using OpenVMS RMS typically contain control information.
Unless you are familiar with the structure of these files, do not attempt
to map one. The best practice is to map only those files that have been
created as the result of mapping.
2. Open the data file using a user-open routine. The user-open routine must
open the file for user I/O (as opposed to OpenVMS RMS I/O) and return the
channel number on which the file is opened.
3. Map the data file to the common block.
4. Process the records using the program variables in the common block.
5. Free the memory used by the common block, forcing modified data to be
written back to the disk file.
Do not initialize variables in a common block that you plan to map; the initial
values will be lost when SYS$CRMPSC maps the common block.
28.4.1.1 Mapping a File
The format for SYS$CRMPSC is as follows:
SYS$CRMPSC [inadr],[retadr],[acmode],[flags],[gsdnam],[ident],[relpag],
[chan], [pagcnt],[vbn],[prot],[pfc]
For a complete description of the SYS$CRMPSC system service, see the
OpenVMS System Services Reference Manual.
Starting and Ending Addresses of the Mapped Section
On VAX systems, specify the location of the first variable in the common block as
the value of the first array element of the array passed by the inadr argument.
Specify the location of the last variable in the common block as the value of the
second array element.
On Alpha systems, specify the location of the first variable in the common block
as the value of the first array element of the array passed by the inadr argument;
the second array element must be the address of the last variable in the common
block, which is derived by performing a logical OR with the value of the size of a
memory page minus 1. The size of the memory page can be retrieved by a call to
the SYS$GETSYI system service.
If the first variable in the common block is an array or string, the first variable in
the common block is the first element of that array or string. If the last variable
in the common block is an array or string, the last variable in the common block
is the last element in that array or string.
Returning the Location of the Mapped Section
On VAX systems, SYS$CRMPSC returns the location of the first and last
elements mapped in the retadr argument. The value returned as the starting
virtual address should be the same as the starting address passed to the inadr
argument. The value returned as the ending virtual address should be equal to
or slightly more than (within 512 bytes, or 1 block) the value of the ending virtual
address passed to the inadr argument.
On Alpha systems, SYS$CRMPSC returns the location of the first and last
elements mapped in the retadr argument. The value returned as the starting
virtual address should be the same as the starting address passed to the inadr
argument. The value returned as the ending virtual address should be equal to
or slightly less than (within a single page size) the value of the ending virtual
address passed to the inadr argument.
If the first element is in error, you probably forgot to page-align the common block
containing the mapped data.
If the second element is in error, you were probably creating a new data file and
forgot to specify the size of the file in your program (see Section 28.4.1.3).
Example 28–1 Mapping a Data File to the Common Block on a VAX System
!INCOME.OPT
PSECT_ATTR = INC_DATA, PAGE
INCOME.FOR
! Declare variables to hold statistics
REAL PERSONS_HOUSE (2048),
2 ADULTS_HOUSE (2048),
2 INCOME_HOUSE (2048)
INTEGER TOTAL_HOUSES
! Declare section information
! Data area
COMMON /INC_DATA/ PERSONS_HOUSE,
2 ADULTS_HOUSE,
2 INCOME_HOUSE,
2 TOTAL_HOUSES
! Addresses
INTEGER ADDR(2),
2 RET_ADDR(2)
! Section length
INTEGER SEC_LEN
! Channel
INTEGER*2 CHAN,
2 GARBAGE
COMMON /CHANNEL/ CHAN,
2 GARBAGE
! Mask values
INTEGER MASK
INCLUDE ’($SECDEF)’
! User-open routines
INTEGER UFO_OPEN,
2 UFO_CREATE
EXTERNAL UFO_OPEN,
2 UFO_CREATE
! Declare logical unit number
INTEGER STATS_LUN
! Declare status variables and values
INTEGER STATUS,
2 IOSTAT,
2 IO_OK
PARAMETER (IO_OK = 0)
INCLUDE ’($FORDEF)’
EXTERNAL INCOME_BADMAP
! Declare logical for INQUIRE statement
LOGICAL EXIST
Example 28–1 (Cont.) Mapping a Data File to the Common Block on a VAX
System
! Declare subprograms invoked as functions
INTEGER LIB$GET_LUN,
2 SYS$CRMPSC,
2 SYS$DELTVA,
2 SYS$DASSGN
! Get logical unit number for STATS.SAV
STATUS = LIB$GET_LUN (STATS_LUN)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
INQUIRE (FILE = ’STATS.SAV’,
2 EXIST = EXIST)
IF (EXIST) THEN
OPEN (UNIT=STATS_LUN,
2 FILE=’STATS.SAV’,
2 STATUS=’OLD’,
2 USEROPEN = UFO_OPEN)
MASK = SEC$M_WRT
ELSE
! If STATS.SAV does not exist, create new database
MASK = SEC$M_WRT .OR. SEC$M_DZRO
SEC_LEN =
! (address of last - address of first + size of last + 511)/512
2 ( (%LOC(TOTAL_HOUSES) - %LOC(PERSONS_HOUSE(1)) + 4 + 511)/512 )
OPEN (UNIT=STATS_LUN,
2 FILE=’STATS.SAV’,
2 STATUS=’NEW’,
2 INITIALSIZE = SEC_LEN,
2 USEROPEN = UFO_CREATE)
END IF
! Free logical unit number and map section
CLOSE (STATS_LUN)
! ********
! MAP DATA
! ********
! Specify first and last address of section
ADDR(1) = %LOC(PERSONS_HOUSE(1))
ADDR(2) = %LOC(TOTAL_HOUSES)
! Map the section
STATUS = SYS$CRMPSC (ADDR,
2 RET_ADDR,
2 ,
2 %VAL(MASK),
2 ,,,
2 %VAL(CHAN),
2 ,,,)
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
! Check for correct mapping
IF (ADDR(1) .NE. RET_ADDR (1))
2 CALL LIB$SIGNAL (%VAL (%LOC(INCOME_BADMAP)))
.
.
.
! Reference data using the
! data structures listed
! in the common block
.
.
.
! Close and update STATS.SAV
STATUS = SYS$DELTVA (RET_ADDR,,)
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
STATUS = SYS$DASSGN (%VAL(CHAN))
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
END
Example 28–1 (Cont.) Mapping a Data File to the Common Block on a VAX
System
Example 28–2 shows the code for performing the same functions as Example 28–1
but in an Alpha system’s environment.
Example 28–2 Mapping a Data File to the Common Block on an Alpha System
!INCOME.OPT
PSECT_ATTR = INC_DATA, SOLITARY, SHR, WRT
INCOME.FOR
! Declare variables to hold statistics
REAL PERSONS_HOUSE (2048),
2 ADULTS_HOUSE (2048),
2 INCOME_HOUSE (2048)
INTEGER TOTAL_HOUSES, STATUS
! Declare section information
! Data area
COMMON /INC_DATA/ PERSONS_HOUSE,
2 ADULTS_HOUSE,
2 INCOME_HOUSE,
2 TOTAL_HOUSES
! Addresses
INTEGER ADDR(2),
2 RET_ADDR(2)
! Section length
INTEGER SEC_LEN
! Channel
INTEGER*2 CHAN,
2 GARBAGE
COMMON /CHANNEL/ CHAN,
2 GARBAGE
! Mask values
INTEGER MASK
INCLUDE ’($SECDEF)’
! User-open routines
INTEGER UFO_OPEN,
2 UFO_CREATE
EXTERNAL UFO_OPEN,
2 UFO_CREATE
! Declare logical unit number
INTEGER STATS_LUN
! Declare status variables and values
INTEGER STATUS,
2 IOSTAT,
2 IO_OK
PARAMETER (IO_OK = 0)
INCLUDE ’($FORDEF)’
EXTERNAL INCOME_BADMAP
! Declare logical for INQUIRE statement
LOGICAL EXIST
! Declare subprograms invoked as functions
INTEGER LIB$GET_LUN,
2 SYS$CRMPSC,
2 SYS$DELTVA,
2 SYS$DASSGN
! Get logical unit number for STATS.SAV
STATUS = LIB$GET_LUN (STATS_LUN)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
Example 28–2 (Cont.) Mapping a Data File to the Common Block on an Alpha
System
INQUIRE (FILE = ’STATS.SAV’,
2 EXIST = EXIST)
IF (EXIST) THEN
OPEN (UNIT=STATS_LUN,
2 FILE=’STATS.SAV’,
2 STATUS=’OLD’,
2 USEROPEN = UFO_OPEN)
MASK = SEC$M_WRT
ELSE
! If STATS.SAV does not exist, create new database
MASK = SEC$M_WRT .OR. SEC$M_DZRO
SEC_LEN =
! (address of last - address of first + size of last + 511)/512
2 ( (%LOC(TOTAL_HOUSES) - %LOC(PERSONS_HOUSE(1)) + 4 + 511)/512 )
OPEN (UNIT=STATS_LUN,
2 FILE=’STATS.SAV’,
2 STATUS=’NEW’,
2 INITIALSIZE = SEC_LEN,
2 USEROPEN = UFO_CREATE)
END IF
! Free logical unit number and map section
CLOSE (STATS_LUN)
! ********
! MAP DATA
! ********
STATUS = LIB$GETSYI(SYI$_PAGE_SIZE, PAGE_MAX,,,,)
IF (.NOT. STATUS) CALL LIB$STOP (%VAL (STATUS))
! Specify first and last address of section
ADDR(1) = %LOC(PERSONS_HOUSE(1))
! Section will always be smaller than page_max bytes
ADDR(2) = ADDR(1) + PAGE_MAX -1
! Map the section
STATUS = SYS$CRMPSC (ADDR,
2 RET_ADDR,
2 ,
2 %VAL(MASK),
2 ,,,
2 %VAL(CHAN),
2 ,,,)
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
! Check for correct mapping
IF (ADDR(1) .NE. RET_ADDR (1))
2 CALL LIB$SIGNAL (%VAL (%LOC(INCOME_BADMAP)))
.
.
.
! Reference data using the
! data structures listed
! in the common block
.
.
.
! Close and update STATS.SAV
STATUS = SYS$DELTVA (RET_ADDR,,)
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
STATUS = SYS$DASSGN (%VAL(CHAN))
IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))
END
This chapter describes how to use the distributed transaction manager. It shows
you how to use DECdtm services to bind together operations on several databases
or files into a single transaction. To use DECdtm services, the resource managers
taking part in the transaction must support DECdtm. DEC Rdb for OpenVMS
Alpha, DEC Rdb for OpenVMS VAX, DEC DBMS for OpenVMS Alpha, DEC
DBMS for OpenVMS VAX, and OpenVMS RMS Journaling support DECdtm.
This chapter is divided into the following sections:
Section 29.1 gives an introduction to DECdtm services.
Section 29.2 discusses how to call DECdtm services.
Section 29.3 gives an example that shows how to use DECdtm services.
Resource Resource
Manager Application Manager
(DBMS) (Rdb/VMS)
Transaction Transaction
Resource Manager Manager Resource
ZK−4771A−GE
This example contains numbered callouts, which are explained after the program
listing.
C
C This program assumes that the files DECDTM$EXAMPLE1.FILE_1 and
C DECDTM$EXAMPLE1.FILE_2 are created and marked for recovery unit
C journaling using the command file SYS$EXAMPLES:DECDTM$EXAMPLE1.COM
C
C To run this example, enter the following:
C $ FORTRAN SYS$EXAMPLES:DECDTM$EXAMPLE1
C $ LINK DECDTM$EXAMPLE1
C $ @SYS$EXAMPLES:DECDTM$EXAMPLE1
C $ RUN DECDTM$EXAMPLE1
C
C SYS$EXAMPLES also contains an example C application, DECDTM$EXAMPLE2.C
C The C application performs the same operations as this Fortran example.
C
IMPLICIT NONE
INCLUDE ’($SSDEF)’
INCLUDE ’($FORIOSDEF)’
CHARACTER*12 STRING
INTEGER*2 IOSB(4)
INTEGER*4 STATUS,COUNT,TID(4)
INTEGER*4 SYS$START_TRANSW,SYS$END_TRANSW,SYS$ABORT_TRANSW
EXTERNAL SYS$START_TRANSW,SYS$END_TRANSW,SYS$ABORT_TRANSW
EXTERNAL JOURNAL_OPEN
C
C Open the two files
C
! OPEN (UNIT = 10, FILE = ’DECDTM$EXAMPLE1.FILE_1’, STATUS = ’OLD’,
1 ACCESS = ’DIRECT’, RECL = 3, USEROPEN = JOURNAL_OPEN)
OPEN (UNIT = 11, FILE = ’DECDTM$EXAMPLE1.FILE_2’, STATUS = ’OLD’,
1 ACCESS = ’DIRECT’, RECL = 3, USEROPEN = JOURNAL_OPEN)
COUNT = 0
TYPE *, ’Running DECdtm example program’
TYPE *, ’Press CTRL-Y to interrupt’
C
C Loop forever, updating both files under transaction control
C
DO WHILE (.TRUE.)
C
C Update the count and convert it to ASCII
C
" COUNT = COUNT + 1
ENCODE (12,8000,STRING) COUNT
8000 FORMAT (I12)
C
C Start the transaction
C
# STATUS = SYS$START_TRANSW (%VAL(1),,IOSB,,,TID)
IF (STATUS .NE. SS$_NORMAL .OR. IOSB(1) .NE. SS$_NORMAL) GO TO 9040
C
C Update the record in each file
C
$ WRITE (UNIT = 10, REC = 1, ERR = 9000, IOSTAT = STATUS) STRING
WRITE (UNIT = 11, REC = 1, ERR = 9010, IOSTAT = STATUS) STRING
C
C Attempt to commit the transaction
C
% STATUS = SYS$END_TRANSW (%VAL(1),,IOSB,,,TID)
IF (STATUS .NE. SS$_NORMAL .OR. IOSB(1) .NE. SS$_NORMAL) GO TO 9050
END DO
C
C Errors that should cause the transaction to abort
C
&
9000 TYPE *, ’Failed to update DECDTM$EXAMPLE1.FILE_1’
GO TO 9020
9010 TYPE *, ’Failed to update DECDTM$EXAMPLE1.FILE_2’
9020 STATUS = SYS$ABORT_TRANSW (%VAL(1),,IOSB,,,TID)
IF (STATUS .NE. SS$_NORMAL .OR. IOSB(1) .NE. SS$_NORMAL) GO TO 9060
STOP
C
C Errors from DECdtm system services
C
9040 TYPE *, ’Unable to start a transaction’
GO TO 9070
9050 TYPE *, ’Failed to commit the transaction’
GO TO 9070
9060 TYPE *, ’Failed to abort the transaction’
9070 TYPE *, ’Status = ’, STATUS, ’ IOSB = ’, IOSB(1)
END
C
C Switch off TRUNCATE access and PUT with truncate on OPEN for RU Journaling
C
INTEGER FUNCTION JOURNAL_OPEN (FAB, RAB, LUN)
INCLUDE ’($FABDEF)’
INCLUDE ’($RABDEF)’
INCLUDE ’($SYSSRVNAM)’
RECORD /FABDEF/ FAB, /RABDEF/ RAB
FAB.FAB$B_FAC = FAB.FAB$B_FAC .AND. .NOT. FAB$M_TRN
RAB.RAB$L_ROP = RAB.RAB$L_ROP .AND. .NOT. RAB$M_TPT
JOURNAL_OPEN = SYS$OPEN (FAB)
IF (.NOT. JOURNAL_OPEN) RETURN
JOURNAL_OPEN = SYS$CONNECT (RAB)
RETURN
END
! The application opens DECDTM$EXAMPLE1.FILE1 and
DECDTM$EXAMPLE1.FILE2 for writing. It then zeroes the variable
COUNT and enters an infinite loop.
" The application increments the count by one and converts it to an ASCII
string.
# The application calls SYS$START_TRANSW to start a transaction. The
application checks the immediate return status and service completion status
to see whether they signify an error.
$ The application attempts to write the string to the two files. If it cannot,
the application aborts the transaction. Because the files are OpenVMS RMS
journaled files, the default transaction is assumed.
% The application calls SYS$END_TRANSW to attempt to commit the
transaction. It checks the immediate return status and service completion
status to see whether they signify an error. If they do, the application reports
the error and exits. If there are no errors, the transaction is committed and
the application continues with the loop.
& If either of the two files could not be updated, the application calls
SYS$ABORT_TRANSW to abort the transaction. It checks the immediate
return status and service completion status to see whether they signify an
error. If they do, the application reports the error and exits.
This chapter describes how to create user-written system services. It contains the
following sections:
Section 30.1 describes privileged routines and privileged shareable images.
Section 30.2 describes how to write a privileged routine.
Section 30.3 describes how to create a privileged shareable image on VAX
systems.
Section 30.4 describes how to create a privileged shareable image on Alpha
systems.
30.1 Overview
Your application may contain certain routines that perform privileged functions,
called user-written system services. To create these routines, put them in
a privileged shareable image. User-mode routines in other modules can call
the routines in the privileged shareable image to perform functions in a more
privileged mode.
You create a privileged shareable image as you would any other shareable image,
using the /SHAREABLE qualifier with the linker. (For more information about
how to create a shareable image, see the OpenVMS Linker Utility Manual.)
However, because a call to a routine in a more privileged mode must be vectored
through the system service dispatch routine, you must perform some additional
steps. The following steps outline the basic procedure. Section 30.3 provides
more detail about requirements specific to VAX systems. Section 30.4 describes
the necessary steps for Alpha systems.
1. Create the source file. The source file for a privileged shareable image
contains the routines that perform privileged functions. In addition, because
user-written system services are called using the system service dispatcher,
you must include a privileged library vector (PLV) in your shareable image.
A PLV is an operating-system-defined data structure that communicates the
location of the privileged routines to the operating system.
On VAX systems, the PLV contains the addresses of dispatch routines for
each access mode used in the image. You must write these dispatch routines
and include them in your shareable image. Section 30.3.1 provides more
information.
On Alpha systems, you list the names of the privileged routines in the PLV,
sorted by access mode. You do not need to create dispatch routines; the image
activator creates them for you automatically.
Section 30.2 provides guidelines for creating privileged routines.
2. Compile or assemble the source file.
3. Create the shareable image. You create a privileged shareable image as you
would any other shareable image: by specifying the /SHAREABLE qualifier
to the LINK command. Note, however, that creating privileged shareable
images has some additional requirements. The following list summarizes
these requirements. See the OpenVMS Linker Utility Manual for additional
information about linker qualifiers and options.
• Declare the privileged routine entry points as universal symbols.
Privileged shareable images use the same mechanisms to declare
universal symbols as other shareable images: transfer vectors on VAX
and symbol vectors on Alpha systems. However, because calls to user-
written system services must be vectored through the system service
dispatcher, you must use extensions to these mechanisms for privileged
shareable images. Section 30.3.3 describes how to declare a universal
symbol in a VAX privileged shareable image. Section 30.4.2 describes how
to declare a universal symbol in an Alpha system privileged shareable
image.
• Prevent the linker from processing the system default shareable image
library, SYS$LIBRARY:IMAGELIB.OLB, by specifying the /NOSYSSHR
linker qualifier. Otherwise, the linker processes this library by default.
• Protect the shareable image from user-mode access by specifying the
/PROTECT linker qualifier. If you want to protect only certain portions
of the shareable image, instead of the entire image, use the PROTECT=
linker option.
• Set the VEC attribute of the program section containing the PLV by
using the PSECT_ATTR= linker option. Modules written in MACRO can
specify this attribute in the .PSECT directive. The PLV must appear in a
program section with the VEC attribute set.
• Set the shareable image identification numbers using the GSMATCH=
option.
If your privileged application requires that you link against the system
executive, see the OpenVMS Linker Utility Manual for more information.
4. Install the privileged shareable image as a protected permanent global
section. Privileged shareable images must be installed to be available to
nonprivileged programs. The following procedure is recommended:
a. Move the privileged shareable image to a protected directory, such as
SYS$SHARE.
b. Invoke the Install utility, specifying the /PROTECT, /OPEN, and
/SHARED qualifiers. You can also specify the /HEADER_RESIDENT
qualifier. The following entry could be used to install a user-written
system service whose image name is MY_PRIV_SHARE:
$ INSTALL
INSTALL> ADD SYS$SHARE:MY_PRIV_SHARE/PROTECT/OPEN/SHARED/HEADER_RES
To use a privileged shareable image, you include it in a link operation as you
would any other shareable image: specifying the shareable image in a linker
options file with the /SHAREABLE qualifier appended to the file specification to
identify it as a shareable image.
• When a protected subsystem opens a file on its own behalf, it should specify
executive-mode logical names only by naming executive mode explicitly in the
FAB$V_LNM_MODE subfield of the file access block (FAB). This prevents a
user’s logical name from redirecting a file specification.
On VAX systems, refer to SYS$EXAMPLES:USSDISP.MAR and USSTEST.MAR
for listings of modules in a user-written system service and of a module that calls
the user-written system service.
On Alpha systems, for C examples refer to SYS$EXAMPLES:UWSS.C and
SYS$EXAMPLES:UWSS_TEST.C.
Note
Users of your privileged shareable image must specify the same code
number to identify a privileged routine as you used to identify it in the
dispatch routine. Users specify the code number in their CHMK or CHME
instruction. See Section 30.3.3 for information about transfer vectors.
In your source file, a dispatch routine must precede the routines that implement
the user-written system service.
Example 30–1 illustrates a sample dispatching routine, taken from the sample
privileged shareable image in SYS$EXAMPLES named USSDISP.MAR.
The image activator has already placed at this location the address of whatever
user-written dispatch routines it found in the privileged shareable image’s PLV
when it activated the PLV. The dispatch routine transfers control to the routine in
the shareable image identified by the code. (You must ensure that the code used
in the transfer vector and the code specified in the dispatch routine both identify
the same routine.) Figure 30–1 illustrates this flow of control.
my_share_k_dispatcher:
my_share_e_dispatcher:
OpenVMS Common
Exit Path
my_serv_int:
SRVEXIT:
return
REI:
JSB my_share_k_dispatcher
JSB my_share_e_dispatcher
ZK−5071A−GE
Figure 30–2 shows the components of the PLV in VAX shareable images.
31 0
Reserved
Kernel−Mode Dispatcher
Executive−Mode Entry
Reserved
RMS Dispatcher
Address Check
ZK−5401A−GE
Table 30–1 describes each field in the PLV on a VAX processor, including the
symbolic names the operating system defines to access each field. These names
are defined by the $PLVDEF macro in SYS$LIBRARY:STARLET.MLB.
! The sample program sets the VEC attribute of the program section containing
the PLV.
" Values are assigned to each field of the PLV.
PLV
KERNEL_ROUTINE_LIST
.ADDRESS K_RTN2_INT
Linkage Section
K_RTN1_INT::
; service−specific procedure
BASE/CMOD_TABLE
K_RTN2_INT:: CMOD_TABLE_END
; service−specific procedure
PLV_LIST APLD
MAXCODE=65,536*2
K_RTN1_EXT::
BIS SP,R31,R28
LDAH R0,1(R31)
CALL_PAL CHMK
RET
K_RTN2_EXT::
BIS SP,R31,R28
LDAH R0,2(R31)
CALL_PAL CHMK
RET
ZK−5910A−GE
Table 30–2 describes the components of the privileged library vector on Alpha
systems.
This chapter describes the security system services that provide various
mechanisms to enhance the security of operating systems. It contains the
following sections:
Section 31.1 provides an overview of the protection scheme.
Section 31.2 describes identifiers and how they are used in security.
Section 31.3 describes the rights database.
Section 31.4 describes the persona and per-thread security features.
Section 31.5 describes how to create, translate, and maintain access control
entries (ACEs).
Section 31.6 describes protected subsystems.
Section 31.7 describes security auditing.
Section 31.8 describes how to determine a user’s access to an object.
Section 31.9 describes SYS$CHECK_PRIVILEGE system service.
Section 31.10 describes how to implement site-specific security policies.
Access Protection
When a process without special privileges attempts to access an object (protected
by an ACL) in the system, the operating system uses the rights list when
performing a protection check. The system compares the identifiers in the rights
list to the protection attributes of the object and grants or denies access to the
object based on the comparison. In other words, the entries in the rights list
do not specifically grant access; instead, the system uses them to perform a
protection check when the process attempts to access an object.
Access Control Lists
The protection scheme provides security with the mechanism of the access control
list (ACL). An ACL consists of access control entries (ACEs) that specify the
type of access an identifier has to an object like a file, device, or queue. When a
process attempts to access an object with an associated ACL, the system grants
or denies access based on whether an exact match for the identifier in the ACL
exists in the process rights list.
The following sections describe each of the components of the security scheme—
identifiers, rights database, process and system rights lists, protection codes, and
ACLs—and the system services affecting those components.
31.2 Identifiers
The basic component of the protection scheme is an identifier. An identifier
represents various types of agents using the system. The types of agents
represented include individual users, groups of users, and environments in which
a process is operating. Identifiers and their attributes apply to both processes
and objects. An identifier name consists of 1 to 31 alphanumeric characters
with no embedded blanks and must contain at least one nonnumeric character. It
can include the uppercase letters A through Z, dollar signs ( $ ), and underscores
( _ ), as well as the numbers 0 through 9. Any lowercase letters are automatically
converted to uppercase.
31 27 0
ZK−5908A−GE
You define identifiers and their holders in the rights database with the Authorize
utility or with the appropriate system services. Each user can hold multiple
identifiers. This allows you to create a different kind of group designation from
the one used with the user’s UIC.
The alternative grouping described here permits each user to be a member of
multiple overlapping groups. Access control lists (ACLs) define the access to
protected objects based on the identifiers the user holds rather than on the user’s
UIC. See Section 31.5.3.1 for information on creating ACLs.
You can also define identifiers to represent particular terminals, times of day, or
other site-specific environmental attributes. These identifiers are not given holder
records in the rights database but may be granted to users by customer-written
privileged software. This feature of the security system allows each site flexibility
and, because the identifiers can be specific to the site, enhanced security. For a
programming example demonstrating this technique, see Section 31.3.2.4. For
more information, also see the OpenVMS Guide to System Security.
31 27 16 15 0
ZK−5907A−GE
Bits <27:16> and <15:0> designate a group field and member field. Group
numbers range from 1 through 16,382; member numbers range from 0 through
65,534.
31 27 16 15 0
ZK−5909A−GE
$ MCR SYSMAN
SYSMAN> DISKQUOTA CREATE/DEVICE=DKB0:
SYSMAN> DISKQUOTA MODIFY/DEVICE=DKB0: PHYSICS /PERMQUOTA=150000 -
_SYSMAN> /OVERDRAFT=5000
SYSMAN> EXIT
• Create the common library and assign the identifier PHYSICS using the
run-time library routine LIB$CREATE_DIR.
• Grant the identifier PHYSICS to holders FRED, a faculty member, and
GEORGE, a student, using the SYS$ADD_HOLDER service.
If you specify the Resource attribute for identifier FRED, he can charge disk
resources to the PHYSICS identifier; if you do not specify the Resource attribute
for identifier GEORGE, he will not inherit the Resource attribute associated
with the identifier PHYSICS and cannot charge disk resources to the PHYSICS
identifier. The following input file, USERLIST.DAT, contains valid UIC identifiers
of students and faculty members:
FRED NORESOURCE
GEORGE RESOURCE
NANCY NORESOURCE
HAROLD RESOURCE
SUSAN RESOURCE
CHERYL NORESOURCE
MARVIN NORESOURCE
The following program reads USERLIST.DAT and associates the UIC identifiers
with the identifier PHYSICS:
#include <stdio.h>
#include <descrip.h>
#include <ssdef.h>
#include <lib$routines.h>
#include <kgbdef.h>
#include <nam.h>
#include <string.h>
#include <stdlib.h>
#define IDENT_LEN 31
#define NO_ATTR 0
#define RESOURCE 1
#define NORESOURCE 0
unsigned int sys$asctoid(),
sys$add_ident(),
sys$add_holder(),
sys$idtoasc(),
convert_id( struct dsc$descriptor_s, unsigned int );
void add_holder( unsigned int, unsigned int, unsigned int);
struct {
unsigned int uic;
unsigned int terminator;
}holder;
static char ascii_ident[IDENT_LEN],
abuffer[IDENT_LEN],
dirbuf[NAM$C_MAXRSS],
targbuf[IDENT_LEN];
$DESCRIPTOR(target,targbuf);
unsigned int status;
main() {
FILE *ptr;
char attr[11];
unsigned int owner_uic, attrib, resid, bin_id;
$DESCRIPTOR(dirspec,dirbuf);
$DESCRIPTOR(aident, abuffer);
printf("\nEnter directory spec: ");
gets(dirbuf);
dirspec.dsc$w_length = strlen(dirbuf);
printf("\nEnter its owner identifier: ");
gets(targbuf);
target.dsc$w_length = strlen(targbuf);
int i;
$DESCRIPTOR(nambuf, ascii_ident);
holder.uic = bin_id;
holder.terminator = 0;
status = sys$add_holder( resid, &holder, attrib);
if((status & 1) != SS$_NORMAL)
lib$signal( status );
else {
status = sys$idtoasc(bin_id, 0, &nambuf, 0, 0, 0);
if((status & 1) != SS$_NORMAL)
lib$signal( status );
/* Remove padding */
nambuf.dsc$w_length = strlen(ascii_ident);
for(i=0;i < nambuf.dsc$w_length + 1; i++)
if (ascii_ident[i] == 0x20)
ascii_ident[i] = ’\0’;
printf("\nAdding holder %s to target identifier %s...\n", \
nambuf.dsc$a_pointer,target.dsc$a_pointer);
}
}
Identifier Value
Attributes
Identifier Name
Identifier Name
Identifier Name
Identifier Name
ZK−1904−GE
One holder record exists in the rights database for each holder of each identifier.
The holder record associates the holder with the identifier, specifies the attributes
of the holder, and identifies the UIC identifier of the holder. Figure 31–5 depicts
the format of the holder record.
Identifier Value
Attributes
(Reserved)
(Reserved)
(Reserved)
(Reserved)
ZK−1907−GE
The rights database is an indexed file with three keys. The primary key is the
identifier value, the secondary key is the holder ID, and the tertiary key is the
identifier name. Through the use of the secondary key of the holder ID, all the
identifiers held by a process can be retrieved quickly when the system creates the
process’s rights list.
The following table shows what access you need for which services:
1 On VAX systems, read access is required when certain restrictions are present (for example, if the
identifiers have the name hidden or holder hidden attributes).
integer STATUS
*
* Initialization
*
NAME_DSC(2) = %loc(NAME)
STATUS = %loc(SS$_NORMAL)
*
* Scan through the entire RDB ...
*
do while (STATUS .and. (STATUS .ne. %loc(SS$_NOSUCHID)))
STATUS = SYS$IDTOASC(%val(ID), LENGTH, NAME_DSC,
+ IDENTIFIER, ATTRIBUTES, CONTEXT)
if (STATUS .and. (STATUS .ne. %loc(SS$_NOSUCHID))) then
NAME(LENGTH+1:LENGTH+1) = ’,’
print 1, NAME, IDENTIFIER, ATTRIBUTES
1 format(1X,’Name: ’,A31,’ Id: ’,Z8,’, Attributes: ’,Z8)
end if
end do
*
* Do we need to finish the RDB ???
*
if (STATUS .ne. %loc(SS$_NOSUCHID)) then
call SYS$FINISH_RDB(CONTEXT)
end if
end
31.3.2.2 Adding Identifiers and Holders to the Rights Database
To add identifiers to the rights database, use the SYS$ADD_IDENT service in a
program. When you call SYS$ADD_IDENT, use the name argument to pass the
identifier name you want to add. You can specify an identifier value with the id
argument; however, if you do not specify a value, the system selects an identifier
value from the general identifier space.
In addition to defining the identifier value and identifier name, you use
SYS$ADD_IDENT to specify attributes in the identifier record. Attributes are
enabled for a holder of an identifier only when they are set in both the identifier
record and the holder record. The attrib argument is a longword containing a bit
mask specifying the attributes. The symbol KGB$V_RESOURCE, defined in the
system macro library $KGBDEF, sets the Resource bit in the attribute longword,
and the symbol KGB$V_DYNAMIC sets the Dynamic bit. (You can use the prefix
KGB$M rather than KGB$V.) See the description of SYS$ADD_IDENT in the
OpenVMS System Services Reference Manual for a complete list of symbols.
When SYS$ADD_IDENT successfully completes execution, a new identifier record
containing the identifier value, the identifier name, and the attributes of the
identifier exists in the rights database.
When the identifier record exists in the rights database, you define the holders of
that identifier with the SYS$ADD_HOLDER system service. You pass the binary
identifier value with the id argument and you specify the holder with the holder
argument, which is the address of a quadword data structure in the following
format. Figure 31–6 shows the format of the holder argument.
31 0
UIC identifier of holder
ZK−1903−GE
In the rights database, the holder identifier is in UIC format. You specify the
attributes of the holder with the attrib argument in the same manner as with
SYS$ADD_IDENT.
After SYS$ADD_HOLDER completes execution, a new holder record containing
the binary value of the identifier that the holder holds, the attributes of the
holder, and the UIC of the holder exists in the rights database.
31.3.2.3 Determining Holders of Identifiers
To determine the holders of a particular identifier, use the SYS$FIND_HOLDER
service in a program. When you call SYS$FIND_HOLDER, use the id argument
to pass the binary value of the identifier whose holder you want to determine. On
successful execution, SYS$FIND_HOLDER returns the holder identifier with the
holder argument and the attributes of the holder with the attrib argument.
You can identify all of the identifier’s holders by initializing the context
argument to 0 and repeatedly calling SYS$FIND_HOLDER, as detailed in
Section 31.3.3. Because SYS$FIND_HOLDER identifies the records by the same
key (holder ID), it returns the records in the order in which they were written.
31.3.2.4 Determining Identifiers Held by a Holder
To determine the identifiers held by a holder, use the SYS$FIND_HELD service
in a program. When you call SYS$FIND_HELD, use the holder argument to
specify the holder whose identifier is to be found.
On successful execution, SYS$FIND_HELD returns the identifier’s binary
identifier value and attributes.
You can identify all the identifiers held by the specified holder by initializing the
context argument to 0 and repeatedly calling SYS$FIND_HELD, as detailed in
Section 31.3.3. Because SYS$FIND_HELD identifies the records by the same key
(identifier), it returns the records in the order in which they were written.
31.3.2.5 Modifying the Identifier Record
To modify an identifier record by changing the identifier’s name, value, or
attributes, or all three in the rights database, use the SYS$MOD_IDENT service
in a program. Use the id argument to pass the binary value of the identifier
whose record you want to modify. To enable attributes, use the set_attrib
argument, which is a longword containing a bit mask specifying the attributes.
The symbol KGB$V_RESOURCE, defined in the system macro library $KGBDEF,
sets the Resource bit in the attribute longword. The symbol KGB$V_DYNAMIC
sets the Dynamic bit. (You can use the prefix KGB$M rather than KGB$V.) See
the description of SYS$MOD_IDENT in the OpenVMS System Services Reference
Manual for a complete list of symbols.
If you want to disable the attributes for the identifier, use the clr_attrib
argument, which is a longword containing a bit mask specifying the attributes.
If the same attribute is specified in set_attrib and clr_attrib, the attribute is
enabled.
You can also change the identifier name, value, or both with the new_name and
new_value arguments. The new_name argument is the address of a descriptor
pointing to the identifier name string; new_value is a longword containing the
binary identifier value. If you change the value of an identifier that is the holder
of other identifiers (a UIC, for example), SYS$MOD_IDENT updates all the
corresponding holder records with the new holder identifier value.
When SYS$MOD_IDENT successfully completes execution, a new identifier
record containing the identifier value, the identifier name, and the attributes of
the identifier exists in the rights database.
31.3.2.6 Modifying a Holder Record
To modify a holder record, use the SYS$MOD_HOLDER service in a program.
When you call SYS$MOD_HOLDER, use the id argument and the holder
argument to pass the binary identifier value and the UIC holder identifier whose
holder record you want to modify.
Use the SYS$MOD_HOLDER service to enable or disable the attributes of an
identifier in the same way as with SYS$MOD_HOLDER.
When SYS$MOD_HOLDER completes execution, a new holder record containing
the identifier value, the identifier name, and the attributes of the identifier exists
in the rights database.
The following programming example uses SYS$MOD_HOLDER to modify holder
records in the rights database:
Program MOD_HOLDER
*
* Modify the attributes of all the holders of identifiers to reflect
* the current attribute setting of the identifiers themselves.
*
external SS$_NOSUCHID
parameter KGB$M_RESOURCE = 1, KGB$M_DYNAMIC = 2
integer SYS$IDTOASC, SYS$FIND_HELD, SYS$MOD_HOLDER
*
* Store information about the holder here.
*
integer HOLDER(2)/2*0/
equivalence (HOLDER(1), HOLDER_ID)
integer HOLDER_NAME(2)/31, 0/
integer HOLDER_ID, HOLDER_CTX/0/
character*31 HOLDER_STRING
*
* Store attributes here.
*
integer OLD_ATTR, NEW_ATTR, ID_ATTR, CONTEXT
*
* Store information about the identifier here.
*
integer IDENTIFIER, ID_NAME(2)/31, 0/
character*31 ID_STRING
integer STATUS
*
* Initialize the descriptors.
*
HOLDER_NAME(2) = %loc(HOLDER_STRING)
ID_NAME(2) = %loc(ID_STRING)
*
* Scan through all the identifiers.
*
do while
+ (SYS$IDTOASC(%val(-1),, HOLDER_NAME, HOLDER_ID,, HOLDER_CTX)
+ .ne. %loc(SS$_NOSUCHID))
*
* Test all the identifiers held by this identifier (our HOLDER).
*
if (HOLDER_ID .le. 0) go to 2
CONTEXT = 0
do while
+ (SYS$FIND_HELD(HOLDER, IDENTIFIER, OLD_ATTR, CONTEXT)
+ .ne. %loc(SS$_NOSUCHID))
*
* Get name and attributes of held identifier.
*
STATUS = SYS$IDTOASC(%val(IDENTIFIER),, ID_NAME,, ID_ATTR,)
*
* Modify the holder record to reflect the state of the identifier itself.
*
if ((ID_ATTR .and. KGB$M_RESOURCE) .ne. 0) then
STATUS = SYS$MOD_HOLDER
+ (%val(IDENTIFIER), HOLDER, %val(KGB$M_RESOURCE),)
NEW_ATTR = OLD_ATTR .or. KGB$M_RESOURCE
else
STATUS = SYS$MOD_HOLDER
+ (%val(IDENTIFIER), HOLDER,, %val(KGB$M_RESOURCE))
NEW_ATTR = OLD_ATTR .and. (.not. KGB$M_RESOURCE)
end if
if ((ID_ATTR .and. KGB$M_DYNAMIC) .ne. 0) then
STATUS = SYS$MOD_HOLDER
+ (%val(IDENTIFIER), HOLDER, %val(KGB$M_DYNAMIC),)
NEW_ATTR = OLD_ATTR .or. KGB$M_DYNAMIC
else
STATUS = SYS$MOD_HOLDER
+ (%val(IDENTIFIER), HOLDER,, %val(KGB$M_DYNAMIC))
NEW_ATTR = OLD_ATTR .and. (.not. KGB$M_DYNAMIC)
end if
*
* Was it successful?
*
if (.not. STATUS) then
NEW_ATTR = OLD_ATTR
call LIB$SIGNAL(%val(STATUS))
end if
*
* Report it all.
*
ID,
ID_LENGTH,
ID_CONTEXT: initial(0),
HOLDER,
LENGTH,
CONTEXT: initial(0),
ATTRIBS,
VALUE,
LINE_: block[DSC$K_S_BLN, byte]
preset( [DSC$B_CLASS] = DSC$K_CLASS_S,
[DSC$A_POINTER] = LINE_BUFFER );
!
! To check for existence of an ID or HOLDER
!
macro CHECK(EXPRESSION) =
(STATUS = %remove(EXPRESSION)) and (.STATUS neq SS$_NOSUCHID) %;
!
! List all the identifiers, which have holders, with their holders.
!
routine MAIN =
begin
!
! Examine all IDs (-1).
!
while
CHECK(<SYS$IDTOASC(-1, ID_LENGTH, ID_NAME, ID, ATTRIBS, ID_CONTEXT)>)
do
begin
CONTEXT = 0;
!
! Find all holders of ID.
!
while CHECK(<SYS$FIND_HOLDER(.ID, HOLDER, ATTRIBS, CONTEXT)>) do
begin
!
! Translate the HOLDER to find its NAME.
!
SYS$IDTOASC(.HOLDER, LENGTH, NAME, VALUE, ATTRIBS, 0);
!
! Print a message reporting ID and HOLDER.
!
SYS$FAO( %ascid’Id: !AD, Holder: !AD’,
LINE_[DSC$W_LENGTH], LINE,
.ID_LENGTH, .ID_NAME[DSC$A_POINTER],
.LENGTH, .NAME[DSC$A_POINTER] );
LIB$PUT_OUTPUT(LINE_);
end;
end;
return SS$_NORMAL;
end;
end
eludom
1
Earlier versions of OpenVMS contained base support for the persona. The base
support was provided by the SYS$PERSONA_CREATE, SYS$PERSONA_ASSUME, and
SYS$PERSON_DELETE system services. VAX support is limited to these base services.
Generic
Security Profile
(ARB, PCB, JIB, ...)
Profile
Execution
ZK−9134A−GE
Modifications that are made to the security profile by one thread are potentially
visible to other threads, depending on two key factors:
• Whether multiple threads can truly execute simultaneously
• How the threads perform profile management among themselves
31.4.2.2 Per-Thread Security Model
With OpenVMS Version 7.2, the users’ security profile (that is, their privileges,
rights, and identifier information) is shifted from the process level to the user
thread level. The security information previously stored in several structures,
including the Access Rights Block (ARB), the Process Control Block (PCB), the
Process Header Descriptor (PHD), the Job Information Block (JIB), and the
Control (CTL) region fields, has moved to the new Persona Security Block (PSB)
data structure.
Each thread of execution can share a security profile with other threads or have a
thread-specific security profile. Figure 31–8 shows these relationships.
Profile
Execution
ZK−9135A−GE
As is the case with the previous model, modifications to a shared profile are
potentially visible to all threads that share the profile. However, modifications
made to a thread-specific profile are only applicable to the particular thread.
For more information about per-thread security, see the OpenVMS Guide to
System Security.
generally useful PXB values (for example, principal name and domain) can be
used to fetch these values without concern for the extension-specific name.
ACE Description
Alarm Sets an alarm
Application Contains application-dependent information
Audit Sets a security audit
Creator Controls access to an object based on creators
Default Protection Specifies the default protection for all files and subdirectories
created in the directory
Identifier Controls the type of access allowed based on identifiers
Subsystem Maintains protected subsystems
For information about the structure of specific types of ACEs, see the
SYS$FORMAT_ACL system service in OpenVMS System Services Reference
Manual.
Service Description
SYS$FORMAT_ACL Converts an ACE from binary format to ASCII text
SYS$GET_SECURITY Retrieves the security characteristics of an object
SYS$PARSE_ACL Converts an ACE from ASCII text to binary format
SYS$SET_SECURITY Modifies the security characteristics of a protected
object
Subsystem Security
During the execution of a protected subsystem, $IMGACT adds subsystem
identifiers to the image rights list. What happens if the user presses the Ctrl/Y
key sequence during execution? Will the user retain whatever privileges were
granted by the subsystem? If the user presses Ctrl/Y, image identifiers are
removed from the process. Also, subprocesses do not inherit image identifiers
by default. However, SYS$CREPRC and LIB$SPAWN do contain flags PRC$M_
SUBSYSTEM and SUBSYSTEM, respectively, that allow subprocesses to inherit
image identifiers.
Service Description
SYS$AUDIT_EVENT Appends an event message to the system audit log file
or sends an alarm to a security operator terminal
SYS$CHECK_PRIVILEGE Determines whether the caller has the specified
privileges or identifiers
Service Description
SYS$CHECK_ACCESS Invokes a system access protection check on behalf of
another user
SYS$CHKPRO Invokes a system access protection check
31.9 SYS$CHECK_PRIVILEGE
The SYS$CHECK_PRIVILEGE system service determines whether the caller
has the specified privileges or identifiers. The service performs the privilege
check and looks at the SET AUDIT settings to determine whether the system
administrator enabled privilege auditing. When privilege auditing is enabled,
SYS$CHECK_PRIVILEGE generates an audit record. The audit record identifies
the process (subject) and privilege involved, provides the result of the privilege
check, and lists supplemental event information supplied by its caller. Privilege
audit records usually contain either the DCL command line or the system service
name associated with the privilege check.
SYS$CHECK_PRIVILEGE completes asynchronously; that is, it does not wait for
final status. For synchronous completion, use the SYS$CHECK_PRIVILEGEW
service.
Service Description
SYS$ERAPAT Generates a security erasure pattern
SYS$MTACCESS Controls magnetic tape access
SYS$HASH_PASSWORD Applies a hash algorithm to an ASCII password
When you create the system service, you code the source module and define the
vector offsets, the entry point, and the program sections for the system service.
Then, you can assemble and link the module to create a loadable image.
Once you have created the loadable image, you install it. First, you copy the
image into the SYS$LOADABLE_IMAGES directory and add an entry for it
in the operating system’s images file using the System Management utility
(SYSMAN). Next, you invoke the system images command procedure to generate
a new system image data file. Finally, you reboot the system to load your service.
The following sections describe how to create and load the the Get Security Erase
Pattern (SYS$ERAPAT) system service.
On VAX only systems, you can find an example of the SYS$ERAPAT system
service in SYS$EXAMPLES:DOD_ERAPAT.MAR on the operating system. The
description here also applies to the Hash Password (SYS$HASH_PASSWORD)
and Magnetic Tape Accessibility (SYS$MTACCESS) system services. You can find
3. To make the changes permanent, add the INSTALL command from step 1
to the SYS$SYSTEM:SYSTARTUP_VMS.COM file and modify the system
parameter file, MODPARAMS.DAT, so that the LOAD_PWD_POLICY
parameter is set to 1.
4. Run AUTOGEN as follows to ensure that the system parameters are set
correctly on subsequent system startups:
$ @SYS$UPDATE:AUTOGEN SAVPARAMS SETPARAMS
This chapter describes how to create and use logical names and logical name
tables. It contains the following sections:
Section 32.1 describes how to use logical name system services and DCL
commands, how to use logical and equivalence names, and how to use logical
name tables.
Section 32.2 describes how to create user-defined and clusterwide logical name
tables.
Section 32.3 describes how to check access and protection of logical names and
logical name tables.
Section 32.4 describes how to specify access modes of a logical name.
Section 32.5 describes how to translate logical names.
Section 32.6 describes how to specify attributes.
Section 32.7 describes how to establish logical name table quotas.
Section 32.8 describes interprocess communication.
Section 32.9 describes the format convention for logical names and equivalence
names.
Section 32.10 describes how to use logical name and logical name tables system
services with example programs.
Besides using logical name system services, you can use DCL commands to create
and manipulate logical names and logical name tables. Table 32–1 lists the
operating system’s logical name system services and equivalent DCL commands.
As the names of the logical name system services imply, when you use the logical
name system services, you are concerned with creating, deleting, and translating
logical names and with creating and deleting logical name tables.
The following sections describe various concepts you should be aware of when you
use the logical name system services. For further discussion of logical names, see
the OpenVMS User’s Manual.
Logical names and their equivalence strings are stored in logical name tables.
Logical names can have a maximum length of 255 characters. Equivalence
strings can have a maximum of 255 characters. You can establish logical name
and equivalence string pairs as follows:
• At the command level, with the DCL commands ALLOCATE, ASSIGN,
DEFINE, or MOUNT
• In a program, with the Create Logical Name (SYS$CRELNM), Create Mailbox
and Assign Channel (SYS$CREMBX), or Mount Volume (SYS$MOUNT)
system service
For example, you could use the symbolic name TERMINAL to refer to an output
terminal in a program. For a particular run of the program, you could use the
DEFINE command to establish the equivalence name TTA2.
To create a logical name in a program, you must define character-string
descriptors for the name strings and call the system service within your program.
Logical names other than logical name table names can exist within these tables,
but are strongly discouraged. The length of the logical names and table names
created in either of these tables must not exceed 31 characters. Logical table
names and logical names created in the directory tables must consist of uppercase
alphanumeric characters, dollar signs ( $ ), and underscores ( _ ). Equivalence
strings must not exceed 255 characters.
32.1.2.2 Process, Job, Group, System and Clusterwide Default Logical Name Tables
OpenVMS creates a number of logical name tables automatically, some at system
initialization and some at process creation. Some of these tables are accessible to
all processes, and some are accessible only to selected processes. These tables are
called the default logical name tables.
Each default logical name table has a logical name associated with it in addition
to its table name. The default logical name table names and the common logical
names used to refer to them are as follows:
The length of the logical names created in these tables cannot exceed 255
characters, with no restriction on the types of characters used. Equivalence
strings cannot exceed 255 characters. By convention, a Compaq-created logical
name begins with a facility-specific prefix, followed by a dollar sign ($) and a
name within that facility. You are strongly encouraged to define logical names
without the dollar sign ($) to avoid inadvertent conflicts.
32.1.2.2.1 Process Logical Name Table The process logical name table
LNM$PROCESS_TABLE contains names used exclusively by the process. A
process logical name table exists for each process in the system. Some entries
in the process logical name table are made by system programs executing at
more privileged access modes; these entries are qualified by the access mode from
which the entry was made. The process logical name table contains the following
process-permanent logical names:
Instead of creating these logical names within the process logical name table
LNM$PROCESS_TABLE for every process within a job tree, LOGINOUT creates
these logical names once when it is executed for the process at the root of the job
tree.
Additionally, the job logical name table can contain the following logical names:
• The logical name optionally specified and associated with a newly created
temporary mailbox
• The logical name optionally specified and associated with a privately mounted
volume
You do not need special privileges to modify the job logical name table. For a
discussion of privileges, see Section 32.3.
32.1.2.2.3 Group Logical Name Table The group logical name table contains
names that cooperating processes in the same group can use. You need the
GRPNAM privilege to add or delete a logical name in the group logical name
table. For a discussion of privileges, see Section 32.3.
A group logical name table is created when a top-level process with a unique
group code is created. The logical name LNM$GROUP exists in each process’s
process directory LNM$PROCESS_DIRECTORY. This logical name translates
into the name of the group logical name table.
32.1.2.2.4 System Logical Name Table The system logical name table
LNM$SYSTEM_TABLE contains names that all processes in the system can
access. This table includes the default names for all system-assigned logical
names. You need the SYSNAM or SYSPRV privilege to add or delete a logical
name in the system logical name table. For a discussion of privileges, see
Section 32.3.
The system logical table contains system-assigned logical names accessible to
all processes in the system. For example, the logical names SYS$LIBRARY and
SYS$SYSTEM provide logical names that all users can access to use the device
and directory that contain system files.
The Logical Names section of the OpenVMS User’s Manual contains a list of these
system-assigned logical names.
32.1.2.2.5 Clusterwide Logical Name Table The clusterwide system logical
name table LNM$SYSCLUSTER_TABLE contains names that all processes in
the cluster can access. This is the clusterwide table that contains system logical
names. Because this table exists on all systems, the programs and command
procedures that use clusterwide logical names are transportable to both clustered
and nonclustered systems. The names in this table are available to anyone
translating a logical name using SHOW LOGICAL/SYSTEM and specifying a
table name of LNM$SYSTEM, or LNM$DCL_LOGICAL (DCL’s default table
search list), or LNM$FILE_DEV (system and RMS default).
LNM$SYSCLUSTER is the logical name for LNM$SYSCLUSTER_TABLE. It
is provided for convenience in referencing LNM$SYSCLUSTER_TABLE and
it is consistent in format with LNM$SYSTEM_TABLE and its logical name,
LNM$SYSTEM.
You need either the SYSNAM or SYSPRV privilege or write access to the table to
create or delete a name in this table.
Processes other than the creating process cannot use logical names contained in
process-private tables.
You can assign protection to these shareable tables through the promsk
argument of the SYS$CRELNT system service. The promsk argument allows
you to specify the type of access for system, owner, group, and world users, as
follows:
• Read privileges allow access to names in the logical name table.
• Write privileges allow creation and deletion of names within the logical name
table.
• Delete privileges allow deletion of the logical name table.
• Create privilege to a table allows creation of children tables.
You can apply the following types of ownership and access to a shareable logical
name table:
• OWNERSHIP: SYSTEM(S), GROUP(G), or WORLD(W)
• ACCESS: READ(R), WRITE(W), CREATE(C), or DELETE(D)
If the promsk argument is omitted, complete access is granted to system and
owner, and no access is granted to group and world.
When a shareable table is created, both the specified promsk argument and the
current default security profile for tables are applied.
In addition, you can specify finer-grained access rights by modifying the access
control list using either the DCL command SET SECURITY or the SYS$SET_
SECURITY system service. For more information, see Chapter 25 and OpenVMS
Guide to System Security.
The length of logical names created in user-defined logical name tables cannot
exceed 255 characters. Equivalence strings cannot exceed 255 characters.
To create clusterwide logical names that will reside in the clusterwide logical
name table you created, you define the new clusterwide logical name with the
DEFINE command, specifying your new clusterwide table’s name with the
/TABLE qualifier, as shown in the following example:
$ DEFINE/TABLE=new_clusterwide_logical_name_table logical_name -
_$ equivalence_string
The system also checks for read, write, and delete access.
For example, a user without SYSPRV privilege but with write access to
LNM$SYSTEM_DIRECTORY can create or delete a shareable table.
All users can create, delete, and translate their own process-private logical names
and process-private logical name tables.
A logical name table can contain multiple definitions of the same logical name
with different access modes. If a request to translate such a logical name specifies
the acmode argument, then the SYS$TRNLNM system service ignores all names
defined at a less privileged mode. A request to delete a logical name includes the
access mode of the logical name. Unless the process has the SYSNAM privilege,
the mode specified can be no more privileged than the caller.
By default, the command interpreter places entries made from the command
stream into the process-private logical name table; these are supervisor-mode
entries and are not deleted at image exit (except for the logical names defined
by the DCL commands ASSIGN/USER and DEFINE/USER). During certain
system operations, such as the activation of an image installed with privilege,
only executive-mode and kernel-mode logical names are used.
Logical names or logical name table names, which either an image running
in user mode or the DCL commands ASSIGN/USER and DEFINE/USER have
placed in a process-private logical name table, are automatically deleted at
image exit. Shareable user-mode names, however, survive image exit and process
deletion.
To determine the equivalence string for the logical name TERMINAL in the
preceding table, enter the following command:
$ SHOW LOGICAL TERMINAL
The system returns the equivalence string TTA2:.
Job Logical Name Table
The portion of the following job logical name table assigns the logical name
TERMINAL to a virtual terminal VTA14. The logical name SYS$LOGIN is the
device and directory for the process when you log in. The SYS$LOGIN logical
name is defined in executive mode.
To determine the equivalence string for the logical name TERMINAL in the
preceding user-defined table, enter the following command:
$ SHOW LOGICAL/TABLE=LOG_TBL TERMINAL
The system returns the equivalence string MBA407. In order to use this
definition of TERMINAL as a device or file specification, you must redefine
the logical name LNM$FILE_DEV to reference the user-defined table, as follows:
$ DEFINE/TABLE=LNM$PROCESS_DIRECTORY LNM$FILE_DEV LOG_TBL, -
_$ LNM$PROCESS,LNM$JOB,LNM$GROUP,LNM$SYSTEM
In this example, the DCL command DEFINE is used to redefine the default
search list LNM$FILE_DEV. The /TABLE qualifier specifies the table
LNM$PROCESS_DIRECTORY that is to contain the redefined search list. The
system searches the tables defined by LNM$FILE_DEV in the following order:
LOG_TBL, LNM$PROCESS, LNM$JOB, LNM$GROUP, and LNM$SYSTEM.
Logical Name Supersession
If the logical name TERMINAL is equated to TTA2 in the process table, as shown
in the previous examples, and the process subsequently equates the logical name
TERMINAL to TTA3, the equivalence of TERMINAL TTA2 is replaced by the new
equivalence name. The successful return status code SS$_SUPERSEDE indicates
that a new entry replaced an old one.
The definitions of TERMINAL in the job table and in the user-defined table LOG_
TBL are unaffected.
Attribute Meaning
LNM$M_CONFINE Prevents this process-private logical name from being copied to
subprocesses. Subprocesses are created by the DCL command
SPAWN or by the run-time library LIB$SPAWN routine.
LNM$M_NO_ALIAS Prevents creation of a duplicate logical name in the specified
logical name table at an outer access mode. If another logical
name already exists in the table at an outer access mode, that
name is deleted.
The attr argument attributes that are available from the SYS$CRELNT system
service are as follows:
Attribute Meaning
LNM$M_CONFINE Prevents this process-private logical table from being copied to
subprocesses. Subprocesses are created by the DCL command
SPAWN or by the run-time library LIB$SPAWN routine.
LNM$M_CREATE_IF Prevents creation of a nonclusterwide logical name table if the
specified table already exists at the specified access mode in the
appropriate directory table. This attribute applies only to local
tables.
LNM$M_NO_ALIAS Prevents creation of a logical name table at an outer access
mode in a directory table if the table name already exists in the
directory table.
The attr argument attributes that are available from the SYS$TRNLNM system
service are as follows:
Attribute Meaning
LNM$M_CASE_BLIND Governs the translation process and causes
SYS$TRNLNM to ignore uppercase and lowercase
differences in letters when searching for logical names.
LNM$M_INTERLOCKED Ensures that any clusterwide logical name
modifications in progress are completed before the
name is translated.
Attribute Meaning
LNM$M_CONCEALED Indicates that the equivalence string at the current
index value for the logical name is an OpenVMS RMS
concealed device name.
LNM$M_TERMINAL Indicates that the equivalence strings cannot be
translated further.
Attribute Meaning
LNM$M_CONCEALED Indicates that the equivalence string at the current
index value for the logical name is an OpenVMS RMS
concealed device name.
LNM$M_CONFINE Indicates that the logical name cannot be used by
spawned subprocesses. Subprocesses are created by
the DCL command SPAWN or by the run-time library
LIB$SPAWN routine.
LNM$M_CRELOG Indicates that the logical name was created by the
SYS$CRELOG system service.
LNM$M_EXISTS Indicates that the equivalence string at the specified
index value exists.
LNM$M_NO_ALIAS Indicates that if the logical name already exists in the
table, it cannot be created in that table at an outer
access mode.
LNM$M_TABLE Indicates that the logical name is the name of a logical
name table.
LNM$M_TERMINAL Indicates that the equivalence strings cannot be
translated further.
LNM$V_CLUSTERWIDE Indicates that the logical name is clusterwide.
The attributes of multiple equivalence strings do not have to match. For more
information about attributes, refer to the appropriate system service in the
OpenVMS System Services Reference Manual.
• For all processes that do not activate LOGINOUT and do not specify a PQL$_
JTQUOTA quota list item in their call to SYS$CREPRC, the quota for the
job logical name table is taken from the dynamic System Generation utility
(SYSGEN) parameter PQL$_DJTQUOTA. You can use SYSGEN to display
both PQL$_DJTQUOTA and PQL$_MJTQUOTA, the default and minimum
job logical name table quotas, respectively.
Byte Contents
0 ^X1B (escape character)
1 ^X00
2–3 OpenVMS RMS Internal File Identifier (IFI)
This header is followed by the equivalence name string. If any of your program
applications must translate system-assigned logical names, you must prepare the
program both to check for the existence of this header and to use only the desired
part of the equivalence string. The following program demonstrates how to do
this:
#include <stdio.h>
#include <lnmdef.h>
#include <ssdef.h>
#include <descrip.h>
#include <ctype.h>
#include <string.h>
#define HEADER 4
main() {
unsigned int status,len,i;
char resstring[LNM$C_NAMLENGTH];
$DESCRIPTOR(tabdesc,"LNM$FILE_DEV");
$DESCRIPTOR(logdesc,"SYS$OUTPUT");
item_lst.buflen = LNM$C_NAMLENGTH;
item_lst.item_code = LNM$_STRING;
item_lst.bufaddr = resstring;
item_lst.retlenaddr = 0;
item_lst.terminator = 0;
/* Translate the logical name */
status = SYS$TRNLNM( 0, /* attr - attributes of the logical name */
&tabdesc, /* tabnam - logical name table */
&logdesc, /* lognam - logical name */
0, /* acmode - accessm mode */
&item_lst); /* itmlst - item list */
if((status & 1) != 1)
LIB$SIGNAL( status );
/*
Examine 4-byte header
Is first character an escape char?
If so, dump the header
*/
if( resstring[0] == 0x1B) {
printf("\nDumping the header...\n");
for(i = 0; i < HEADER; i++)
printf(" Byte %d: %X\n",i,resstring[i]);
printf("\nEquivalence string: %s\n",(resstring + HEADER));
}
else
printf("Header not found\n");
}
#include <stdio.h>
#include <lnmdef.h>
#include <descrip.h>
#include <string.h>
#include <ssdef.h>
/* Define an item descriptor */
struct itm {
unsigned short buflen, item_code;
void *bufaddr;
void *retlenaddr;
};
/* Declare an item list */
struct {
struct itm items2];
unsigned int terminator;
}itm_lst;
main() {
static char eqvnam[] = "DUA2:";
unsigned int status, lnmattr;
$DESCRIPTOR(logdesc,"DISK");
$DESCRIPTOR(tabdesc,"LNM$JOB");
lnmattr = LNM$M_TERMINAL;
/* Initialize the item list */
itm_lst.items[0].buflen = 4;
itm_lst.items[0].item_code = LNM$_ATTRIBUTES;
itm_lst.items[0].bufaddr = &lnmattr;
itm_lst.items[0].retlenaddr = 0;
itm_lst.items[1].buflen = strlen(eqvnam);
itm_lst.items[1].item_code = LNM$_STRING;
itm_lst.items[1].bufaddr = eqvnam;
itm_lst.items[1].retlenaddr = 0;
itm_lst.terminator = 0;
/* Create the logical name */
status = SYS$CRELNM(0, /* attr - attributes */
&tabdesc, /* tabnam - logical table name */
&logdesc, /* lognam - logical name */
0, /* acmode - access mode 0 means use the */
/* access mode of the caller=user mode */
&itm_lst); /* itmlst - item list */
if((status & 1) != 1)
LIB$SIGNAL(status);
}
#include <stdio.h>
#include <lnmdef.h>
#include <ssdef.h>
#include <descrip.h>
/* Define an item descriptor */
struct lst {
unsigned short buflen, item_code;
void *bufaddr;
void *retlenaddr;
};
/* Declare an item list */
struct {
struct lst items[2];
unsigned int terminator;
}item_lst;
/* Equivalence name strings */
static char eqvnam1[] = "XYZ";
static char eqvnam2[] = "DEF";
main() {
unsigned int status;
$DESCRIPTOR(logdesc,"ABC");
$DESCRIPTOR(tabdesc,"LNM$PROCESS");
item_lst.items[0].buflen = strlen(eqvnam1);
item_lst.items[0].item_code = LNM$_STRING;
item_lst.items[0].bufaddr = eqvnam1;
item_lst.items[0].retlenaddr = 0;
item_lst.items[1].buflen = strlen(eqvnam2);
item_lst.items[1].item_code = LNM$_STRING;
item_lst.items[1].bufaddr = eqvnam2;
item_lst.items[1].retlenaddr = 0;
item_lst.terminator = 0;
/* Create a logical name */
status = SYS$CRELNM( 0, /* attr - attributes of logical name */
&tabdesc, /* tabnam - name of logical name table */
&logdesc, /* lognam - name of logical name */
0, /* acmode - access mode 0 means use the */
/* access mode of the caller=user mode */
&item_lst); /* itm_lst - item list */
if((status & 1) != 1)
LIB$SIGNAL(status);
}
In the preceding example, logical name ABC was created and represents a search
list with two equivalence strings, XYZ and DEF. Each time the LNM$_STRING
item code of the itmlst argument is invoked, an index value is assigned to the
next equivalence string. The newly created logical name and its equivalence
string are contained in the process logical name table LNM$PROCESS_TABLE.
The following example illustrates the creation of a logical name in supervisor
mode through DCL:
$ DEFINE/SUPERVISOR_MODE/TABLE=LNM$PROCESS ABC XYZ,DEF
In the preceeding example, supervisor mode and /TABLE=LNM$PROCESS are
the defaults (default mode and default table) for the DEFINE command.
#include <stdio.h>
#include <ssdef.h>
#include <lnmdef.h>
#include <descrip.h>
main() {
unsigned int status, tab_attr=LNM$M_CONFINE, tab_quota=5000;
$DESCRIPTOR(tabdesc,"LOG_TABLE");
$DESCRIPTOR(pardesc,"LNM$PROCESS_TABLE");
/* Create the logical name table */
status = SYS$CRELNT(&tab_attr, /* attr - table attributes */
0, /* resnam - logical table name */
0, /* reslen - length of table name */
&tab_quota, /* quota - max no. of bytes allocated */
/* for names in this table */
0, /* promsk - protection mask */
&tabdesc, /* tabnam - name of new table */
&pardesc, /* partab - name of parent table */
0); /* acmode - access mode */
if((status & 1) != 1) {
LIB$SIGNAL(status);
}
#include <stdio.h>
#include <lnmdef.h>
#include <ssdef.h>
#include <descrip.h>
main() {
unsigned int status;
$DESCRIPTOR(logdesc,"DISK");
$DESCRIPTOR(tabdesc,"LNM$JOB");
For information about access modes and the deletion of logical names, see
Chapter 20 and Appendix B.
#include <stdio.h>
#include <lnmdef.h>
#include <descrip.h>
#include <ssdef.h>
/* Define an item descriptor */
struct itm {
unsigned short buflen, item_code;
void *bufaddr;
void *retlenaddr;
};
/* Declare an item list */
struct {
struct itm items[2];
unsigned int terminator;
}trnlst;
main() {
char eqvbuf1[LNM$C_NAMLENGTH], eqvbuf2[LNM$C_NAMLENGTH];
unsigned int status, trnattr=LNM$M_CASE_BLIND;
unsigned int eqvdesc1, eqvdesc2;
$DESCRIPTOR(logdesc,"ABC");
$DESCRIPTOR(tabdesc,"LNM$FILE_DEV");
/* Assign values to the item list */
trnlst.items[0].buflen = LNM$C_NAMLENGTH;
trnlst.items[0].item_code = LNM$_STRING;
trnlst.items[0].bufaddr = eqvbuf1;
trnlst.items[0].retlenaddr = &eqvdesc1;
trnlst.items[1].buflen = LNM$C_NAMLENGTH;
trnlst.items[1].item_code = LNM$_STRING;
trnlst.items[1].bufaddr = eqvbuf2;
trnlst.items[1].retlenaddr = &eqvdesc2;
trnlst.terminator = 0;
/* Translate the logical name */
status = SYS$TRNLNM(&trnattr, /* attr - attributes */
&tabdesc, /* tabnam - table name */
&logdesc, /* lognam - logical name */
0, /* acmode - access mode */
&trnlst); /* itmlst - item list */
if((status & 1) != 1)
LIB$SIGNAL(status);
}
This call to the SYS$TRNLNM system service results in the translation of the
logical name ABC. In addition, LNM$FILE_DEV is specified in the tabnam
argument as the search list that SYS$TRNLNM is to use to find the logical name
ABC. The logical name ABC was assigned two equivalence strings. The LNM$_
STRING item code in the itmlst argument directs SYS$TRNLNM to look for
an equivalence string at the current index value. Note that the LNM$_STRING
item code is invoked twice. The equivalence strings are placed in the two output
buffers, EQVBUF1 and EQVBUF2, described by TRNLIST.
The attribute LNM$M_CASE_BLIND governs the translation process. The
SYS$TRNLNM system service searches for the equivalence strings without
regard to uppercase or lowercase letters. The SYS$TRNLNM system service
matches any of the following character strings: ABC, aBC, AbC, abc, and so forth.
The output equivalence name string length is written into the first word of the
character string descriptor. This descriptor can then be used as input to another
system service.
PROGRAM REPEAT
INTEGER STATUS,
2 SYS$TRNLNM,SYS$DELLNM
INTEGER*4 REITERATE,
2 REPEAT_STR_LEN
CHARACTER*3 REPEAT_STR
! Item list for SYS$TRNLNM
INTEGER*2 NAME_LEN,
2 NAME_CODE
INTEGER*4 NAME_ADDR,
2 RET_ADDR,
2 END_LIST /0/
COMMON /LIST/ NAME_LEN,
2 NAME_CODE,
2 NAME_ADDR,
2 RET_ADDR,
2 END_LIST
NAME_LEN = 3
NAME_CODE = (LNM$_STRING)
NAME_ADDR = %LOC(REPEAT_STR)
RET_ADDR = %LOC(REPEAT_STR_LEN)
STATUS = SYS$TRNLNM (,
2 ’LNM$JOB’, ! Logical name table
2 ’REP_NUMBER’,, ! Logical name
2 NAME_LEN) ! List requesting equivalence string
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
READ (UNIT = REPEAT_STR,
2 FMT = ’(I3)’) REITERATE
DO I = 1, REITERATE
END DO
STATUS = SYS$DELLNM (’LNM$JOB’, ! Logical name table
2 ’REP_NUMBER’,) ! Logical name
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL(STATUS))
END
On Alpha systems, before the main program or main routine is called, a number
of system initialization routines are called as specified by a 1-, 2-, or 3-quadword
initialization list set up by the linker.
On VAX systems, the initialization list consists of the following (in order):
• The addresses of the debugger (if present)
• The LIB$INITIALIZE routine (if present)
• The entry point of the main program or main routine
On Alpha systems, the initialization list consists of the following (in order):
• The procedure value addresses of the debugger (if present)
• The LIB$INITIALIZE routine (if present)
• The entry point of the main program or main routine
The following initialization steps take place:
1. The image activator maps the user program into the address space of the
process and sets up useful information, such as the program name. Then it
starts the command language interpreter (CLI).
2. The CLI sets up an argument list and calls the next routine in the
initialization list (debugger, LIB$INITIALIZE, main program, or main
routine).
3. On VAX systems, the debugger, if present, initializes itself and calls the next
routine in the initialization list (LIB$INITIALIZE, main program, or main
routine).
On Alpha systems, the CLI calls the debugger, if present, to set the initial
breakpoints. Then the CLI calls the next entry in the vector.
4. The LIB$INITIALIZE library routine, if present, calls each library and user
initialization routine declared using the system LIB$INITIALIZE mechanism.
Then it calls the main program or main routine.
5. The main program or main routine executes and, at the user’s discretion,
accesses its argument list to scan the command or to obtain information about
the image. The main program or main routine can then call other routines.
6. Eventually, the main program or main routine terminates by executing a
return instruction (RET) with R0 set to a standard completion code to indicate
success or failure, where bit <0> equals 1 (success) or 0 (failure).
7. The completion code is returned to LIB$INITIALIZE (if present), the
debugger (if present), and, finally, to the CLI, which issues a SYS$EXIT
system service with the completion status as an argument. Any declared exit
handlers are called at this point.
Note
Main programs should not call the SYS$EXIT system service directly. If
they do, other programs cannot call them as routines.
Figure 33–1 and Figure 33–2 illustrate the sequence of calls and returns in a
typical image initialization. Each box is a routine activation as represented
on the image stack. The top of the stack is at the top of the figure. Each
upward arrow represents the result of a call instruction that creates a routine
activation on the stack to which control is being transferred. Each downward
arrow represents the result of a RET (return) instruction. A RET instruction
removes the routine activation from the stack and causes control to be transferred
downward to the next box.
A user program can alter the image initialization sequence by making a program
section (PSECT) contribution to PSECT LIB$INITIALIZE and by declaring
EXTERNAL LIB$INITIALIZE. This adds the optional initialization steps
shown in Figure 33–1 and Figure 33–2 labeled ‘‘Program Section Contribution
to LIB$INITIALIZE.’’ (A program section is a portion of a program with a
given protection and set of storage management attributes. Program sections
that have the same attributes are gathered together by the linker to form
an image section.) If the initialization routine also performs a coroutine call
back to LIB$INITIALIZE, the optional steps labeled ‘‘Coroutine Call Back to
LIB$INITIALIZE’’ in Figure 33–1 and Figure 33–2 are added to the image
initialization sequence.
On VAX systems, Figure 33–1 shows the call instruction calling the debugger, if
present, and the debugger then directly calling LIB$INITIALIZE and the main
program.
Library User
Procedure User Procedure*
Procedure*
LIB$INITIALIZE
Coroutine Call Back to
LIB$INITIALIZE
(Optional)
Initialization
Initialization Procedure*
Procedure*
Command
Language
Interpreter
Image
Activator
*These procedures are (or can be) user supplied.
ZK−1977−GE
On Alpha systems, Figure 33–2 shows the call instruction calling the debugger, if
present, to set a breakpoint at the main program’s entry point.
Library User
Procedure User Procedure*
Procedure*
LIB$INITIALIZE
Coroutine Call Back to
LIB$INITIALIZE
(Optional)
Initialization
Initialization Procedure*
Procedure*
Command
Language
Interpreter
Image
Activator
*These procedures are (or can be) user supplied.
ZK−5911A−GE
The debugger or LIB$INITIALIZE, or both, can call the next routine in the
initialization chain using the following coding sequence:
.
.
.
ADDL #4, 4(AP) ; Step to next initialization list entry
MOVL @4(AP), R0 ; R0 = next address to call
CALLG (AP), (R0) ; Call next initialization routine
.
.
.
This coding sequence modifies the contents of an argument list entry. Thus, the
sequence does not follow the OpenVMS calling standard. However, the argument
list can be expanded in the future without requiring any change either to the
debugger or to LIB$INITIALIZE.
This part of this second volume describes the generic macros used for calling
system services, OpenVMS data types, and the distributed name services on
OpenVMS VAX systems.
A
Generic Macros for Calling System Services
This appendix describes the use of generic macros to specify argument lists with
appropriate symbols and conventions in the system services interface to MACRO
assemblers.
System service macros generate argument lists and CALL instructions
to call system services. These macros are located in the system library
SYS$LIBRARY:STARLET.MLB. When you assemble a source program, this
library is searched automatically for unresolved references.
Knowledge of VAX MACRO rules for assembly language programming is required
for understanding the material presented in this appendix. The VAX MACRO
and Instruction Set Reference Manual contains the necessary prerequisite
information.
Each system service has four macros associated with it. These macros allow
you to define symbolic names for argument offsets, construct argument lists for
system services, and call system services. Table A–1 lists the generic macros and
the functions they serve.
Table A–1 Generic Argument List Macros of the System Service Interface
Macro Function
$nameDEF Defines symbolic names for the argument list offsets
$name Defines symbolic names for the argument list offsets and constructs
the argument list
$name_S Calls the system service and constructs the argument list
$name_G Calls the system service and uses the argument list constructed by
$name macro
A.1.1 Specifying Arguments with the $name_S Macro and the $name Macro
When you use the $name_S or the $name macro to construct an argument list for
a system service, you can specify arguments in any one of three ways:
• By using keywords to describe the arguments. All keywords must be followed
by an equals sign ( = ) and then by the value of the argument.
• By using positional order, with omitted arguments indicated by commas in the
argument positions. You can omit commas for optional trailing arguments.
• By using both positional order and keyword names (positional arguments
must be listed first).
For example, $MYSERVICE can have the following format:
$MYSERVICE arga ,[argb] ,[argc] ,argd
For purposes of this example, assume that arga and argb require you to specify
numeric values and that argc and argd require you to specify addresses.
Examples A–1 and A–2 show valid ways of writing the $name_S macro to call
$MYSERVICE.
Note that all arguments, whether specified positionally or with keywords, must
be valid assembler expressions because they are used as source operands in
instructions.
Examples A–3 and A–4 show valid ways of writing a $name macro to construct
an argument list for a later call to $MYSERVICE.
Example A–4 Specifying Arguments in Positional Order with the $name Macro
LIST: $MYSERVICE -
1,,,MYARGD
Both methods generate the following:
LIST: .LONG 4
.LONG 1
.LONG 0
.LONG 0
.ADDRESS -
MYARGD
Note that all arguments, whether specified positionally or by keyword, must be
expressions that the assembler can evaluate to generate .LONG or .ADDRESS
data directives. Contrast this to the arguments for the $name_S macro, which
must be valid assembler expressions because they are used as source operands in
instructions.
A.1.3 Defining Symbolic Names for Argument List Offsets: $name and
$nameDEF
You can refer symbolically to arguments in the argument list. Each argument in
an argument list has an offset from the beginning of the list; a symbolic name is
defined for the numeric offset of each argument. If you use the symbolic names to
refer to the arguments in a list, you do not have to remember the numeric offset
(which is based on the position of the argument shown in the macro format).
There are two additional advantages to referring to arguments by their symbolic
names:
• Your program is easier to read.
• If an argument list for a system service changes with a later release of a
system, the symbols remain the same.
You form the offset names for all system service argument lists by following the
service macro name with $_ and the keyword name of the argument. In the
following example, name is the name for the system service macro and keyword is
the keyword argument:
name$_keyword
Similarly, you can define a symbolic name for the number of arguments a
particular macro requires, as follows:
name$_NARGS
You can define symbolic names for argument list offsets automatically whenever
you use the $name macro for a particular system service. You can also define
symbolic names for system service argument lists using the $nameDEF macro.
This macro does not generate any executable code; it merely defines the symbolic
names so they can be used later in the program. For example:
$QIODEF
This macro defines the symbol QIO$_NARGS and the symbolic names for the
$QIO argument list offsets.
You may need to use the $nameDEF macro either if you specify an argument list
to a system service without using the $name macro or if a program refers to an
argument list in a separately assembled module.
For example, the $READEF and $READEFDEF macros define the values listed
in the following table.
Thus, you can specify the $READEF macro to build an argument list for a
$READEF system service call, as follows:
READLST: $READEF EFN=1,STATE=TEST1
Later, the program may want to use a different value for the state argument to
call the service. The following lines show how you can do this with a call to the
$name_G macro.
MOVAL TEST2,READLST+READEF$_STATE
$READEF_G READLST
The MOVAL instruction replaces the address TEST1 in the $READEF argument
list with the address TEST2; the $READEF_G macro calls the system service
with the modified list.
label
Symbolic address of the generated argument list. This is the label given as an
argument in the $name_G macro.
$name
The service macro name.
arg1,...,argn
Arguments to be placed in successive longwords in the argument list.
Note
The OpenVMS usage entry is not a traditional data type such as the
OpenVMS standard data types—byte, word, longword, and so on. It
is significant only within the OpenVMS operating system environment
and is intended solely to expedite data declarations within application
programs.
VAX Specific
31 0
Must be 0 Argument :arglst
count (n)
arg1
arg2
argn
ZK−4721A−GE
ast_procedure The procedure value of a procedure to be called at asynchronous system trap (AST)
level. (Procedures that are not to be called at AST level are of type procedure.)
boolean Unsigned longword denoting a Boolean truth value flag. This longword can have
one of two values: 1 (true) or 0 (false).
buffer Generic term for temporary memory.
buffer_length Generic term for temporary memory that indicates the size of a buffer.
byte_signed Same as the data type byte integer (signed) in Table 17–3.
byte_unsigned Same as the data type byte (unsigned) in Table 17–3.
1 VAX specific.
2 Alpha specific.
7 0
:A
"X"
:A+1
"Y"
:A+2
"Z"
ZK−4202−GE
complex_number One of the OpenVMS standard complex floating-point data types. The six complex
floating point numbers are F_floating complex, D_floating complex, G_floating
complex, S_floating, T_floating, and X_floating.
As shown in the following figure, an F_floating point complex number
( real, imaginary ) is composed of two F_floating point numbers: the first is the
real part of the complex number; the second is the imaginary part. For more
structure detail, see floating_point described later in this table.
31 0
F_floating number (real) :A
63 32
ZK−4720A−GE
31 0
D_floating number (real) :A
ZK−4719A−GE
31 0
G_floating number (real) :A
ZK−4728A−GE
VAX Specific
31 0
H_floating number (real) :A
ZK−4729A−GE
1 VAX specific.
Alpha Specific
31 0
:A
S_floating number (real)
:A+4
S_floating number (imaginary)
63 32
ZK−5189A−GE
Alpha Specific
31 0
:A
T_floating number (real)
:A+8
T_floating number (imaginary)
ZK−5190A−GE
2 Alpha specific.
Alpha Specific
31 0
:A
:A+16
ZK−6512A−GE
cond_value Longword integer for VAX or quadword sign-extended integer for Alpha denoting a
condition value (a return status or system condition code) that is typically returned
by a procedure in R0. Each numeric condition value has a unique symbolic name
in the following format, where the severity condition code is a mnemonic describing
the return condition:
31 28 27 3 2 0
2 1 0
*S
27 16 15 3
*S = Success
ZK−1795−GE
2 Alpha specific.
31 0
Forward link (used by OpenVMS only)
ZK−1714−GE
floating_point One of the Alpha or VAX standard floating-point data types. VAX systems
support F_floating, D_floating, G_floating, or H_floating data types. In addition,
Alpha systems support S_floating, T_floating, or X_floating types. The following
paragraphs briefly describe these data types:
The structure of an F_floating datum follows. It contains two fraction fields.
Note that the field 2 extension holds the least significant portion of the fractional
number.
15 14 7 6 0
S Exponent Fraction field 1 :A
31 16
ZK−4722A−GE
15 14 7 6 0
S Exponent Fraction field 1 :A
63 48
ZK−4723A−GE
The structure of a G_floating datum follows. It contains four fraction fields. Note
that the field 4 extension holds the least significant portion of the fractional
number.
15 14 4 3 0
S Exponent Field 1 :A
63 48
ZK−4724A−GE
2 Alpha specific.
VAX Specific
15 14 0
:A
S Exponent
:A+2
Fraction field 1
:A+4
Fraction field 2
:A+6
Fraction field 3
:A+8
Fraction field 4
:A+10
Fraction field 5
:A+12
Fraction field 6
:A+14
Fraction field 7
ZK−4725A−GE
Alpha Specific
15 0
:A
Fraction field 2
:A+2
S Fraction field 1 Exponent
31 30 23 22 16
ZK−4726A−GE
1 VAX specific.
2 Alpha specific.
Alpha Specific
15 0
:A
Fraction field 4
:A+2
Fraction field 3
:A+4
Fraction field 2
:A+6
S Exponent Field 1
63 62 52 51 48
ZK−4727A−GE
Alpha Specific
15 0
:A
Fraction field 0
:A+2
Fraction field 1
:A+4
Fraction field 2
:A+6
Fraction field 3
:A+8
Fraction field 4
:A+10
Fraction field 5
:A+12
Fraction field 6
:A+14
S Exponent
127 112
ZK−6511A−GE
function_code Unsigned longword specifying the exact operations a procedure is to perform. This
longword has two word-length fields: the first field is a number specifying the major
operation; the second field is a mask or bit vector specifying various suboperations
within the major operation.
identifier Unsigned longword that identifies an object returned by the system.
2 Alpha specific.
31 16 15 0
Count Condition value
Device−dependent information
ZK−0856−GE
The first word contains a condition value indicating the success or failure of the
operation. The condition values used are the same as for all returns from system
services; for example, SS$_NORMAL indicates successful completion.
The second word contains the number of bytes actually transferred in the I/O
operation. Note that for some devices this word contains only the low-order word of
the count.
The second longword contains device-dependent return information.
To ensure successful I/O completion and the integrity of data transfers, you should
check the IOSB following I/O requests, particularly for device-dependent I/O
functions.
item_list_2 Structure that consists of one or more item descriptors and is terminated by
a longword containing 0. Each item descriptor is a 2-longword structure that
contains three fields.
The following diagram depicts a single-item descriptor:
31 15 0
Item code Component length
Component address
ZK−1709−GE
The first field is a word in which the service writes the length (in characters) of the
requested component. If the service does not locate the component, it returns the
value 0 in this field and in the component address field.
The second field contains a user-supplied, word-length symbolic code that specifies
the component desired. The item codes are defined by the macros specific to the
service.
The third field is a longword in which the service writes the starting address of the
component. This address is within the input string itself.
2 Alpha specific.
31 15 0
Buffer address
ZK−1705−GE
The first field is a word containing a user-supplied integer specifying the length (in
bytes) of the buffer in which the service writes the information. The length of the
buffer needed depends on the item code specified in the item code field of the item
descriptor. If the value of buffer length is too small, the service truncates the data.
The second field is a word containing a user-supplied symbolic code specifying the
item of information that the service is to return. These codes are defined by macros
specific to the service.
The third field is a longword containing the user-supplied address of the buffer in
which the service writes the information.
The fourth field is a longword containing the user-supplied address of a word in
which the service writes the length in bytes of the information it actually returned.
item_list_pair Structure that consists of one or more longword pairs, or doublets, and is
terminated by a longword containing 0. Typically, the first longword contains
an integer value such as a code. The second longword can contain a real or integer
value.
item_quota_list Structure that consists of one or more quota descriptors and is terminated by
a byte containing a value defined by the symbolic name PQL$_LISTEND. Each
quota descriptor consists of a 1-byte quota name followed by an unsigned longword
containing the value for that quota.
lock_id Unsigned longword integer denoting a lock identifier. This lock identifier is
assigned to a lock by the lock manager when the lock is granted.
lock_status_block Structure into which the lock manager writes status information about a lock. A
lock status block always contains at least two longwords: the first word of the
first longword contains a condition value; the second word of the first longword is
reserved by Compaq. The second longword contains the lock identifier.
The lock status block receives the final condition value plus the lock identification,
and optionally contains a lock value block. When a request is queued, the lock
identification is stored in the lock status block even if the lock has not been granted.
This allows a procedure to dequeue locks that have not been granted.
The condition value is placed in the lock status block only when the lock is granted
(or when errors occur in granting the lock).
31 15 0
Reserved Condition value
Lock identification
ZK−1708−GE
lock_value_block A 16-byte block that the lock manager includes in a lock status block if the user
requests it. The contents of the lock value block are user-defined and are not
interpreted by the lock manager.
logical_name Character string of from 1 to 255 characters that identifies a logical name or
equivalence name to be manipulated by OpenVMS logical name system services.
Logical names that denote specific OpenVMS objects have their own OpenVMS
types; for example, a logical name identifying a device has the OpenVMS type
device_name.
longword_signed Same as the data type longword integer (signed) in Table 17–3.
longword_unsigned Same as the data type longword (unsigned) in Table 17–3.
mask_byte Unsigned byte in which each bit is interpreted by the called procedure. A mask is
also referred to as a set of flags or as a bit mask.
mask_longword Unsigned longword in which each bit is interpreted by the called procedure. A
mask is also referred to as a set of flags or as a bit mask.
mask_quadword Unsigned quadword in which each bit is interpreted by the called procedure. A
mask is also referred to as a set of flags or as a bit mask.
mask_word Unsigned word in which each bit is interpreted by the called procedure. A mask is
also referred to as a set of flags or as a bit mask.
mechanism_args Structure (array) of mechanism argument vectors that contain information about
the machine state when an exception occurs or when a condition is signaled. For
more information concerning mechanism argument vectors, see the OpenVMS
Calling Standard.
null_arg Unsigned longword denoting a null argument. (A null argument is one whose only
purpose is to hold a place in the argument list.)
octaword_signed Same as the data type octaword integer (signed) in Table 17–3.
octaword_unsigned Same as the data type octaword (unsigned) in Table 17–3.
Symbol Description
PRT$C_NA No access
PRT$C_KR Kernel read only
PRT$C_KW Kernel write
PRT$C_ER Executive read only
PRT$C_EW Executive write
PRT$C_SR Supervisor read only
PRT$C_SW Supervisor write
PRT$C_UR User read only
PRT$C_UW User write
PRT$C_ERKW Executive read; kernel write
PRT$C_SRKW Supervisor read; kernel write
PRT$C_SREW Supervisor read; executive write
PRT$C_URKW User read; kernel write
PRT$C_UREW User read; executive write
PRT$C_URSW User read; supervisor write
procedure Procedure value of a procedure that is not to be called at AST level. (Arguments
specifying procedures to be called at AST level have the OpenVMS type ast_
procedure.)
A procedure value is an address that represents a procedure. On VAX systems, a
procedure value is the address of the procedure entry mask. On Alpha systems, a
procedure value is the address of the procedure descriptor for the procedure. For
more information, see the OpenVMS Calling Standard.
process_id Unsigned longword integer denoting a process identification (PID). This process
identification is assigned to a process by the operating system when the process is
created.
process_name Character string containing 1 to 15 characters that specifies the name of a process.
quadword_signed Same as the data type quadword integer (signed) in Table 17–3.
quadword_unsigned Same as the data type quadword (unsigned) in Table 17–3.
31 0
UIC identifier of holder
ZK−1903−GE
rights_id Unsigned longword denoting a rights identifier, which identifies an interest group
in the context of the OpenVMS security environment. This rights environment
might consist of all or part of a user’s user identification code (UIC).
Identifiers have two formats in the rights database: UIC format (OpenVMS type
uic) and ID format. The high-order bits of the identifier value specify the format of
the identifier. Two high-order zero bits identify a UIC format identifier; bit <31>,
set to 1, identifies an ID format identifier. Bits <30:28> are reserved by Compaq.
The remaining bits specify the identifier value. The following diagram depicts the
ID format of a rights identifier:
31 27 0
1000 Identifier
ZK−1906−GE
31 0
00 Group Member
ZK−1905−GE
address_range STARLET.ADDRESS_RANGE_TYPE
arg_list STARLET.ARG_LIST_TYPE
ast_procedure SYSTEM.AST_HANDLER
boolean STANDARD.BOOLEAN
byte_signed STANDARD.SHORT_SHORT_INTEGER
byte_unsigned SYSTEM.UNSIGNED_BYTE
channel STARLET.CHANNEL_TYPE
char_string STANDARD.STRING
complex_number User-defined record
cond_value CONDITION_HANDLING.COND_VALUE_TYPE
context STARLET.CONTEXT_TYPE
date_time STARLET.DATE_TIME_TYPE
device_name STARLET.DEVICE_NAME_TYPE
ef_cluster_name STARLET.EF_CLUSTER_NAME_TYPE
ef_number STARLET.EF_NUMBER_TYPE
exit_handler_block STARLET.EXIT_HANDLER_BLOCK_TYPE
fab STARLET.FAB_TYPE
file_protection STARLET.FILE_PROTECTION_TYPE
floating_point STANDARD.FLOAT
STANDARD.LONG_FLOAT
STANDARD.LONG_LONG_FLOAT
SYSTEM.F_FLOAT
SYSTEM.D_FLOAT
SYSTEM.G_FLOAT
SYSTEM.H_FLOAT
SYSTEM.IEEE_SINGLE_FLOAT1
SYSTEM.IEEE_DOUBLE_FLOAT1
function_code STARLET.FUNCTION_CODE_TYPE
identifier SYSTEM.UNSIGNED_LONGWORD
1
invo_context_blk User-defined record
1
invo_handle SYSTEM.UNSIGNED_LONGWORD
io_status_block STARLET.IOSB_TYPE
item_list_pair SYSTEM.UNSIGNED_LONGWORD
item_list_2 STARLET.ITEM_LIST_2_TYPE
item_list_3 STARLET.ITEM_LIST_3_TYPE
item_quota_list User-defined record
lock_id STARLET.LOCK_ID_TYPE
lock_status_block STARLET.LOCK_STATUS_BLOCK_TYPE
lock_value_block STARLET.LOCK_VALUE_BLOCK_TYPE
logical_name STARLET.LOGICAL_NAME_TYPE
1 Alpha specific.
lock_status_block na
lock_value_block na
logical_name /TYPE=T
longword_signed /TYPE=L
longword_unsigned /TYPE=LU
mask_byte /TYPE=BU
mask_longword /TYPE=LU
mask_quadword na
mask_word /TYPE=WU
null_arg /TYPE=LU
octaword_signed na
octaword_unsigned na
page_protection /TYPE=LU
procedure na
process_id /TYPE=LU
process_name /TYPE=T
quadword_signed na
quadword_unsigned na
rights_holder na
rights_id /TYPE=LU
rab na
section_id na
section_name /TYPE=T
system_access_id na
time_name /TYPE=T
transaction_id na
uic /TYPE=LU
user_arg /TYPE=LU
varying_arg na
vector_byte_signed /TYPE=B
vector_byte_unsigned /TYPE=BU
vector_longword_signed /TYPE=L
vector_longword_unsigned /TYPE=LU
vector_quadword_signed na
vector_quadword_unsigned na
vector_word_signed /TYPE=W
(continued on next page)
vector_word_unsigned /TYPE=WU
word_signed /TYPE=W
word_unsigned /TYPE=WU
1 Although unsigned data types are not directly supported in BASIC, you may substitute the signed
equivalent provided you do not exceed the range of the signed data type.
1 Although unsigned data types are not directly supported in BASIC, you may substitute the signed
equivalent provided you do not exceed the range of the signed data type.
item_quota_list BLOCKVECTOR[n,5,BYTE]
where n is the number of the quota descriptors + 1.
lock_id UNSIGNED_LONG
lock_status_block BLOCK[n,BYTE]
where n is the size of the lock_status_block minus at
least 8.
lock_value_block BLOCK[16,BYTE]
logical_name VECTOR[255,BYTE,UNSIGNED]
longword_signed SIGNED LONG
longword_unsigned UNSIGNED LONG
mask_byte BITVECTOR[8]
mask_longword BITVECTOR[32]
mask_quadword BITVECTOR[64]
mask_word BITVECTOR[16]
null_arg UNSIGNED LONG
octaword_signed VECTOR[4,LONG,UNSIGNED]
octaword_unsigned VECTOR[4,LONG,UNSIGNED]
page_protection UNSIGNED LONG
procedure UNSIGNED LONG
process_id UNSIGNED LONG
process_name VECTOR[n,BYTE,UNSIGNED]
where n is the length of the process name.
quadword_signed VECTOR[2,LONG,UNSIGNED]
quadword_unsigned VECTOR[2,LONG,UNSIGNED]
rights_holder BLOCK[8,BYTE]
rights_id UNSIGNED LONG
rab $RAB_DECL
from STARLET.REQ
section_id VECTOR[2,LONG,UNSIGNED]
section_name VECTOR[n,BYTE,UNSIGNED]
where n is the length of the global section name.
system_access_id VECTOR[2,LONG,UNSIGNED]
time_name VECTOR[n,BYTE,UNSIGNED]
where n is the length of the time value in OpenVMS
format.
transaction_id VECTOR[4,LONG,UNSIGNED]
uic UNSIGNED LONG
user_arg UNSIGNED LONG
varying_arg UNSIGNED LONG
vector_byte_signed VECTOR[n,BYTE,SIGNED]
where n is the size of the array.
(continued on next page)
vector_byte_unsigned VECTOR[n,BYTE,UNSIGNED]
where n is the size of the array.
vector_longword_signed VECTOR[n,LONG,SIGNED]
where n is the size of the array.
vector_longword_unsigned VECTOR[n,LONG,UNSIGNED]
where n is the size of the array.
vector_quadword_signed BLOCKVECTOR[n,2,LONG]
where n is the size of the array.
vector_quadword_unsigned BLOCKVECTOR[n,2,LONG]
where n is the size of the array.
vector_word_signed VECTOR[n,BYTE,SIGNED]
where n is the size of the array.
vector_word_unsigned VECTOR[n,BYTE,UNSIGNED]
where n is the size of the array.
word_signed SIGNED WORD
word_unsigned UNSIGNED WORD
1 The declaration of a user-defined data structure depends on how the data will be used. Such data
structures can be declared in a variety of ways, each of which is suitable only to specific applications.
2C and C++ pointers are declared with special syntax and are associated with the data type of the
object being pointed to. This object is often user defined.
3 The term array denotes the syntax of a C or C++ array declaration.
4 The data type specified can be changed to any valid C or C++ data type.
5 The size of the array must be substituted for n.
1 The declaration of a user-defined data structure depends on how the data will be used. Such data
structures can be declared in a variety of ways, each of which is suitable only to specific applications.
2C and C++ pointers are declared with special syntax and are associated with the data type of the
object being pointed to. This object is often user defined.
3 The term array denotes the syntax of a C or C++ array declaration.
4 The data type specified can be changed to any valid C or C++ data type.
5 The size of the array must be substituted for n.
6 Alpha specific.
01 ARG-LIST
02 ARG-COUNT PIC S9(5) COMP
02 ARG-BY-VALUE PIC S9(5) COMP
02 ARG-BY-REFERENCE USAGE POINTER
02 VALUE REFERENCE ARG-NAME
. . . continue as needed
ast_procedure 01 AST-PROC PIC 9(5) COMP2
boolean 01 BOOLEAN-VALUE PIC 9(5) COMP2
byte_signed na . . . PIC X1
byte_unsigned na . . . PIC X1
channel 01 CHANNEL PIC 9(4) COMP2
char_string 01 CHAR-STRING PIC X to PIC X(65535)
complex_number na . . . PIC X(n), where n is the length.1
cond_value 01 COND-VALUE PIC 9(5) COMP2
context 01 CONTEXT PIC 9(5) COMP2
date_time na . . . PIC X(16)1
device_name 01 DEVICE-NAME PIC X(n), where n is the length.
ef_cluster_name 01 CLUSTER-NAME PIC X(n), where n is the length.
ef_number 01 EF-NO PIC 9(5) COMP2
exit_handler_block na . . . PIC X(n), where n is the length.1
fab na . . . Too complex for general COBOL use. Most of a
FAB structure can be described by a lengthy COBOL
record description, but such a FAB cannot then be
referenced by a COBOL I-O statement. It is much
simpler to do the I-O completely within COBOL, and let
the COBOL compiler generate the FAB structure or do
the I-O in another language.
file_protection 01 FILE-PROT PIC 9(4) COMP2
1 Most OpenVMS data types not directly supported in COBOL can be represented as an alphanumeric
data item of a certain number of bytes. While COBOL does not interpret the data type, you can use it
to pass objects from one language to another.
2 Although unsigned computational data structures are not directly supported in COBOL, you may
substitute the signed equivalent provided you do not exceed the range of the signed data structure.
1 Most OpenVMS data types not directly supported in COBOL can be represented as an alphanumeric
data item of a certain number of bytes. While COBOL does not interpret the data type, you can use it
to pass objects from one language to another.
2 Although unsigned computational data structures are not directly supported in COBOL, you may
substitute the signed equivalent provided you do not exceed the range of the signed data structure.
3 Alpha specific.
1 Alpha specific.
channel INTEGER*2
char_string CHARACTER*n
complex_number COMPLEX*8
COMPLEX*16
cond_value INTEGER*4
context INTEGER*4
date_time INTEGER*4(2)
or
INTEGER*81
device_name CHARACTER*n
ef_cluster_name CHARACTER*n
ef_number INTEGER*4
exit_handler_block STRUCTURE /exhblock/
INTEGER*4 flink
INTEGER*4 exit_handler_addr
BYTE(3) /0/
BYTE arg_count
INTEGER*4 cond_value
! .
! .(optional arguments . . . one argument
! . per longword)
!
END STRUCTURE !cntrlblk
1 Alpha specific.
2 Unsigned data types are not directly supported by FORTRAN. However, in most cases you can
substitute the signed equivalent as long as you do not exceed the range of the signed data structure.
3 The format used by floating-point data in memory is determined by the FORTRAN command qualifier
/FLOAT.
4 The REAL*16 type is used for both H_floating on VAX systems and X_floating on Alpha systems.
1 Alpha specific.
2 Unsigned data types are not directly supported by FORTRAN. However, in most cases you can
substitute the signed equivalent as long as you do not exceed the range of the signed data structure.
1 Thistype is not available in Pascal when an empty record has been inserted. To manipulate the
contents, declare with explicit field components. If you pass an empty record as a parameter to a
Pascal routine, you must use the VAR keyword.
2 Pascalexpects either a type identifier or conformant schema. Declare this under the TYPE
declaration and use the type identifier in the formal parameter declaration.
3 Pascalallocates a byte for a BOOLEAN variable. Use the [LONG] attribute when passing to routines
that expect a longword.
4 This
parameter declaration accepts VARYING OF CHAR or PACKED ARRAY OF CHAR and
produces the CLASS_S descriptor required by system services.
5 The program must inherit the STARLET environment file located in SYS$LIBRARY:STARLET.PEN.
6 If
the {G_Floating} attribute is used in compiling, double-precision variables and expressions are
represented in G_floating format. You can also use the /G_FLOATING command line qualifier. Both
methods default to no G_floating.
1 Thistype is not available in Pascal when an empty record has been inserted. To manipulate the
contents, declare with explicit field components. If you pass an empty record as a parameter to a
Pascal routine, you must use the VAR keyword.
2 Pascalexpects either a type identifier or conformant schema. Declare this under the TYPE
declaration and use the type identifier in the formal parameter declaration.
4 This
parameter declaration accepts VARYING OF CHAR or PACKED ARRAY OF CHAR and
produces the CLASS_S descriptor required by system services.
5 The program must inherit the STARLET environment file located in SYS$LIBRARY:STARLET.PEN.
7 Alpha specific.
1 Thistype is not available in Pascal when an empty record has been inserted. To manipulate the
contents, declare with explicit field components. If you pass an empty record as a parameter to a
Pascal routine, you must use the VAR keyword.
2 Pascalexpects either a type identifier or conformant schema. Declare this under the TYPE
declaration and use the type identifier in the formal parameter declaration.
4 This
parameter declaration accepts VARYING OF CHAR or PACKED ARRAY OF CHAR and
produces the CLASS_S descriptor required by system services.
5 The program must inherit the STARLET environment file located in SYS$LIBRARY:STARLET.PEN.
1 System routines are often written so the parameter passed occupies more storage than the object
requires. For example, some system services have parameters that return a bit value as a longword.
These variables must be declared BIT(32) ALIGNED (not BIT(n) ALIGNED) so that adjacent storage
is not overwritten by return values or used incorrectly as input. (Longword parameters are always
declared BIT(32) ALIGNED.)
1 System routines are often written so the parameter passed occupies more storage than the object
requires. For example, some system services have parameters that return a bit value as a longword.
These variables must be declared BIT(32) ALIGNED (not BIT(n) ALIGNED) so that adjacent storage
is not overwritten by return values or used incorrectly as input. (Longword parameters are always
declared BIT(32) ALIGNED.)
2 AST procedures and those passed as parameters of type ENTRY VALUE or ANY VALUE must be
external procedures. This applies to all system routines that take procedure parameters.
3 This is actually an unsigned integer. This declaration is interpreted as a signed number; use the
POSINT function to determine the actual value.
4 System services require CHARACTER string representation for parameters. Most other system
routines allow either CHARACTER or CHARACTER VARYING. For parameter declarations, n should
be an asterisk (*).
5 PL/I does not support FIXED BINARY numbers with precisions greater than 31. To use larger
values, declare variables to be BIT variables of the appropriate size and use the POSINT and
SUBSTR bits as necessary to access the values, or declare the item as a structure. The RTL routines
LIB$ADDX and LIB$SUBX may be useful if you need to perform arithmetic on these types.
6 Routinesdeclared in PLI$STARLET often use ANY, so you are free to declare the data structure
in the most convenient way for the application. ANY may be necessary in some cases because PL/I
does not allow parameter declarations for some data types used by OpenVMS. (In particular, PL/I
parameters with arrays passed by reference cannot be declared to have nonconstant bounds.)
1 System routines are often written so the parameter passed occupies more storage than the object
requires. For example, some system services have parameters that return a bit value as a longword.
These variables must be declared BIT(32) ALIGNED (not BIT(n) ALIGNED) so that adjacent storage
is not overwritten by return values or used incorrectly as input. (Longword parameters are always
declared BIT(32) ALIGNED.)
7 Alpha specific.
1 System routines are often written so the parameter passed occupies more storage than the object
requires. For example, some system services have parameters that return a bit value as a longword.
These variables must be declared BIT(32) ALIGNED (not BIT(n) ALIGNED) so that adjacent storage
is not overwritten by return values or used incorrectly as input. (Longword parameters are always
declared BIT(32) ALIGNED.)
1 System routines are often written so the parameter passed occupies more storage than the object
requires. For example, some system services have parameters that return a bit value as a longword.
These variables must be declared BIT(32) ALIGNED (not BIT(n) ALIGNED) so that adjacent storage
is not overwritten by return values or used incorrectly as input. (Longword parameters are always
declared BIT(32) ALIGNED.)
2 AST procedures and those passed as parameters of type ENTRY VALUE or ANY VALUE must be
external procedures. This applies to all system routines that take procedure parameters.
3 This is actually an unsigned integer. This declaration is interpreted as a signed number; use the
POSINT function to determine the actual value.
4 System services require CHARACTER string representation for parameters. Most other system
routines allow either CHARACTER or CHARACTER VARYING. For parameter declarations, n should
be an asterisk (*).
5 PL/I does not support FIXED BINARY numbers with precisions greater than 31. To use larger
values, declare variables to be BIT variables of the appropriate size and use the POSINT and
SUBSTR bits as necessary to access the values, or declare the item as a structure. The RTL routines
LIB$ADDX and LIB$SUBX may be useful if you need to perform arithmetic on these types.
6 Routinesdeclared in PLI$STARLET often use ANY, so you are free to declare the data structure
in the most convenient way for the application. ANY may be necessary in some cases because PL/I
does not allow parameter declarations for some data types used by OpenVMS. (In particular, PL/I
parameters with arrays passed by reference cannot be declared to have nonconstant bounds.)
Note
All system services and many system constants and data structures are
declared in PLI$STARLET.TLB.
While the current version of PL/I does not support unsigned fixed binary
numbers or fixed binary numbers with a precision greater than 31, future
versions may support these features. If PL/I is extended to support these
types, declarations in PLISTARLET may change to use the new data
types where appropriate.
1 Alpha specific.
1 Technically,
RPG II does not support unsigned data structures. However, unsigned information may
be passed using the signed equivalent, provided the contents do not exceed the range of the signed
data structure.
1 Technically,
RPG II does not support unsigned data structures. However, unsigned information may
be passed using the signed equivalent, provided the contents do not exceed the range of the signed
data structure.
1 FILLis a data type that can always be used. A FILL is an object between 0 and 65K bytes in length.
SCAN does not interpret the contents of an object. Thus, it can be used to pass or return the object to
another language that does understand the type.
1 FILLis a data type that can always be used. A FILL is an object between 0 and 65K bytes in length.
SCAN does not interpret the contents of an object. Thus, it can be used to pass or return the object to
another language that does understand the type.
2 SCAN Boolean is just 1 byte.
1 FILLis a data type that can always be used. A FILL is an object between 0 and 65K bytes in length.
SCAN does not interpret the contents of an object. Thus, it can be used to pass or return the object to
another language that does understand the type.
1 FILLis a data type that can always be used. A FILL is an object between 0 and 65K bytes in length.
SCAN does not interpret the contents of an object. Thus, it can be used to pass or return the object to
another language that does understand the type.
This chapter describes the Digital Distributed Name Service (DECdns) Clerk by
introducing the functions of the DECdns (SYS$DNS) system service and various
run-time library routines. It is divided into the following sections:
Section C.1 describes how to use the portable application programming interface
and the operating system’s system service and run-time library interface.
Section C.2 describes how to use the SYS$DNS system service.
Section C.3 describes how to use the DCL command DEFINE.
C.1.1 Using the DECdns System Service and Run-Time Library Routines
You can use the SYS$DNS system service and run-time library routines together
to assign, maintain, and retrieve DECdns names. This section describes the
capabilities of each interface.
C.1.1.1 Using the SYS$DNS System Service
DECdns provides a single system service call (SYS$DNS) to create, delete, modify,
and retrieve DECdns names from a namespace. The SYS$DNS system service
completes asynchronously; that is, it returns to the client immediately after
making a name service call. The status returned to the client indicates whether a
request was queued successfully to the name service.
The SYS$DNSW system service is the synchronous equivalent of SYS$DNS. The
SYS$DNSW call is identical to SYS$DNS in every way except that SYS$DNSW
returns to the caller after the operation completes.
The SYS$DNS call has two main parameters:
• A function code that identifies the particular service to perform
• An item list that specifies all the parameters for the required function
The system service provides the following functions:
• Create and delete DECdns names in the namespace
• Enumerate DECdns names in a particular directory
• Add, read, remove, and test attributes and attribute values
• Add, create, remove, restore, and update directories
• Create, remove, and resolve soft links
• Create and remove groups
2. Use the SYS$DNS parse function to convert the full name string into an
opaque format. Specify the DNS$_NEXTCHAR_PTR item code to obtain the
length of the opaque name.
3. Optionally, reserve an event flag so you can check for completion of the
service.
4. Build an item list that contains the following elements:
• The opaque name for the object (resulting from the translation in step 2)
• The class name given by the application, which should contain the facility
code
• The class version assigned by the application
• An optional timeout value that specifies when the call expires
5. Optionally, provide the address of the DECdns status block to receive status
information from the name service.
6. Optionally, provide the address of the asynchronous system trap (AST) service
routine. AST routines allow a program to continue execution while waiting
for parts of the program to complete.
7. Optionally, supply a parameter to pass to the AST routine.
8. Call the create object function and provide all the parameters supplied in
steps 1 through 7.
If a clerk call is not complete when timeout occurs, then the call completes with
an error. The error is returned in the DECdns status block.
An application should check for errors that are returned; it is not enough to check
the return of the SYS$DNS call itself. You need to check the DECdns status
block to be sure no errors are returned by the DECdns server.
The following routine, written in C, shows how to create an object in the
namespace with the synchronous service SYS$DNSW. The routine demonstrates
how to construct an item list.
#include <dnsdef.h>
#include <dnsmsg.h>
/*
* Parameters:
* class_name = address of the opaque simple name of the class
* to assign to the object
* class_len = length (in bytes) of the class opaque simple name
* object_name= address of opaque full name of the object
* to create in the namespace.
* object_len = length (in bytes) of the opaque full name of the
* object to create
*/
create_object(class_name, class_len, object_name, object_len)
unsigned char *class_name; /*Format is a DECdns opaque simple name*\
unsigned short class_len;
unsigned char *object_name; /*Format is a DECdns opaque simple name*\
unsigned short object_len;
{
struct $dnsitmdef createitem[4]; /* Item list used by system service */
struct $dnscversdef version; /* Version assigned to the object */
struct $dnsb iosb; /* Used to determine DECdns server status */
int status; /* Status return from system service */
/*
* Construct the item list that creates the object:
*/
createitem[0].dns$w_itm_size = class_len; !
createitem[0].dns$w_itm_code = dns$_class;
createitem[0].dns$a_itm_address = class_name;
createitem[1].dns$w_itm_size = object_len; "
createitem[1].dns$w_itm_code = dns$_objectname;
createitem[1].dns$a_itm_address = object_name;
version.dns$b_c_major = 1; #
version.dns$b_c_minor = 0;
createitem[2].dns$w_itm_size = sizeof(struct $dnscversdef); $
createitem[2].dns$w_itm_code = dns$_version;
createitem[2].dns$a_itm_address = &version;
*((int *)&createitem[3]) = 0; %
status = sys$dnsw(0, dns$_create_object, &createitem, &iosb, 0, 0); &
if(status == SS$_NORMAL)
{
status = iosb.dns$l_dnsb_status; ’
}
return(status);
}
! The first entry in the item list is the address of the opaque simple name that
represents the class of the object.
" The second entry is the address of the opaque full name for the object.
# The next step is to build a version structure that indicates the version of the
object. In this case, the object is version 1.0.
$ The third entry is the address of the version structure that was just built.
% A value of 0 terminates the item list.
& The next step is to call the system service to create the object.
’ Check to see that both the system service and DECdns were able to perform
the operation without error.
Use the DNS$_MODVALUE item code to specify the value of the attribute. Note
that the DNS$_MODVALUE item code must be specified to add a single-valued
attribute. You can specify a null value for a set-valued attribute. DECdns
modifies attribute values in the following way:
• If the attribute exists and you specify an attribute value, the attribute value
is removed from a set-valued attribute. All other values are unaffected. For a
single-valued attribute, DECdns removes the attribute and its value from the
name.
• If you do not specify an attribute value, DECdns removes the attribute and
all values of the attribute for both set-valued and single-valued attributes.
To delete an attribute, use the DNS$_MODOPERATION item code.
The following is an example of how to use the DNS$_MODIFY_ATTRIBUTE
function code to add a new member to a group object. To do this, you add the new
member to the DNS$Members attribute of the group object. Use the following
function codes:
• Specify the group object (DNS$_ENTRY) and type (DNS$_LOOKINGFOR).
The type should be specified as object (DNS$K_OBJECT).
• Use DNS$_MODOPERATION to add a member to the DNS$Members
attribute (DNS$_ATTRIBUTENAME), which is a set-valued attribute (DNS$_
ATTRIBUTETYPE).
• Specify the new member object name in DNS$_MODVALUE.
• Use another DNS$_MODIFY_ATTRIBUTE call to assign access rights for the
new member to the DNS$ACS attribute of the member object.
Perform the following steps to modify an object with SYS$DNSW:
1. Build an item list that contains the following elements:
• Opaque name of the object you are modifying
• Type of object
• Operation to perform
• Type of attribute you are modifying
• Attribute name
• Value being added to the attribute
2. Supply any of the optional parameters described in Section C.2.1.
3. Call the modify attribute function, supplying the parameters established in
steps 1 and 2.
The following example, written in C, shows how to add a set-valued attribute and
a value to an object:
#include <dnsdef.h>
#include <dnsmsg.h>
/*
* Parameters:
* obj_name = address of opaque full name of object
* obj_len = length of opaque full name of object
* att_name = address of opaque simple name of attribute to create
* att_len = length of opaque simple name of attribute
* att_value= value to associate with the attribute
* val_len = length of added value (in bytes)
*/
add_attribute(obj_name, obj_len, att_name, att_len, att_value, val_len)
unsigned char *obj_name;
unsigned short obj_len;
unsigned char *att_name;
unsigned short att_len;
unsigned char *att_value;
unsigned short val_len;
main() {
struct $dnsitmdef moditem[7]; /* Item list for $DNSW */
unsigned char objtype = dns$k_object; /* Using objects */
unsigned char opertype = dns$k_present; /* Adding an object */
unsigned char attype = dns$k_set; /* Attribute will be type set */
struct $dnsb iosb; /* Used to determine DECdns status */
int status; /* Status of system service */
/*
* Construct the item list to add an attribute to an object.
*/
moditem[0].dns$w_itm_size = obj_len;
moditem[0].dns$w_itm_code = dns$_entry;
moditem[0].dns$a_itm_address = obj_name; !
moditem[1].dns$w_itm_size = sizeof(char);
moditem[1].dns$w_itm_code = dns$_lookingfor;
moditem[1].dns$a_itm_address = &objtype; "
moditem[2].dns$w_itm_size = sizeof(char);
moditem[2].dns$w_itm_code = dns$_modoperation;
moditem[2].dns$a_itm_address = &opertype; #
moditem[3].dns$w_itm_size = sizeof(char);
moditem[3].dns$w_itm_code = dns$_attributetype;
moditem[3].dns$a_itm_address = &attype; $
moditem[4].dns$w_itm_size = att_len;
moditem[4].dns$w_itm_code = dns$_attributename;
moditem[4].dns$a_itm_address = att_name; %
moditem[5].dns$w_itm_size = val_len;
moditem[5].dns$w_itm_code = dns$_modvalue;
moditem[5].dns$a_itm_address = att_value; &
*((int *)&moditem[6]) = 0; ’
/*
* Call $DNSW to add the attribute to the object.
*/
status = sys$dnsw(0, dns$_modify_attribute, &moditem, &iosb, 0, 0);(
if(status == SS$_NORMAL)
{
status = iosb.dns$l_dnsb_status; )
}
return(status);
}
! The first entry in the item list is the address of the opaque full name of the
object.
" The second entry shows that this is an object, not a soft link or child directory
pointer.
# The third entry is the operation to perform. The program adds an attribute
with its value to the object.
$ The fourth entry is the attribute type. The attribute has a set of values
rather than a single value.
% The fifth entry is the opaque simple name of the attribute being added.
& The sixth entry is the value associated with the attribute.
’ A value of 0 terminates the item list.
( A call is made to the SYS$DNSW system service to perform the operation.
) A check is made to see that both the system service and DECdns performed
the operation without error.
Whenever the DFS application receives the following mount request, DFS sends a
request for information to the DECdns Clerk:
MOUNT ACCESS_POINT dns-name vms-logical-name
To read the address attribute of the access point object, the DFS application
performs the following steps:
1. Translates the DECdns name that is supplied through the user to opaque
format using the SYS$DNS parse function
2. Reads the class attribute of the object with the $DNS read attribute function,
indicating that there is a second call to read other attributes of the object
3. Makes a second call to the SYS$DNS read attribute function to read the
address attribute of the object
4. Sends the DECdns name to the DFS server, which looks up the disk on which
the access point is located
5. Verifies that the DECdns name is valid on the DFS server
The DFS client and DFS server now can communicate to complete the mount
function.
C.2.3.2 Reading Attributes from DNS
When requesting information from DNS, an application always takes an object
name from the user, translates the name into opaque format, and passes it in an
item list to the DECdns Clerk.
Each read request returns a set of attribute values. The DNS$_READ_
ATTRIBUTE service uses a context item code called DNS$_CONTEXTVARTIME
to maintain context when reading the attribute values. The context item code
saves the last member that is read from the set. When the next read call is
issued, the item code sets the context to the next member in the set, reads it, and
returns it. The context item code treats single-valued attributes as though they
were a set of one.
If an enumeration call returns DNS$_MOREDATA, not all matching names or
attributes have been enumerated. If you receive this message, you should make
further calls, setting DNS$_CONTEXTVARTIME to the last value returned until
the procedure returns SS$_NORMAL.
The following program, written in C, shows how an application reads an object
attribute. The SYS$DNSW service uses an item list to return a set of objects.
Then the application calls a run-time library routine to read each value in the
set.
#include <dnsdef.h>
#include <dnsmsg.h>
/*
* Parameters:
* opaque_objname = address of opaque full name for the object
* containing the attribute to be read
* obj_len = length of opaque full name of the object
* opaque_attname = address of the opaque simple name of the
* attribute to be read
* attname_len = length of opaque simple name of attribute
*/
newset_dsc.dsc$w_length = dns$k_maxattribute;
newset_dsc.dsc$a_pointer = attsetbuf; /* Same buffer for */
/* each call */
set_status = dns$remove_first_set_value(&set_dsc, &value_dsc,
# &val_len, &cts_dsc,
&cts_len, &newset_dsc,
&setlen);
if(set_status == SS$_NORMAL)
{ $
readitem[4].dns$w_itm_code = dns$_contextvartime;
readitem[4].dns$w_itm_size = cts_len;
readitem[4].dns$a_itm_address = ctsbuf;
*((int *)&readitem[5]) = 0;
printf("\tValue: "); %
for(xx = 0; xx < val_len; xx++)
printf("%x ", attvalbuf[xx]);
printf("\n");
}
else if (set_status != 0)
{
printf("Error %d returned when removing value from set\n",
set_status);
exit(set_status);
}
} while(set_status == SS$_NORMAL);
}
else
{
printf("Error reading attribute = %d\n", read_status);
exit(read_status);
}
} while(read_status == DNS$_MOREDATA);
}
! The item list contains five entries:
• Opaque full name of the object with the attribute the program wants to
read
• Type of object to access
• Opaque simple name of the attribute to read
• Address of the buffer containing the set of values returned by the read
operation
• A value of 0 to terminate the item list
" The loop repeatedly calls the SYS$DNSW service to read the values of the
attribute because the first call might not return all the values. The loop
executes until $DNSW returns something other than DNS$_MOREDATA.
# The DNS$REMOVE_FIRST_SET_VALUE routine extracts a value from the
set.
$ This attribute name may be the context the routine uses to read additional
attributes. The attribute’s creation timestamp (CTS), not its value, provides
the context.
% Finally, display the value in hexadecimal format. (You could also take the
attribute name and convert it to a printable format before displaying the
result.)
See the discussion about setting confidence in the Guide to Programming with
DECdns for information about obtaining up-to-date data on read requests.
C.2.3.3 Enumerating DECdns Names and Attributes
The enumerate functions return DECdns names for objects, child directories, soft
links, groups, or attributes in a specific directory. Use either the asterisk (*) or
question mark (?) wildcard to screen enumerated items. DECdns matches any
single character against the specified wildcard.
Enumeration calls return a set of simple names or attributes. If an enumeration
call returns DNS$_MOREDATA, not all matching names or attributes have been
enumerated. If you receive this message, use the context-setting conventions
that are described for the DNS$_READ_ATTRIBUTE call. You should make
further calls, setting DNS$_CONTEXTVARNAME to the last value returned until
the procedure returns SS$_NORMAL. For more information, see the SYS$DNS
system service in the OpenVMS System Services Reference Manual: A–GETUAI.
The following program, written in C, shows how an application can read the
objects in a directory with the SYS$DNS system service. The values that
DECdns returns from read and enumerate functions are in different structures.
For example, an enumeration of objects returns different structures than an
enumeration of child directories. To clarify how to use this data, the sample
program demonstrates how to parse any set that the enumerate objects function
returns with a run-time library routine in order to remove the first value from
the set. The example also demonstrates how the program takes each value from
the set.
#include <dnsdef.h>
#include <dnsmsg.h>
/*
* Parameters:
* fname_p : opaque full name of the directory to enumerate
* fname_len : length of full name of the directory
*/
struct $dnsitmdef enumitem[4]; /* Item list for enumeration */
unsigned char setbuf[100]; /* Values from enumeration */
struct $dnsb enum_iosb; /* DECdns status information */
int synch_event; /* Used for synchronous AST threads */
unsigned short setlen; /* Length of output in setbuf */
enumerate_objects(fname_p, fname_len)
unsigned char *fname_p;
unsigned short fname_len;
{
int enumerate_objects_ast();
int status; /* General routine status */
int enum_status; /* Status of enumeration routine */
/* Set up item list */
enumitem[0].dns$w_itm_code = dns$_directory; /* Opaque directory name */
enumitem[0].dns$w_itm_size = fname_len;
enumitem[0].dns$a_itm_address = fname_p;
enumitem[1].dns$w_itm_code = dns$_outobjects; /* output buffer */
enumitem[1].dns$a_itm_ret_length = &setlen;
enumitem[1].dns$w_itm_size = 100;
enumitem[1].dns$a_itm_address = setbuf;
*((int *)&enumitem[2]) = 0; /* Zero terminate item list */
status = lib$get_ef(&synch_event); !
if(status != SS$_NORMAL)
{
printf("Could not get event flag to synch AST threads\n");
exit(status);
}
enum_status = sys$dns(0, dns$_enumerate_objects, &enumitem,
" &enum_iosb, enumerate_objects_ast, setbuf);
if(enum_status != SS$_NORMAL) #
{
printf("Error enumerating objects = %d\n", enum_status);
exit(enum_status);
}
status = sys$synch(synch_event, &enum_iosb); $
if(status != SS$_NORMAL)
{
printf("Synchronization with AST threads failed\n");
exit(status);
}
}
/* AST routine parameter: */
/* outbuf : address of buffer that contains enumerated names. */
%
unsigned char objnamebuf[dns$k_simplenamemax]; /* Opaque object name */
enumerate_objects_ast(outbuf)
unsigned char *outbuf;
{
struct $dnsitmdef cvtitem[3]; /* Item list for class name */
struct $dnsb iosb; /* Used for name service status information */
struct dsc$descriptor set_dsc, value_dsc, newset_dsc;
unsigned char simplebuf[dns$k_simplestrmax]; /* Object name string */
int enum_status; /* The status of the enumeration itself */
int status; /* Used for checking immediate status returns */
int set_status; /* Status of remove value routine */
unsigned short val_len; /* Length of set value */
unsigned short sname_len; /* Length of object name */
enum_status = enum_iosb.dns$l_dnsb_status; /* Check status */
if((enum_status != SS$_NORMAL) && (enum_status != DNS$_MOREDATA))
{
printf("Error enumerating objects = %d\n", enum_status);
sys$setef(synch_event);
exit(enum_status);
}
do
{
/*
* Extract object names from output buffer one
* value at a time. Set up descriptors for the extraction.
*/
set_dsc.dsc$w_length = setlen; /* Contains address of */
set_dsc.dsc$a_pointer = setbuf; /* the set whose values */
/* are to be extracted */
value_dsc.dsc$w_length = dns$k_simplenamemax;
value_dsc.dsc$a_pointer = objnamebuf; /* To contain the */
/* name of an object */
/* after the extraction */
newset_dsc.dsc$w_length = 100; /* To contain a new */
newset_dsc.dsc$a_pointer = setbuf; /* set structure after */
/* the extraction. */
$ Use the SYS$SYNCH call to make sure the DECdns Clerk has completed and
that all threads have finished executing.
% After enumerating objects, SYS$DNS calls an AST routine. The routine
shows how DNS$REMOVE_FIRST_SET_VALUE extracts object names from
the set returned by the DNS$_ENUMERATE_OBJECTS function.
& Use an item list to convert the opaque simple name to a string name so you
can display it to the user. The item list contains the following entries:
• Address of the opaque simple name to be converted
• Address of the buffer that will hold the string name
• A value of 0 to terminate the item list
’ This object name may provide the context for continuing the enumeration.
Append the context variable to the item list so the enumeration can continue
from this name if there is more data.
( Use the system service to enumerate the object names as long as there is
more data.
) Set the event flag to indicate that all AST threads have completed and that
the program can terminate.
C.3 Using the DCL Command DEFINE with DECdns Logical Names
When the DECdns Clerk is started on the operating system, the VAX system
creates a unique logical name table for DECdns to use in translating full names.
This logical name table, called DNS$SYSTEM, prevents unintended interaction
with other system logical names.
To define systemwide logical names for DECdns objects, you must have the
appropriate privileges to use the DCL command DEFINE. Use the DEFINE
command to create the logical RESEARCH.PROJECT_DISK, for example, by
entering the following DCL command:
$ DEFINE/TABLE=DNS$SYSTEM RESEARCH "ENG.RESEARCH"
When parsing a name, the SYS$DNS service specifies the logical name
DNS$LOGICAL as the table it uses to translate a simple name into a full name.
This name translates to DNS$SYSTEM (by default) to access the systemwide
DECdns logical name table.
To define process or job logical names for SYS$DNS, you must create a process
or job table and redefine DNS$LOGICAL as a search list, as in the following
example (note that elevated privileges are required to create a job table):
$ CREATE /NAME_TABLE DNS_PROCESS_TABLE
$ DEFINE /TABLE=LNM$PROCESS_DIRECTORY DNS$LOGICAL -
_$DNS_PROCESS_TABLE,DNS$SYSTEM
Once you have created the process or job table and redefined DNS$LOGICAL,
you can create job-specific logical names for DECdns by using the DCL command
DEFINE, as follows:
$ DEFINE /TABLE=DNS_PROCESS_TABLE RESEARCH "ENG.RESEARCH.MYGROUP"
Index–1
Argument passing Attributes (cont’d)
mechanisms (cont’d) Resource, Vol 2, 31–5
by reference, Vol 2, 18–14 Subsystem, Vol 2, 31–5
by value, Vol 2, 18–13
Arguments, Vol 2, 17–7
specifying, Vol 2, A–4
B
Arguments, mechanism vector, Vol 1, 9–35 Balance set, swapping, Vol 1, 12–12, 13–12
Arguments heading, in routine documentation, BASIC
Vol 2, 17–6 Compaq BASIC for OpenVMS Alpha, Vol 1,
arg_list data type, Vol 2, B–2 1–11
Arithmetic exceptions, on Alpha systems, Vol 1, data type declarations, Vol 2, B–22
9–13 implementation table, Vol 2, B–22
Arrays VAX BASIC, Vol 1, 1–11
mechanism, Vol 1, 9–35 BIOLM (buffered I/O limit) quota, Vol 2, 23–3
virtual address, Vol 1, 12–8, 13–10 32-bit descriptors, Vol 1, 11–2
ASCII (American Standard Code for Information 64-bit descriptors, Vol 1, 11–2
Interchange) 32-bit item list formats, Vol 1, 11–5
time, Vol 2, 27–7 64-bit item list formats, Vol 1, 11–6
Assemblers, Vol 1, 1–11 32-bit item lists, Vol 1, 11–5
ASSIGN command, Vol 2, 32–3 64-bit item lists, Vol 1, 11–6
AST routines, Vol 1, 8–1 BLISS
ASTs (asynchronous system traps), Vol 1, 1–17, data type declarations, Vol 2, B–25
2–20, 8–1; Vol 2, 24–21 implementation table, Vol 2, B–25
See also Synchronization BLISS-32, Vol 1, 1–11
access mode, Vol 1, 8–6 BLISS-64, Vol 1, 1–11
blocking, Vol 1, 7–14, 7–20 BLISS compiler
call frame, Vol 1, 8–3 alignment, Vol 1, 15–5
declaring, Vol 1, 8–2 consequences of noncompliant code, Vol 1, 6–9
delivery, Vol 1, 8–6, 8–8 Blocking ASTs
example, Vol 1, 8–10 description, Vol 1, 7–14
execution, Vol 1, 8–1 using, Vol 1, 7–20
in target process, Vol 1, 4–26 Block size options, Vol 1, 14–10
parameter, Vol 1, 8–9 Boolean data type, Vol 2, B–2
process wait state, Vol 1, 8–13 Boolean value flag, Vol 2, B–2
queuing, Vol 1, 8–2 Boot CPU, Vol 1, 5–1
quota, Vol 2, 23–3 Booting, an SMP system, Vol 1, 5–1
reentrant code, Vol 1, 8–3 Borders, virtual display, Vol 2, 22–12
service routine, Vol 1, 8–8 Boundary tags, Vol 1, 14–8
shared data access, Vol 1, 8–3 Broadcast messages, Vol 2, 22–43
system service, Vol 1, 8–2 buffer data type, Vol 2, B–2
writing, Vol 1, 8–2 Buffered I/O, operations, Vol 2, 27–18
ASTs delivery Buffer object management, Vol 2, 23–50
kernel threads, Vol 1, 8–11 Buffer objects, Fast I/O, Vol 2, 23–49
AST synchronization, shared data, Vol 1, 8–4 buffer_length data type, Vol 2, B–2
ast_procedure data type, Vol 2, B–2 BYPASS privilege, Vol 2, 23–5
Asynchronous input/output, Vol 2, 23–21 byte_signed data type, Vol 2, B–2
Asynchronous system services, Vol 2, 20–5 BYTLM (buffered I/O byte count) quota, Vol 2,
23–3
Asynchronous system traps
See ASTs
Atomic instructions, effect on synchronization, Vol C
1, 6–5 C
Atomicity, definition, Vol 1, 6–3 Compaq C for OpenVMS Alpha, Vol 1, 1–11
Atomic memory reference, Vol 1, 6–3 data type declarations, Vol 2, B–28
Attributes implementation table, Vol 2, B–28
Dynamic, Vol 2, 31–5 VAX C, Vol 1, 1–11
Holder Hidden, Vol 2, 31–5
Name Hidden, Vol 2, 31–5
No Access, Vol 2, 31–5
Index–2
C++, Vol 1, 1–11 Command language interpreter, Vol 1, 2–4
data type declarations, Vol 2, B–28 See CLI
implementation table, Vol 2, B–28 Common areas, per-process, Vol 1, 3–6
Caching, Vol 1, 7–20 Common blocks
Callable system routines, Vol 1, 1–15 aligning, Vol 2, 28–4
Call entry installing as a shared image, Vol 2, 26–6
for RTL, Vol 2, 19–4 interprocess, Vol 2, 26–6
for system service, Vol 2, 20–3 modifying, Vol 1, 3–6
Call-frame condition handlers, Vol 1, 9–24 Common event flag clusters, Vol 1, 6–25
Call frames, Vol 2, 18–3 permanent, Vol 1, 6–27
ASTs, Vol 1, 8–3 temporary, Vol 1, 6–27
exit handlers, Vol 1, 9–74 Compaq C++ compiler, consequences of
Calling ASTs, Vol 1, 8–7 noncompliant code, Vol 1, 6–9
Calling sequence, system routine, Vol 2, 18–5 Compaq C compiler
Calling standard, Vol 1, 1–9, 11–28; Vol 2, 19–1 alignment, Vol 1, 15–4
conventions, Vol 2, 18–1 consequences of noncompliant code, Vol 1, 6–9
Call stacks, unwinding, Vol 1, 9–46 Compaq COBOL, Vol 1, 1–11
Capabilities mechanism, Vol 1, 4–32 Compaq DECwindows Motif, Vol 2, 22–7
Capability masks creating WSA pseudo workstation devices, Vol
CPU, Vol 1, 4–34 2, 22–8
process, Vol 1, 4–34 height and width restrictions, Vol 2, 22–8
Capability types, Vol 1, 4–33 Compaq DECwindows Motif for OpenVMS
Catchall handlers, Vol 1, 9–25, 9–43 software, programming libraries and tools,
Chaining, Vol 2, 24–5 Vol 1, 1–19
item lists, Vol 1, 11–4 Compaq Extended Math Library for OpenVMS,
Change-mode handlers, Vol 1, 9–11 Vol 1, 1–17
channel data type, Vol 2, B–3 Compaq Fortran compiler
Channels, Vol 1, 3–10 alignment, Vol 1, 15–6
assigning I/O, Vol 2, 23–11 Compaq language implementation tables
deassigning, Vol 2, 23–24
See Implementation tables
Character string routines, Vol 2, 24–14
Compaq POSIX Threads Library, Vol 1, 1–15,
translation routines, Vol 2, 24–14
2–18
Character strings, Vol 2, B–3
.H file support, Vol 2, 21–2
char_string data type, Vol 2, B–3
Comparing 32-bit and 64-bit item lists, Vol 1,
Checking access and protection of logical name
11–4
tables, Vol 2, 32–10
Compatibility mode handlers, Vol 1, 9–11
$CHFDEF2 macro, Vol 1, 9–27
Compilers, Vol 1, 1–11
$CHFDEF macro, Vol 1, 9–27
alignment, Vol 1, 15–4
CISC, architecture, Vol 1, 1–4
complex_number data type, Vol 2, B–3
Class scheduler, Vol 1, 4–36
Components, of item lists, Vol 2, B–12
Class scheduler database, Vol 1, 4–40
Condition codes
Class_schedule, SYSMAN command, Vol 1, 4–37
chaining, Vol 1, 9–53
CLI (command language interpreter), Vol 1, 2–4;
signaling, Vol 1, 9–33
Vol 2, 24–2
SS$_EXQUOTA, Vol 1, 9–21
CLI access routine, Vol 2, 24–2
SS$_NOPRIV, Vol 1, 9–21
Client/server computing, Vol 1, 1–6
Condition handlers, Vol 2, 17–11
Clients, Vol 1, 1–6
Clocks, setting system, Vol 2, 27–11 See also Signal argument vectors
Clusterwide logical name tables, Vol 2, 32–6, argument list, Vol 1, 9–27
32–8, 32–9 arithmetic, Vol 1, 9–16
CMS, Vol 1, 1–15 call frame, Vol 1, 9–24
COBOL catchall, Vol 1, 9–25, 9–43
data type declarations, Vol 2, B–30 condition code, Vol 1, 9–65
implementation table, Vol 2, B–30 continuing execution of, Vol 1, 9–64
Command Definition Utility (CDU), Vol 1, 1–14, debugging, Vol 1, 9–70
1–19 default, Vol 1, 9–42
establishing, Vol 1, 9–5
example, Vol 1, 9–69
Index–3
Condition handlers (cont’d) Condition values
exiting, Vol 1, 9–66; Vol 2, B–7 returned (cont’d)
last-chance, Vol 1, 9–43 in I/O status block, Vol 2, 17–12
last-chance exception vector, Vol 1, 9–25 in mailbox, Vol 2, 17–12
mechanism argument vectors, Vol 1, 9–35 in R0, Vol 2, 17–4
primary exception vector, Vol 1, 9–24 signaled in register, Vol 2, 17–6, 17–12
resignaling, Vol 1, 9–64 RTL symbols, Vol 2, 19–6
searching for, Vol 1, 9–24 severity, Vol 1, 9–19
secondary exception vectors, Vol 1, 9–24 signaled, Vol 2, 17–6, 17–12
signal argument array, Vol 1, 9–32 symbolic codes, Vol 2, 20–8
software supplied, Vol 1, 9–41 testing, Vol 2, 20–8, 20–9
specifying, Vol 1, 9–4 Condition Values Returned heading, Vol 2, 17–11
traceback, Vol 1, 9–25, 9–42 cond_value data type, Vol 2, B–6
types, Vol 1, 9–41 context data type, Vol 2, B–7
types of action, Vol 1, 9–45 Control actions, inhibiting, Vol 2, 22–42
unwinding, Vol 1, 9–64 Coordinated Universal Time
use of, Vol 1, 9–27 See UTC system services
user-supplied, Vol 1, 9–41 CPU characteristics
writing, Vol 1, 9–63 SMP system, Vol 1, 5–1
Condition handling, Vol 1, 9–3 CPUs (central processing units)
See also Condition handlers affinity scheduling, Vol 1, 4–32
See also Condition Handling Facility capabilities scheduling, Vol 1, 4–32
See also Condition values class scheduling, Vol 1, 4–36
See also Exception conditions CPU-specific pages, Vol 1, 12–1
See also Exceptions Create Mailbox and Assign Channel system service
See also Message utility (MESSAGE) See also SYS$CREMBX system service
alignment fault reporting, Vol 1, 9–15 $CRFCTLTABLE macro, Vol 2, 25–1, 25–2
arithmetic exceptions, Vol 1, 9–13 $CRFFIELDEND macro, Vol 2, 25–1, 25–4
continuing, Vol 1, 9–45 $CRFFIELD macro, Vol 2, 25–1, 25–3
displaying messages, Vol 1, 9–49 Cross-Reference routines, Vol 2, 25–1
GOTO unwind, Vol 1, 9–45 C system( ) call, Vol 1, 2–6
hardware exception conditions, Vol 1, 9–12 Ctrl/C key sequence, Vol 2, 22–33
logging error messages, Vol 1, 9–6 Ctrl/Y key sequence, Vol 2, 22–33
logging error messages to a file, Vol 1, 9–55 Ctrl/Z key sequence, Vol 2, 22–5, 23–31
mechanism argument vectors, Vol 1, 9–35, Current procedure, Vol 1, 9–48
9–37 Current time, Vol 2, 27–9
mechanism array format, Vol 1, 9–37 Cursor movement, Vol 2, 22–21
resignaling, Vol 1, 9–45, 9–67
return status, Vol 1, 9–21 D
run-time library support routines, Vol 1, 9–17
signal argument vectors, Vol 1, 9–33 Data
signaling a condition, Vol 1, 9–45 aligning, Vol 2, 28–4
stack traceback, Vol 1, 9–6 interprocess, Vol 2, 26–6
stack unwind, Vol 1, 9–6, 9–45 sharing, Vol 2, 26–6
unwinding, Vol 1, 9–67 Data alignment, Vol 1, 15–1
user-defined messages, Vol 1, 9–6 exception reporting, Vol 1, 9–15
VAX hardware exceptions, Vol 1, 9–12 Databases, record, Vol 2, 28–12
Condition Handling Facility (CHF), Vol 1, 9–41 Data Cells, Vol 1, 2–23
definition, Vol 1, 9–1 Data management, Vol 1, 1–20
function, Vol 1, 9–4 Data types, Vol 2, 17–7, B–1
Conditions Ada declarations, Vol 2, B–17
for exception, Vol 1, 9–6 APL declarations, Vol 2, B–20
Condition values, Vol 1, 9–18 to 9–20, 9–31; Vol BASIC declarations, Vol 2, B–22
2, 18–22, 20–7, B–6 BLISS declarations, Vol 2, B–25
definition, Vol 1, 9–63 C++ declarations, Vol 2, B–28
information provided by, Vol 2, 20–8 C declarations, Vol 2, B–28
returned, Vol 2, 17–12 COBOL declarations, Vol 2, B–30
Fortran declarations, Vol 2, B–34
Index–4
Data types (cont’d) Default logical name tables
MACRO declarations, Vol 2, B–48 group, Vol 2, 32–6
OpenVMS, Vol 2, B–1, B–2 job, Vol 2, 32–5
standard, Vol 2, 17–7 process, Vol 2, 32–4
usage, Vol 2, 17–6 quotas, Vol 2, 32–15
Pascal declarations, Vol 2, B–38 system, Vol 2, 32–6
PL/I declarations, Vol 2, B–42 Default zone, Vol 1, 14–12
RPG II declarations, Vol 2, B–50 DEFINE command, Vol 2, 32–3
SCAN declarations, Vol 2, B–52 /DELETE qualifier
symbolic code, Vol 2, 17–7 LIBRARY command, Vol 2, 26–2
Date and time format logical names, Vol 2, 27–29 Delta/XDelta Debugger (DELTA/XDELTA), Vol 1,
Date format logical names, Vol 2, 27–29 to 27–30 1–13
Dates Delta time, Vol 2, 27–1
64-bit system format, Vol 2, 27–1 example, Vol 2, 27–6
128-bit system format, Vol 2, 27–36 in system format, Vol 2, 27–6
getting current system, Vol 2, 27–10 Descriptors
Smithsonian base, Vol 2, 27–1 class, Vol 2, 18–19
Date/time formats, Vol 2, 27–22 class codes, Vol 2, 17–10
Date/time manipulation, converting, Vol 2, 27–7 data type, Vol 2, 18–19
date_time data type, Vol 2, B–7 fields, Vol 2, 18–16
Deadlock detection, Vol 1, 7–8 Detached processes, Vol 1, 2–1
Debuggers, Vol 1, 1–13 creating, Vol 1, 2–13
Debugging debugging, Vol 1, 2–15
BUGCHECKFATAL, Vol 1, 1–14 Developing application programs, Vol 1, 1–7
condition handler, Vol 1, 9–70 Device drivers
CPUSPINWAIT, Vol 1, 1–14 last channel deassign, Vol 2, 23–4
detached process, Vol 1, 2–15 SHARE privilege, Vol 2, 23–4
exit handler, Vol 1, 9–70 Devices
MULTIPROCESSING, Vol 1, 1–14 allocating, Vol 2, 23–32
POOLCHECK, Vol 1, 1–14 deallocating, Vol 2, 23–33
subprocess, Vol 1, 2–15 default name, Vol 2, 23–28
SYSTEM_CHECK, Vol 1, 1–14 getting information about, Vol 2, 23–28
DECdns call, timeout, Vol 2, C–5 implicit allocation, Vol 2, 23–33
DECdns naming conventions names, Vol 2, 23–27
defining logicals, Vol 2, C–16 ownership, Vol 2, 23–4
logical names, Vol 2, C–16 protection, Vol 2, 23–5
DECdns objects SHARE privilege, Vol 2, 23–4
creating, Vol 2, C–4 Device types, Vol 2, 23–29
reading attributes, Vol 2, C–10 device_name data type, Vol 2, B–7
DECdtm services DIOLM (direct I/O limit)
aborted, Vol 2, 29–1 quota, Vol 2, 23–3
atomic, Vol 2, 29–1 Direct I/O, Vol 2, 27–18
committed, Vol 2, 29–1 Directives
distributed transaction, Vol 2, 29–1 See also Message utility (MESSAGE)
introduction to programming, Vol 2, 29–1 .END, Vol 1, 9–59
support for transaction processing, Vol 1, 1–18 .FACILITY, Vol 1, 9–58
DECforms, Vol 2, 22–2 .SEVERITY, Vol 1, 9–59
Declaring ASTs, Vol 1, 8–2 .TITLE, Vol 1, 9–60
DEClinks, Vol 1, 1–20 Directory logical name tables
DECset, Vol 1, 1–20 process, Vol 2, 32–3
DEC Text Processing Utility (DECTPU), Vol 2, system, Vol 2, 32–3
22–1 Directory table quotas, Vol 2, 32–15
DECTPU, Vol 1, 1–10 Disk files, opening, Vol 1, 12–14, 13–14
DECW$TERM_PORT example program, Vol 1, Disk volumes
2–15 mounting, Vol 2, 23–34
Deep directories, Vol 2, 28–2 Dispatcher, exception, Vol 1, 9–24
Index–5
Distributed computing, Vol 1, 1–6 Escape sequences, read, Vol 2, 23–31
Distributed environments, Vol 1, 1–6 EV6 Alpha processor, Vol 1, 6–9
Distributed processing, Vol 1, 1–5 EVE (Extensible Versatile Editor), Vol 1, 1–10
Documentation format Event flag clusters
See System routine documentation deleting, Vol 1, 6–27
Double-width characters disassociating, Vol 1, 6–27
See also Screen management specifying name for, Vol 1, 6–26
See also Virtual displays Event flags, Vol 1, 1–17, 2–20, 6–20
specifying, Vol 2, 22–21 See also Synchronization
Dynamic attributes, Vol 2, 31–5 allocation of, Vol 2, 24–17
Dynamic memory allocation, Vol 1, 12–5 clearing, Vol 1, 6–31
cluster, Vol 1, 6–21; Vol 2, B–7
common, Vol 1, 6–21
E for interprocess communication, Vol 1, 3–8
Echo local, Vol 1, 3–2, 6–21
terminal, Vol 2, 22–40 number, Vol 2, B–7
terminators, Vol 2, 22–25 numbers, Vol 1, 6–21
Editors, Vol 1, 1–10 setting, Vol 1, 6–31
EDT, Vol 1, 1–10 specifying, Vol 1, 6–22
EVE, Vol 1, 1–10 wait, Vol 1, 6–29
TECO, Vol 1, 1–10 Event flag service, example using, Vol 1, 6–34
vi (POSIX), Vol 1, 1–10 Event flag zero (0), Vol 1, 6–23
EFN 128 event flag Exception conditions, Vol 1, 9–2, 9–6; Vol 2,
EFN$C_ENF, Vol 1, 6–22, 6–23 17–11
ef_cluster_name data type, Vol 2, B–7 returning condition value, Vol 1, 9–7
ef_number data type, Vol 2, B–7 signaling, Vol 1, 9–6, 9–7, 9–16, 9–28, 9–49
.END directive, Vol 1, 9–59 Exceptions
ENQLM process limit, Vol 1, 7–9 definition, Vol 1, 9–2
Enqueue process limit quota, Vol 1, 7–9 dispatcher, Vol 1, 9–24
Entry masks, Vol 2, B–15 floating-point underflow, Vol 1, 9–16
Entry points handling by run-time library, Vol 1, 9–15
CALL entry points, Vol 2, 19–4, 20–4 type, Vol 1, 9–6
RTL names, Vol 2, 19–3 EXE$READ_PROCESS routine, Vol 1, 4–43 to
Environments 4–45
client/server, Vol 1, 1–6 EXE$WRITE_PROCESS routine, Vol 1, 4–45 to
common code, Vol 1, 1–9 4–47
common language, Vol 1, 1–9 Execution context, Vol 1, 2–2
computing, Vol 1, 1–5 Executive images
distributed, Vol 1, 1–6 linking, Vol 1, 4–51 to 4–52
hyperinformation, Vol 1, 1–20 loading, Vol 1, 4–52 to 4–56
open system, Vol 1, 1–5 unloading, Vol 1, 4–56 to 4–58
production systems, Vol 1, 1–5 writing, Vol 1, 4–48 to 4–50
EOF (end-of-file), Vol 2, 22–5 Executive mode
Equivalence names ASTs, Vol 1, 8–12
defining, Vol 2, 32–2 Executive stack, Vol 1, 2–22
format convention, Vol 2, 32–17 Exit handlers, Vol 1, 4–70, 9–74; Vol 2, 23–31
Error checking, Vol 2, 20–9 debugging, Vol 1, 9–77
Error handling establishing, Vol 1, 9–75
See Condition handling writing, Vol 1, 9–77
Error recovery, Vol 2, 23–11 Exits
Error returns, Vol 2, 18–22 See also Exit handlers
Errors forced, Vol 1, 4–70
returning condition value, Vol 2, 18–22 image, Vol 1, 4–68, 9–74
signaling condition value, Vol 2, 18–23 exit_handler_block data type, Vol 2, B–7
Errors, signaling, Vol 1, 9–5 Explanatory text
in argument documentation, Vol 2, 17–10
in routine documentation, Vol 2, 17–4
Index–6
Explicit affinity, Vol 1, 4–35 Floating-point overflow, Vol 1, 9–16
Extended address space, Vol 1, 13–3, 13–4 Floating-Point Registers and Execution Data
physical address space, Vol 1, 13–3 Blocks
virtual address space, Vol 1, 13–4 See FREDs
Extended file names, Vol 2, 28–2 Floating-point register usage, Vol 2, 18–3
Extended File Specifications, Vol 2, 28–2 Floating-point underflow, Vol 1, 9–16
Extents, defining section, Vol 1, 12–15, 13–15 floating_point data type, Vol 2, B–8
/EXTRACT qualifier Forced exit, Vol 1, 4–70
LIBRARY command, Vol 2, 26–2 Foreign commands, Vol 2, 24–3
Foreign devices, Vol 2, 23–5
F Foreign volumes, Vol 2, 23–4, 23–6
Format convention of equivalence names, Vol 2,
FAB data type, Vol 2, B–7 32–17
FABs (file access blocks), Vol 2, 28–15, B–7 Format convention of logical names, Vol 2, 32–17
.FACILITY directive, Vol 1, 9–58 Format heading, Vol 2, 17–2
Facility identifiers, Vol 2, 31–4
See also System routine documentation
FAO argument, signaling, Vol 1, 9–62
Fortran
FAO parameter, specifying, Vol 1, 9–62
Compaq Fortran 90, Vol 1, 1–12
Fast I/O, Vol 2, 23–48 to 23–51
Compaq Fortran for OpenVMS Alpha, Vol 1,
benefits, Vol 2, 23–48
1–11
buffer objects, Vol 2, 23–49
Compaq Fortran for OpenVMS VAX, Vol 1,
Fast Path, Vol 2, 23–48, 23–51 to 23–52
1–11
File access, protection, Vol 2, B–8
data type declarations, Vol 2, B–34
File access blocks implementation table, Vol 2, B–34
See FABs FREDs (Floating-Point Registers and Execution
File access strategies, Vol 2, 28–2 Data Blocks), Vol 1, 2–22
File attributes, Vol 2, 28–1 Function codes, Vol 2, 23–10
Files Function modifiers, Vol 2, 23–11
attributes, Vol 2, 28–1, 28–2 IO$M_INHERLOG, Vol 2, 23–6
complete access, Vol 2, 28–2 types of
discrete records access, Vol 2, 28–2 IO$M_DATACHECK, Vol 2, 23–11
mapping, Vol 2, 28–4 IO$M_INHRETRY, Vol 2, 23–11
record-by-record access, Vol 2, 28–2 Function value returns, for RTL routines, Vol 2,
sequential, Vol 2, 28–12 19–6
sequential and indexed access, Vol 2, 28–2 function_code data type, Vol 2, B–11
File terminators, Vol 2, 23–31
file_protection data type, Vol 2, B–8
Fixed-size stack frames, Vol 2, 18–5 G
Flags Global sections, Vol 1, 12–16, 13–16; Vol 2, 26–9,
See also Event flags B–16
Flag words, bit mask, Vol 2, B–14 characteristics, Vol 1, 12–16, 13–16
Floating-point numbers, Vol 2, B–3 to B–11 definition, Vol 1, 12–13, 13–13
D_floating complex, Vol 2, B–3 for interprocess communication, Vol 1, 3–8
D_floating standard, Vol 2, B–9 mapping, Vol 1, 12–20, 13–19
F_floating complex, Vol 2, B–3 multiprocessing, Vol 1, 6–19
F_floating standard, Vol 2, B–8 name, Vol 1, 12–17, 13–17
G_floating complex, Vol 2, B–4 paging file, Vol 1, 12–21, 13–20
G_floating standard, Vol 2, B–9 permanent, Vol 2, 26–13
H_floating complex, Vol 2, B–4 temporary, Vol 2, 26–13
H_floating standard, Vol 2, B–10 writable, Vol 1, 6–19
S_floating complex, Vol 2, B–5 Global symbols, Vol 2, 26–4
S_floating standard, Vol 2, B–10 signaling with, Vol 1, 9–61
T_floating complex, Vol 2, B–5 GMT (Greenwich Mean Time), Vol 2, 27–36
T_floating standard, Vol 2, B–11 GOTO unwind operations, Vol 1, 9–49
X_floating complex, Vol 2, B–6 Granularity
X_floating standard, Vol 2, B–11 of resources, Vol 1, 7–3
on OpenVMS Alpha systems, Vol 1, 6–3
Index–7
Granularity (cont’d) I/O channel indexes, Vol 2, B–3
on OpenVMS VAX systems, Vol 1, 6–3 I/O channels, Vol 2, 23–11
Graphical interfaces, creating, Vol 1, 1–20 deassigning, Vol 2, 23–24
Group logical name tables, Vol 2, 32–6 I/O completion
recommended test, Vol 2, 23–18
H status, Vol 2, 23–23
synchronizing, Vol 2, 23–13
Handlers, change and compatibility modes, Vol 1, I/O functions
9–11 codes, Vol 2, 23–10, 23–13
Hardware process control blocks modifier, Vol 2, 23–11
See HWPCBs I/O operations
Hardware registers logical, Vol 2, 23–6
for Alpha, Vol 2, 18–2 overview, Vol 2, 23–2
for VAX, Vol 2, 18–1 physical, Vol 2, 23–5
.H files quotas, privileges, and protection, Vol 2, 23–2
from SYS$STARLET_C.TLB to support Compaq virtual, Vol 2, 23–6
POSIX Threads Library, Vol 2, 21–2 I/O performance
provided by SYS$STARLET_C.TLB, Vol 2, Fast I/O, Vol 2, 23–48
21–2 Fast Path, Vol 2, 23–48
Hibernation, Vol 1, 4–63 I/O requests
alternate method, Vol 1, 4–66 canceling, Vol 2, 23–26
and AST, Vol 1, 8–13 queuing, Vol 2, 23–12
compared with suspension, Vol 1, 4–64 I/O services
High-performance sort, Vol 1, 1–19 asynchronous version, Vol 2, 23–19
Holder Hidden attribute, Vol 2, 31–5 synchronous version, Vol 2, 23–19
Holder records, Vol 2, 31–8 I/O status blocks
adding, Vol 2, 31–12 See IOSBs
format, Vol 2, 31–9 I/O system services, Vol 1, 1–18
modifying, Vol 2, 31–14 ICBs (invocation context blocks), Vol 2, B–12
removing, Vol 2, 31–16 ICC system services, Vol 1, 3–21
HWPCBs (hardware process control blocks), Vol 1, identifier data type, Vol 2, B–11
2–21, 2–22 Identifier names, translating, Vol 2, 31–11
Hyperinformation environment, Vol 1, 1–20 Identifier records, Vol 2, 31–8
adding to rights database, Vol 2, 31–12
I format, Vol 2, 31–8
modifying, Vol 2, 31–13
I/O (input/output)
removing from rights database, Vol 2, 31–16
asynchronous, Vol 2, 23–21
Identifiers, Vol 2, 31–1, 31–2
checking device type, Vol 2, 23–29
adding to rights database, Vol 2, 31–12
complex, Vol 2, 22–2
attributes, Vol 2, 31–4, 31–5
echo, Vol 2, 22–40
defining, Vol 2, 31–1
exit handler, Vol 2, 23–31
determining holders of, Vol 2, 31–13
lowercase, Vol 2, 22–42
facility, Vol 2, 31–4
reading a single line, Vol 2, 22–4
format, Vol 2, 31–2
reading several lines, Vol 2, 22–5
general, Vol 2, 31–2
screen updates, Vol 2, 22–31
global sections, Vol 2, B–16
simple, Vol 2, 22–2
new attributes, Vol 2, 31–5
status, Vol 2, 23–22
removing from rights database, Vol 2, 31–16
synchronous, Vol 2, 23–19
rights, Vol 2, B–16
terminator, Vol 2, 22–4
rights database, Vol 2, B–16
end of file, Vol 2, 23–31
system-defined, Vol 2, 31–3
record, Vol 2, 23–31
UIC, Vol 2, 31–3
timeout, Vol 2, 22–41
user, Vol 2, B–16, B–17
unsolicited input, Vol 2, 22–36
Identifier values, translating, Vol 2, 31–11
uppercase, Vol 2, 22–42
If states, composed input, Vol 2, 22–29
using SYS$QIO system service, Vol 2, 23–23
using SYS$QIOW system service, Vol 2, 23–23
writing simple character data, Vol 2, 22–6
Index–8
IMAGELIB.OLB file, Vol 2, 26–5 Interprocess communication (cont’d)
Image rundown, Vol 1, 9–74 mailboxes, Vol 1, 3–8
Image rundown, effect on logical names, Vol 2, using, Vol 1, 3–8
32–5 shareable logical names, Vol 2, 32–16
Images Interprocess control, Vol 1, 3–1
exit, Vol 1, 4–68 Interrupt priority level, Vol 1, 6–7
exiting, Vol 1, 9–74 See IPL
for subprocess, Vol 1, 2–12 Interrupt requests, SMP systems, Vol 1, 5–2
loading site-specific, Vol 2, 31–30 Intra-Cluster communications, Vol 1, 3–1, 3–21
rundown activity, Vol 1, 4–69 clients, Vol 1, 3–26
shareable, Vol 2, 26–3 concepts, Vol 1, 3–22
Image sections, Vol 1, 12–26, 13–23 design considerations, Vol 1, 3–23
Impersonation services, Vol 2, 31–20 programming considerations, Vol 1, 3–25
Implementation tables servers, Vol 1, 3–25
Ada, Vol 2, B–17 Intraprocess communication, Vol 1, 3–1
APL, Vol 2, B–20 common area, Vol 1, 3–6
BASIC, Vol 2, B–22 global symbols, Vol 1, 3–5
BLISS, Vol 2, B–25 Invocation context blocks
C and C++, Vol 2, B–28 See ICBs
COBOL, Vol 2, B–30 Invocation handles, Vol 2, B–12
Fortran, Vol 2, B–34 invo_context_blk data type, Vol 2, B–12
MACRO language, Vol 2, B–48 invo_handle data type, Vol 2, B–12
OpenVMS usage, Vol 2, B–1 IOSBs (I/O status blocks), Vol 1, 8–4; Vol 2, B–12
Pascal, Vol 2, B–38 in synchronization, Vol 2, 23–13
PL/I, Vol 2, B–42 return condition value field, Vol 2, 23–23
RPG II, Vol 2, B–50 io_status_block data type, Vol 2, B–12
SCAN, Vol 2, B–52 IPL (interrupt priority level), Vol 1, 6–7
Implicit affinity, Vol 1, 4–35 Item lists
IM semaphore, Vol 1, 6–17 chaining, Vol 1, 11–4
Initialization segments, Vol 1, 11–5
argument list, Vol 2, 33–5 item_list_2 data type, Vol 2, B–12
volume item_list_3 data type, Vol 2, B–13
from within a program, Vol 2, 23–36 item_list_pair data type, Vol 2, B–13
within a program item_quota_list data type, Vol 2, B–13
example, Vol 2, 23–36
Initialization routines
declaring, Vol 2, 33–6 J
dispatching, Vol 2, 33–7 Jacket routines, Vol 2, 24–1
options, Vol 2, 33–7 Job logical name tables, Vol 2, 32–5, 32–15
INITIALIZATION_ROUTINE macro, Vol 1, 4–50 JSB call format, Vol 2, 17–4
Inner mode (IM) semaphore, Vol 1, 6–17 JSB entry points, Vol 2, 19–6
Inner mode access, Vol 1, 2–20
Inner mode ASTs, Vol 1, 8–12
Inner mode synchronization, Vol 1, 6–17
K
Input address arrays, Vol 1, 12–8, 13–9 Kernel mode ASTs, Vol 1, 8–12
Instruction memory barriers, Vol 1, 6–16 Kernel stacks, Vol 1, 2–22
Instructions, queue, Vol 1, 6–20 Kernel thread blocks, Vol 1, 2–21
Integer and floating-point routines, Vol 2, 24–12 See KTBs
Integer register usage, Vol 2, 18–2 Kernel threads
Interlocked instructions, Vol 1, 6–6, 6–15, 6–20 advantages, Vol 1, 2–17
Interlocked memory instructions, using, Vol 1, 6–9 AST delivery, Vol 1, 8–11
Internal file identifiers, Vol 2, 32–17 definition, Vol 1, 2–17
Interpreters, Vol 1, 1–11 execution, Vol 1, 4–63
Interprocess communication, Vol 1, 3–1, 3–7 hibernating, Vol 1, 4–63
event flags, Vol 1, 3–8 model, Vol 1, 2–19
global sections, Vol 1, 3–8 priority, Vol 1, 4–32
lock management services, Vol 1, 3–8 region, Vol 1, 2–22
logical names, Vol 1, 3–8 scheduling, Vol 1, 4–32
Index–9
Kernel threads (cont’d) LIB$FFS, Vol 2, 24–10
suspending, Vol 1, 4–63 LIB$FILE_SCAN system routine, Vol 2, 24–22,
Keypads, reading from, Vol 2, 22–26 24–23
Key tables, reading from, Vol 2, 22–29 LIB$FILE_SCAN_END system routine, Vol 2,
KTBs (kernel thread blocks), Vol 1, 2–21 24–23
LIB$FIND_FILE system routine, Vol 2, 24–22
L LIB$FIND_FILE_END system routine, Vol 2,
24–22
Languages
LIB$FIND_VM_ZONE routine, Vol 1, 14–7
ANSI/ISO, Vol 1, 1–6
LIB$FIXUP_FLT routine, Vol 1, 9–73
compilers, Vol 1, 1–11
LIB$FLT_UNDER procedure call, Vol 2, 18–14
Last-chance exception vectors, Vol 1, 9–25
LIB$FLT_UNDER routine, Vol 1, 9–16
LDR$LOAD_IMAGE routine, Vol 1, 4–53 to 4–56
LIB$FREE_EF system routine, Vol 2, 24–16
LDR$UNLOAD_IMAGE routine, Vol 1, 4–56 to
LIB$FREE_LUN system routine, Vol 2, 24–16
4–58
LIB$FREE_TIMER routine, Vol 2, 27–19
LIB$ADDX routine, Vol 2, 27–7
LIB$FREE_VM routine, Vol 1, 12–4, 13–6
LIB$ADD_TIME routine, Vol 2, 27–7
LIB$FREE_VM_PAGE routine, Vol 1, 12–4, 13–6
LIB$ASN_WTH_MBX routine, Vol 1, 3–10
LIB$GETJPI system routine, Vol 1, 4–9
LIB$AST_IN_PROG routine, Vol 2, 24–22
LIB$GETQUI routine, Vol 2, 27–21
LIB$ATTACH routine, Vol 2, 24–9
LIB$GET_COMMON routine, Vol 1, 3–6; Vol 2,
LIB$CALLG routine, Vol 2, 24–15
24–5
LIB$CONVERT_DATE_STRING system routine,
LIB$GET_DATE_FORMAT system routine, Vol 2,
Vol 2, 27–33
27–34
LIB$CRC routine, Vol 2, 24–16
LIB$GET_EF system routine, Vol 2, 24–16
LIB$CRC_TABLE routine, Vol 2, 24–16
LIB$GET_FOREIGN routine, Vol 2, 24–3
LIB$CREATE_DIR routine, Vol 2, 24–22
LIB$GET_INPUT procedure call, Vol 2, 19–4
LIB$CREATE_USER_VM_ZONE routine, Vol 1,
LIB$GET_INPUT routine, Vol 2, 22–4 to 22–6
14–12, 14–16
example, Vol 2, 22–4
LIB$CREATE_VM_ZONE routine, Vol 1, 14–7,
obtaining several lines of input, Vol 2, 22–5
14–16
obtaining single line of input, Vol 2, 22–4
LIB$CRF_INS_KEY, Vol 2, 25–1
prompt, Vol 2, 22–4
LIB$CRF_INS_REF, Vol 2, 25–1
LIB$GET_LUN system routine, Vol 2, 24–16
LIB$CRF_OUTPUT, Vol 2, 25–1
LIB$GET_SYMBOL routine, Vol 2, 24–8
LIB$CURRENCY system routine, Vol 2, 24–20
LIB$GET_VM routine, Vol 1, 12–4, 13–6
LIB$DATE_TIME routine, Vol 2, 27–9
LIB$GET_VM_PAGE routine, Vol 1, 12–4, 13–6
LIB$DAY routine, Vol 2, 27–5
LIB$INITIALIZE routine, Vol 2, 33–1
LIB$DAY_OF_WEEK system routine, Vol 2, 27–9
LIB$INIT_DATE_TIME_CONTEXT system
LIB$DECODE_FAULT routine, Vol 1, 9–73
routine, Vol 2, 27–24
LIB$DEC_OVER routine, Vol 1, 9–16
LIB$INIT_TIMER routine, Vol 2, 27–19
LIB$DELETE_LOGICAL routine, Vol 2, 24–8
LIB$INSERT_TREE routine, Vol 2, 24–29
LIB$DELETE_SYMBOL routine, Vol 2, 24–8
LIB$INSQHI system routine, Vol 2, 24–13
LIB$DELETE_VM_ZONE routine, Vol 1, 14–7,
LIB$INSQTI system routine, Vol 2, 24–13
14–13
LIB$INSV system routine, Vol 2, 24–10
LIB$DIGIT_SEP system routine, Vol 2, 24–20
LIB$INT_OVER routine, Vol 1, 9–16
LIB$DISABLE_CTRL routine, Vol 2, 24–9
LIB$LOCC system routine, Vol 2, 24–14
LIB$DO_COMMAND routine, Vol 2, 24–7
LIB$LOOKUP_TREE routine, Vol 2, 24–29
LIB$DT_FORMAT logical name, Vol 2, 27–24,
LIB$LP_LINES system routine, Vol 2, 24–20
27–29
LIB$MATCHC system routine, Vol 2, 24–14
LIB$DT_INPUT_FORMAT logical name, Vol 2,
LIB$MATCH_COND routine, Vol 1, 9–34, 9–65,
27–24
9–73
LIB$EMUL system routine, Vol 2, 24–12
LIB$MOVC3 system routine, Vol 2, 24–14
LIB$ENABLE_CTRL routine, Vol 2, 24–9
LIB$MOVC5 system routine, Vol 2, 24–14
LIB$ESTABLISH routine, Vol 1, 9–4, 9–41
LIB$MOVTC system routine, Vol 2, 24–14
LIB$EXTV system routine, Vol 2, 24–10
LIB$MOVTUC system routine, Vol 2, 24–14
LIB$EXTZV system routine, Vol 2, 24–10
LIB$MULTF_DELTA_TIME routine, Vol 2, 27–7
LIB$FFC system routine, Vol 2, 24–10
LIB$MULT_DELTA_TIME routine, Vol 2, 27–7
Index–10
LIB$PUT_COMMON routine, Vol 1, 3–6; Vol 2, LIBRARY command
24–5 /CREATE qualifier, Vol 2, 26–2
LIB$PUT_OUTPUT routine, Vol 2, 22–4 /DELETE qualifier, Vol 2, 26–3
example, Vol 2, 22–7 /EXTRACT qualifier, Vol 2, 26–3
writing simple output, Vol 2, 22–6 /LIST qualifier, Vol 2, 26–2
LIB$RADIX_POINT system routine, Vol 2, 24–20 /REPLACE qualifier, Vol 2, 26–2
LIB$REMQHI system routine, Vol 2, 24–13 Line editing, inhibiting, Vol 2, 22–42
LIB$REMQTI system routine, Vol 2, 24–13 Linkage sections, Vol 1, 12–11
LIB$RESERVE_EF system routine, Vol 2, 24–16 Linker utility, Vol 1, 1–12
LIB$RESET_VM_ZONE routine, Vol 1, 14–6, Linker utility, searching object libraries, Vol 2,
14–13 26–2
LIB$REVERT routine, Vol 1, 9–4, 9–5 LINK/SHAREABLE command, Vol 2, 26–7
LIB$RUN_PROGRAM routine, Vol 2, 24–5 /LIST qualifier
LIB$SCANC system routine, Vol 2, 24–14 LIBRARY command, Vol 2, 26–2
LIB$SET_LOGICAL routine, Vol 2, 24–8 LNK$LIBRARY routine, Vol 2, 26–2
LIB$SET_SYMBOL routine, Vol 2, 24–8 See also Libraries
LIB$SHOW_TIMER procedure call, Vol 2, 19–2 See also Linker utility (LINK)
LIB$SHOW_TIMER routine, Vol 2, 27–19 Load-locked instructions, Vol 1, 6–8, 6–20
LIB$SHOW_VM_ZONE routine, Vol 1, 14–7 Local buffer caching, with lock management
LIB$SIGNAL procedure call, Vol 2, 19–2 service, Vol 1, 7–20
LIB$SIGNAL routine, Vol 1, 9–3, 9–5, 9–16, 9–28, Local symbols, Vol 2, 26–4
9–34, 9–35, 9–36, 9–50, 9–57, 9–64 signaling with, Vol 1, 9–61
generating signals, Vol 1, 9–30 LOCKIDTBL_MAX parameter, Vol 1, 7–10
invoking, Vol 1, 9–30 Lock limits, Vol 1, 7–8
LIB$SIG_TO_RET routine, Vol 1, 9–71 Lock management system services
establishing, Vol 1, 9–72 for interprocess communication, Vol 1, 3–8
LIB$SIG_TO_STOP routine, Vol 1, 9–72 Lock manager, Vol 1, 7–1; Vol 2, B–13
LIB$SIM_TRAP routine, Vol 1, 9–64, 9–71 See also Synchronization and Distributed lock
LIB$SKPC system routine, Vol 2, 24–14 manager
LIB$SPANC system routine, Vol 2, 24–14 ENQLM quota, Vol 1, 7–9
LIB$SPAWN routine, Vol 2, 24–9 LOCKIDTBL size, Vol 1, 7–10
LIB$STAT_TIMER routine, Vol 2, 27–19 resource hash table quota, Vol 1, 7–10
LIB$STOP routine, Vol 1, 9–3, 9–5, 9–7, 9–28, sub-resource and sub-lock quota, Vol 1, 7–9
9–34, 9–36, 9–45, 9–50, 9–57, 9–64 Lock quotas, Vol 1, 7–8
generating signals, Vol 1, 9–30 Lock requests
LIB$SUBX routine, Vol 2, 27–7 queuing, Vol 1, 7–6
LIB$SUB_TIME routine, Vol 2, 27–7 queuing a lock request, Vol 1, 7–10
LIB$TRAVERSE_TREE routine, Vol 2, 24–29 synchronizing, Vol 1, 7–12
LIB$VERIFY_VM_ZONE routine, Vol 1, 14–7 Locks
Librarian utility (LIBRARIAN), Vol 1, 1–12 choice of mode, Vol 1, 7–5
Libraries concept of, Vol 1, 7–2
default object, Vol 2, 26–2 conversion, Vol 1, 7–7, 7–14, 7–15
macro, Vol 2, 26–3, 26–5 deadlock detection, Vol 1, 7–8
message object module, Vol 1, 9–60 dequeuing, Vol 1, 7–18
object, Vol 2, 26–2, 26–5 level, Vol 1, 7–5
adding modules, Vol 2, 26–2 mode, Vol 1, 7–5
creating, Vol 2, 26–2 Lock status blocks, Vol 1, 7–13
deleting a module, Vol 2, 26–2 Lock value blocks
extracting a module, Vol 2, 26–2 description, Vol 1, 7–17
listing modules, Vol 2, 26–2 using, Vol 1, 7–20
replacing modules, Vol 2, 26–2 Lock values, Vol 2, B–13
system default, Vol 2, 26–2 lock_id data type, Vol 2, B–13
user default, Vol 2, 26–2 lock_status_block data type, Vol 2, B–13
system default, Vol 2, 26–5 lock_value_block data type, Vol 2, B–14
text, Vol 2, 26–3 Logical I/Os
user default, Vol 2, 26–5 operations, Vol 2, 23–6
privilege, Vol 2, 23–4, 23–5, 23–6
Index–11
Logical names, Vol 2, 23–27, C–16
attributes, Vol 2, 32–13
creating with SYS$CRELNM, Vol 2, 32–18
M
defining, Vol 2, 32–2 MACRO
deleting with SYS$DELLNM, Vol 2, 32–21 MACRO-32 Compiler, Vol 1, 1–12
format convention, Vol 2, 32–17 MACRO-64 Assembler, Vol 1, 1–12
image rundown, Vol 2, 32–5 MACRO–32 compiler
LIB$DT_FORMAT, Vol 2, 27–24 alignment, Vol 1, 15–6
LIB$DT_INPUT_FORMAT, Vol 2, 27–24 consequences of noncompliant code, Vol 1, 6–9
multivalued, Vol 2, 32–2 MACRO–64 assembler, consequences of
superseding, Vol 2, 32–13 noncompliant code, Vol 1, 6–9
SYS$LANGUAGE, Vol 2, 27–24 MACRO language
translating, Vol 2, 32–11 data type declarations, Vol 2, B–48
translating with SYS$TRNLNM, Vol 2, 32–22 generating argument lists, Vol 2, A–1
Logical names, for interprocess communication, implementation table, Vol 2, B–48
Vol 1, 3–8 VAX MACRO, Vol 1, 1–12
Logical name system service calls Macro libraries, Vol 2, 26–5
SYS$CRELNM system service, Vol 2, 32–18 Macros
SYS$CRELNT system service, Vol 2, 32–21 calling system services, Vol 2, A–5
SYS$DELLNM system service, Vol 2, 32–21 expansion, Vol 2, A–4
SYS$TRNLNM system service, Vol 2, 32–22 generating argument list
Logical name table names and search lists, Vol 2, CALLG instruction, Vol 2, A–6
32–7 CALLS instruction, Vol 2, A–6
Logical name tables system services, Vol 2, 20–1, A–1
clusterwide, Vol 2, 32–6, 32–8 Magnetic tapes
creating with SYS$CRELNT, Vol 2, 32–21 initializing within a program, Vol 2, 23–36
default, Vol 2, 32–4 example, Vol 2, 23–36
directory, Vol 2, 32–3 Mailboxes, Vol 1, 3–8, 3–10; Vol 2, 20–2, 23–39
group, Vol 2, 32–6 creating, Vol 1, 3–9
job, Vol 2, 32–5 for interprocess communication, Vol 1, 3–8
predefined logical names, Vol 2, 32–3 input/output
process, Vol 2, 32–4 asynchronous, Vol 1, 3–11
process-private, Vol 2, 32–8 immediate, Vol 1, 3–11
quotas, Vol 2, 32–15 synchronous, Vol 1, 3–11
search list, Vol 2, 32–8 using SYS$QIO, Vol 1, 3–11
modifying, Vol 2, 32–8 using SYS$QIOW, Vol 1, 3–11
shareable, Vol 2, 32–8 name, Vol 2, 23–43
system, Vol 2, 32–6 permanent, Vol 1, 3–9
types, Vol 2, 32–3 protection, Vol 2, 23–4
user-defined, Vol 2, 32–8 reading data from, Vol 1, 3–11
Logical unit numbers, allocating, Vol 2, 24–16 system, Vol 2, 23–43
logical_name data type, Vol 2, B–14 messages, Vol 2, 23–44
LOGINOUT temporary, Vol 1, 3–9
creating SYS$LOGIN logical name, Vol 1, 2–8 termination, Vol 1, 4–74
creating SYS$LOGIN_DEVICE logical name, writing data to, Vol 1, 3–11
Vol 1, 2–8 Management
creating SYS$SCRATCH logical name, Vol 1, data, Vol 1, 1–20
2–8 system, Vol 1, 1–5
LOGINOUT sample program, Vol 1, 2–8 Mapped files, Vol 2, 28–4
longword_signed data type, Vol 2, B–14 closing, Vol 2, 28–11
longword_unsigned data type, Vol 2, B–14 saving, Vol 2, 28–11
LSE/SCA, Vol 1, 1–10 mask_byte data type, Vol 2, B–14
mask_longword data type, Vol 2, B–14
mask_quadword data type, Vol 2, B–14
mask_word data type, Vol 2, B–14
Mathematical functions, Vol 1, 1–16
Index–12
MAXBOBMEN Middleware services, Vol 1, 1–8
SYSGEN parameter, Vol 2, 23–50 client/server software, Vol 1, 1–7
MAXBOBS0S1 Mixed-language programming, calling conventions,
SYSGEN parameter, Vol 2, 23–50 Vol 2, 18–1
MAXBOBS2 MMS, Vol 1, 1–15
SYSGEN parameter, Vol 2, 23–50 Modularity, virtual displays, Vol 2, 22–31
Mechanism argument vectors, Vol 1, 9–28, 9–35, MOUNT privilege, Vol 2, 23–4
9–63; Vol 2, B–14 MTH$SIN_R4, Vol 2, 19–6
on Alpha systems, Vol 1, 9–37 Multiple execution contexts, Vol 1, 2–17
on VAX systems, Vol 1, 9–35 Multiprocess applications
Mechanism arrays, format, Vol 1, 9–37 synchronizing, Vol 1, 6–18
Mechanism entry, in argument descriptions, Vol 2, Multiprocessor environment, Vol 1, 6–19
17–9 See also Synchronization
mechanism_args data type, Vol 2, B–14 scheduling, Vol 1, 6–18
Memory Multistreamed work load, Vol 1, 6–19
allocating algorithms, Vol 1, 14–7
allocating and freeing blocks, Vol 1, 14–1
allocating and freeing pages, Vol 1, 14–1 N
barriers, Vol 1, 6–16 Name Hidden attribute, Vol 2, 31–5
instructions, Vol 1, 6–16 Name services, Vol 2, 32–1, C–1
locking page into, Vol 1, 12–12, 13–13 Namespaces, listing information, Vol 2, C–13
reads and writes $name_G macro, Vol 2, A–6
on VAX systems, Vol 1, 6–4 $name_G macro call, Vol 2, A–7
reads and writes on Alpha systems, Vol 1, 6–5 $name_S macro, Vol 2, A–6
Memory fragmentation, Vol 1, 14–2 $name_S macro call, Vol 2, A–6
Memory management system services, Vol 1, NARGS keyword, Vol 2, A–4
12–3, 13–5 National Character Set (NCS) utility, Vol 1, 1–15
Memory-resident global sections, Vol 1, 12–26 Natural alignment, Vol 1, 15–2
Menus performance, Vol 1, 15–2
creating with SMG$ routines, Vol 2, 22–23 Network management, Vol 1, 1–5
reading, Vol 2, 22–25 No Access attribute, Vol 2, 31–5
Messages Null devices, Vol 2, 23–29
chaining, Vol 1, 9–53 null_arg data type, Vol 2, B–14
displaying, Vol 1, 9–50 Numeric time, Vol 2, 27–7
logging, Vol 1, 9–56
system, Vol 2, 20–10
Message text, specifying variables in, Vol 1, 9–60
O
Message utility (MESSAGE), Vol 1, 1–14, 1–19, Object files, Vol 1, 1–11
9–56 to 9–63 Object libraries, Vol 2, 26–2, 26–5
accessing message object module, Vol 1, 9–60 adding a module, Vol 2, 26–2
associating messages with exception conditions, creating, Vol 2, 26–2
Vol 1, 9–57 deleting a module, Vol 2, 26–2
compiling message file, Vol 1, 9–60 extracting a module, Vol 2, 26–2
creating a message object library, Vol 1, 9–60 including message object module, Vol 1, 9–60
.END directive, Vol 1, 9–59 listing modules, Vol 2, 26–2
.FACILITY directive, Vol 1, 9–58 replacing a module, Vol 2, 26–2
facility name, Vol 1, 9–58 Object-oriented programming, Vol 1, 1–11
facility number, Vol 1, 9–59 Objects
FAO parameters, Vol 1, 9–62 DECdns, Vol 2, C–4
/FAO_COUNT qualifier, Vol 1, 9–60 modifying, Vol 2, C–6
logging messages, Vol 1, 9–56 protected, Vol 2, 31–23
message object module, Vol 1, 9–60 octaword_signed data type, Vol 2, B–14
message text, Vol 1, 9–59 octaword_unsigned data type, Vol 2, B–14
message text variables, Vol 1, 9–60 Open standards, Vol 1, 1–2
modifying a message source file, Vol 1, 9–61 Open systems, Vol 1, 1–5
.SEVERITY directive, Vol 1, 9–59 Open systems environment, Vol 1, 1–5
source module, Vol 1, 9–58
.TITLE directive, Vol 1, 9–60
Index–13
OpenVMS Alpha operating systems, Vol 1, 1–4 Partial sections, Vol 1, 12–27
migrating to, Vol 1, 1–4 Pascal, Vol 1, 1–12
OpenVMS Alpha System-Code Debugger, Vol 1, data type declarations, Vol 2, B–38
1–13 implementation table, Vol 2, B–38
OpenVMS Cluster systems, ICC programming, Passing mechanisms, Vol 2, 17–9
Vol 1, 3–21 by descriptor, Vol 2, 18–16
OpenVMS Debugger (debugger), Vol 1, 1–13 code, Vol 2, 17–10
OpenVMS Debugger utility, Vol 1, 15–3 by reference, Vol 2, 18–14
alignment, Vol 1, 15–9 by value, Vol 2, 18–13
OpenVMS RMS for arrays, Vol 2, 18–18
See RMS for scalars, Vol 2, 18–18
OpenVMS systems for strings, Vol 2, 18–18
compatibility, Vol 1, 1–3 Pasteboards, Vol 2, 22–10
compliance with open standards, Vol 1, 1–2 creating, Vol 2, 22–11
configurations, Vol 1, 1–3 deleting, Vol 2, 22–11
debugger, Vol 1, 1–13 ID, Vol 2, 22–32
description, Vol 1, 1–2 sharing, Vol 2, 22–32
open systems capability, Vol 1, 1–5 Patch utility (PATCH), Vol 1, 1–15
software, Vol 1, 1–3 PATHWORKS, client/server environment, Vol 1,
system services, Vol 1, 1–17 1–7
OpenVMS usage entry, Vol 2, B–1 PCA (performance and coverage analyzer), Vol 1,
in argument descriptions, Vol 2, 17–6 15–10
alignment, Vol 1, 15–3
OpenVMS usage implementation table
PCBs (process control blocks), Vol 1, 2–21
See Implementation tables Performance, measurement routine, Vol 2, 24–17
OpenVMS utility routines, Vol 1, 1–18 Per Kernel Thread Stacks, Vol 1, 2–22
OPS5, Vol 1, 1–12 Per-process common areas, Vol 1, 3–6
Outer mode ASTs, Vol 1, 8–12 Persona, Vol 2, 31–19
Output formatting control routine, Vol 2, 24–20 Persona extensions, Vol 2, 31–22
Overview of the OpenVMS Operating System, Vol Per-thread security, Vol 2, 31–21
1, 1–2 Per-thread security model, Vol 2, 31–21
PFNs (page frame numbers), Vol 1, 13–5
P PHDs (process headers), Vol 1, 2–21
Physical device names, Vol 2, B–7
P0 space, Vol 1, 2–22
Physical I/Os
definition, Vol 1, 10–2
access checks, Vol 2, 23–6
P1 space, Vol 1, 2–22, 2–23
operations, Vol 2, 23–5
definition, Vol 1, 10–2
privilege, Vol 2, 23–3, 23–5, 23–6
Page access, Vol 2, B–15
Physical names, Vol 2, 23–27
Page faults, Vol 2, 27–18
PID (process identifier), non-existent process, Vol
Page frame sections, Vol 1, 12–26, 13–24
2, 23–12
Pagelets, Vol 1, 12–1
PID numbers, Vol 1, 4–3, 4–6
Pages, Vol 1, 12–2, 13–3
definition, Vol 1, 4–6, 4–9
copy-on-reference, Vol 1, 12–16, 13–16
referencing remote processes, Vol 1, 4–9
demand-zero, Vol 1, 12–16, 13–16
PL/I
locking into memory, Vol 1, 12–12, 13–13
Compaq PL/I for OpenVMS Alpha, Vol 1, 1–12
owner, Vol 1, 12–10, 13–10
data type declarations, Vol 2, B–42
ownership and protection, Vol 1, 12–10, 13–10
implementation table, Vol 2, B–42
Page table entries VAX PL/I, Vol 1, 1–12
See PTEs Platforms
page_protection data type, Vol 2, B–15 Alpha, Vol 1, 1–4
Paging file sections, Vol 1, 12–22, 13–20 VAX, Vol 1, 1–4
global, Vol 1, 12–21, 13–20 Pointers, 64-bit support, Vol 1, 11–28, 11–29
PALcode (privileged architecture library) code, Vol Portability, applications, Vol 1, 1–6
1, 6–16, 15–3 Portable applications, on VAX and Alpha
Parent lock, Vol 1, 7–16 platforms, Vol 1, 1–5
Index–14
Predefined logical name Processes (cont’d)
LNM$FILE_DEV, Vol 2, 32–8 modifying name, Vol 1, 4–41
Primary exception vector, Vol 1, 9–24 obtaining information about, Vol 1, 4–9
Printers example, Vol 1, 4–9
device widths, Vol 2, 22–6 processes on specific nodes, Vol 1, 4–21,
Private sections, definition, Vol 1, 12–13, 13–13 4–22
synchronously, Vol 1, 4–23
Privileged architecture library code
using LIB$GETJPI routine, Vol 1, 4–5
See PALcode using PIDs, Vol 1, 4–5, 4–9
Privileged shareable images using process name, Vol 1, 4–6, 4–9
creating, Vol 2, 30–1 using SYS$GETJPI system service, Vol 1,
definition, Vol 2, 30–1 4–5
Privileges using SYS$GETJPIW system service, Vol
BYPASS, Vol 2, 23–5 1, 4–5
defined by access mode, Vol 2, 20–2 one process, Vol 1, 4–9
I/O operations, Vol 2, 23–2 priority
logical I/Os, Vol 2, 23–4 to 23–6 modifying, Vol 1, 4–32
MOUNT, Vol 2, 23–4 privileges
physical I/Os, Vol 2, 23–3, 23–5, 23–6 setting, Vol 1, 4–31
SHARE, Vol 2, 23–4, 23–12 scheduling, Vol 1, 4–32
SS$_NOPRIV, Vol 1, 9–21 spawned, Vol 1, 2–1
SYSTEM, Vol 2, 23–5 subprocess, Vol 1, 2–1
system services, Vol 2, 20–2 suspending, Vol 1, 4–63, 4–67
Procedure call format, Vol 2, 17–3 swapping, Vol 1, 12–12, 13–12
Procedure calls, testing for successful completion, SYS$PROCESS_SCAN system service
Vol 2, 18–22, 20–9 item lists
procedure data type, Vol 2, B–15 using to specify selection criteria about
Procedures processes, Vol 1, 4–16, 4–20
function code, Vol 2, B–11 using with remote procedures, Vol 1,
operation, Vol 2, B–11 4–24
procedure value, Vol 2, 18–8 item-specific flags to control selection
representation, Vol 2, 18–8 information, Vol 1, 4–16
Procedure values, Vol 2, 18–8, B–15 search, Vol 1, 4–14
Process, directory tables, Vol 2, 32–3 termination mailboxes, Vol 1, 4–74
Process contexts wildcard search, Vol 1, 4–12
accessing, Vol 1, 4–42 to 4–58 Process Header (PHD), Vol 1, 2–21
reading, Vol 1, 4–43 to 4–45
Process identification numbers
using with $GETJPI system service, Vol 1, 4–9
See PID numbers
writing, Vol 1, 4–45 to 4–47
Processing, distributed, Vol 1, 1–5
Process controls, Vol 1, 4–1
Process logical name tables, Vol 2, 32–4
Processes
Process names
See also SYS$GETJPI system service
length of for remote processes, Vol 1, 4–6
See also SYS$PROCESS_SCAN system service obtain information about remote processes
communicating between, Vol 1, 3–7 example, Vol 1, 4–12
communicating within, Vol 1, 3–1 specifying for local processes, Vol 1, 4–6
using logical names, Vol 1, 3–2 specifying for remote processes, Vol 1, 4–6
using symbols, Vol 1, 3–5 using to obtain information about remote
creating processes, Vol 1, 4–6, 4–9, 4–20
restrictions, Vol 1, 4–3 Processors
deleting, Vol 1, 4–71, 4–74 Alpha, Vol 1, 1–3
detached, Vol 1, 2–1, 2–13 VAX, Vol 1, 1–3
disabling swap mode, Vol 1, 12–12, 13–12 Process-private space
disallowing swapping, Vol 1, 12–12, 13–12 definition, Vol 1, 10–2
execution, Vol 1, 4–63 Process rights lists, Vol 2, 31–1
hibernating, Vol 1, 4–63 Process searches, Vol 1, 4–9 to 4–23
identification, Vol 1, 4–3 obtaining information about, Vol 1, 4–9
lock information, Vol 1, 4–30 searching on all nodes, Vol 1, 4–22
modes of execution, Vol 1, 2–2 searching on specific nodes, Vol 1, 4–21
Index–15
Process searches (cont’d) Quotas, Vol 2, B–13
using item lists AST, Vol 2, 23–3
with remote procedures, Vol 1, 4–24 buffered I/O, Vol 2, 23–3
using item-specific flags to control selection buffered I/O byte count, Vol 2, 23–3
information, Vol 1, 4–16 default logical name table, Vol 2, 32–15
using SYS$PROCESS_SCAN system service direct I/O, Vol 2, 23–3
item list, Vol 1, 4–17 directory table, Vol 2, 32–15
using SYS$PROCESS_SCAN system service I/O operations, Vol 2, 23–2
item list to specify processes job logical name table, Vol 2, 32–15
example, Vol 1, 4–20 logical name tables, Vol 2, 32–15
using SYS$PROCESS_SCAN system service SS$_EXQUOTA condition value, Vol 1, 9–21
item list to specify selection criteria about system service resources, Vol 2, 20–2
processes, Vol 1, 4–20 user-defined logical name table, Vol 2, 32–16
using wildcard on local system, Vol 1, 4–12
Process structure, Vol 1, 2–19
process_id data type, Vol 2, B–15 R
process_name data type, Vol 2, B–15 RAB64 (64-bit record access blocks)
Production systems, OpenVMS capabilities, Vol 1, data structure, Vol 1, 11–14
1–5 macros, Vol 1, 11–16
Program decomposition, Vol 1, 6–19 RAB64$PQ_x fields, Vol 1, 11–15
Program execution RAB64$Q_x fields, Vol 1, 11–15
See also Synchronization RAB data type, Vol 2, B–16
specifying a time, Vol 1, 4–59, 4–60 RABs (record access blocks), Vol 2, 28–15, B–16
timed intervals, Vol 1, 4–61 Read and write operations, ordering, Vol 1, 6–4
Programming Read-modify-write operations, atomic, Vol 1, 6–5
modular techniques, Vol 1, 1–9 Record access blocks
software development tools, Vol 1, 1–9 See RABs
to standards, Vol 1, 1–9 Records, I/O, Vol 2, 28–12
Programming environment, Vol 1, 1–7 Records, RMS, Vol 1, 1–21
Programming examples, calling system services, Reentrant code, ASTs, Vol 1, 8–3
Vol 2, 20–11 Registers
Program regions, Vol 1, 12–6, 13–8 data, Vol 2, 17–5
Prompt for input, with LIB$GET_INPUT routine, for returns, Vol 2, 17–4, 17–12
Vol 2, 22–4 Register usage
Protection for Alpha, Vol 2, 18–2
by access mode, Vol 2, 20–2 for VAX, Vol 2, 18–1
devices, Vol 2, 23–5 /REPLACE qualifier
I/O operations, Vol 2, 23–2 LIBRARY command, Vol 2, 26–2
mailboxes, Vol 2, 23–4 Resource attributes, Vol 2, 31–5
volumes, Vol 2, 23–4 Resource granularity, in lock, Vol 1, 7–3
Protection, page, Vol 1, 12–10, 13–10 Resource quotas, system services, Vol 2, 20–2
Protection masks, Vol 2, 23–4 Resources
$PRTDEF macro, Vol 2, B–15 lock management concept, Vol 1, 7–2
PTEs (page table entries) name, Vol 1, 7–4
extended addresses, Vol 1, 13–5 Resource wait mode, system service, Vol 2, 20–6
Return address arrays, Vol 1, 12–8, 13–9
Q Return conditions, wait, Vol 2, 20–6
Return condition values, Vol 2, 19–6, 20–7
quadword_signed data type, Vol 2, B–15 Returns, Vol 2, 17–12
quadword_unsigned data type, Vol 2, B–15 call frame, Vol 2, 18–5
Queue access routines, Vol 2, 24–13 condition value, Vol 2, 18–22
Queue information, obtaining, Vol 2, 27–21 errors, Vol 2, 18–22
Queues, Vol 2, 24–12 function value, Vol 2, 18–22
lock management, Vol 1, 7–6 I/O status, Vol 2, B–12
self-relative, Vol 2, 24–12 in I/O status block, Vol 2, 17–12
Queuing ASTs, Vol 1, 8–2 in mailbox, Vol 2, 17–12
object, Vol 2, B–11
RTL routines, Vol 2, 19–6
Index–16
Returns (cont’d) Run-time library routines (cont’d)
signaled in register, Vol 2, 17–12 accessing operating system components, Vol 2,
system service condition value, Vol 2, 20–7 24–1
Returns heading, in routine documentation, Vol 2, accessing VAX instruction set, Vol 2, 24–9
17–4 calling, Vol 2, 19–1, 19–3
Return status, Vol 1, 9–21 entry point, Vol 2, 19–3, 19–4, 19–6, 20–4
from signal, Vol 1, 9–72 integer and floating-point, Vol 2, 24–12
Return symbols interaction with operating system, Vol 2, 24–1
for RTL routines, Vol 2, 19–6 jacket routine, Vol 2, 24–1
Rights databases, Vol 2, 31–1, 31–8, 31–16 manipulating character string, Vol 2, 24–14
adding to, Vol 2, 31–12 names, Vol 2, 19–3
default protection, Vol 2, 31–9 on Alpha systems, Vol 1, 9–17
elements of, Vol 2, 31–10 output formatting control, Vol 2, 24–20
holder record, Vol 2, 31–8 performance measurement, Vol 2, 24–17
identifier records, Vol 2, 31–8 queue access, Vol 2, 24–12
initializing, Vol 2, 31–9 return status, Vol 1, 9–21
keys, Vol 2, 31–9 system service access, Vol 2, 24–1
modifying, Vol 2, 31–13, 31–14, 31–16 variable-length bit field instruction, Vol 2,
Rights identifiers 24–10
See Identifiers
Rights lists S
process, Vol 2, 31–19
system, Vol 2, 31–19 S0 space, definition, Vol 1, 10–2
rights_holder data type, Vol 2, B–16 SCAN
rights_id data type, Vol 2, B–16 data type declarations, Vol 2, B–52
RISC architecture, Vol 1, 1–4 implementation table, Vol 2, B–52
RMS, Vol 1, 1–8, 1–20 Schedulers
callback, Vol 1, 2–18
See also RAB64
OpenVMS, Vol 1, 2–18
files and records, Vol 1, 1–21
POSIX Threads Library, Vol 1, 2–18
interface enhancements, Vol 1, 11–13
Scheduling, Vol 1, 2–20
opening file for mapping, Vol 1, 12–14, 13–14
Screen management, Vol 2, 22–9
routines, Vol 1, 1–21
utilities, Vol 1, 1–21 See also Key tables
RMS, structures, Vol 2, 28–15 See also Pasteboards
RMS files, Vol 1, 1–21 See also Video attributes
Routines See also Viewports
callable system, Vol 1, 1–15 See also Virtual displays
calling, Vol 2, 19–1 See also Virtual keyboards
high-performance sort, Vol 1, 1–19 deleting text, Vol 2, 22–23
how to call, Vol 2, 19–3 double-width characters, Vol 2, 22–20, 22–21
processwide resource allocation, Vol 2, 24–16 drawing lines, Vol 2, 22–22
RTL, Vol 1, 1–16 inserting characters, Vol 2, 22–20
variable-length bit field, Vol 2, 24–10 menus
RPG II creating, Vol 2, 22–23
data type declarations, Vol 2, B–50 reading, Vol 2, 22–25
implementation table, Vol 2, B–50 types of, Vol 2, 22–23
RTL jacket handler, Vol 1, 9–71 reading data, Vol 2, 22–24
RTL routines scrolling, Vol 2, 22–21
See Run-time library routines setting background color, Vol 2, 22–11
RTLs (run-time libraries) setting screen dimensions, Vol 2, 22–11
condition handling, Vol 1, 9–1 video attributes, Vol 2, 22–22
routines, Vol 1, 1–16 viewports, Vol 2, 22–19
Run-time libraries Scrolling instructions, Vol 2, 22–21
See RTLs Search lists, defining, Vol 2, 32–2
Run-time library routines Search operations, Vol 2, 31–16
accessing command language interpreter, Vol
2, 24–2
Index–17
Secondary exception vectors, Vol 1, 9–24 SMG$CHANGE_RENDITION routine, Vol 2,
Sections, Vol 1, 12–12, 13–13 22–17
characteristic, Vol 1, 12–15, 13–15 SMG$CHANGE_VIEWPORT routine, Vol 2,
creating, Vol 1, 12–13, 13–14 22–19
defining extent, Vol 1, 12–15, 13–15 SMG$CHANGE_VIRTUAL_DISPLAY routine, Vol
deleting, Vol 1, 12–25, 13–23; Vol 2, 28–11 2, 22–17
global, Vol 2, 26–9 SMG$CHECK_FOR_OCCLUSION routine, Vol 2,
global paging file, Vol 1, 12–21, 13–20 22–14
image, Vol 1, 12–26, 13–23 SMG$CREATE_KEY_TABLE routine, Vol 2,
mapping, Vol 1, 12–18, 13–18; Vol 2, 28–4 22–29
page frame, Vol 1, 12–26, 13–24 SMG$CREATE_MENU routine, Vol 2, 22–24
paging, Vol 1, 12–22, 12–23, 13–20, 13–21 SMG$CREATE_PASTEBOARD routine, Vol 2,
private, Vol 2, 28–6 22–10
releasing, Vol 1, 12–25, 13–23 SMG$CREATE_SUBPROCESS routine, Vol 2,
sharing data, Vol 1, 12–24, 13–22 22–18
unmapping, Vol 1, 12–25, 13–23 SMG$CREATE_VIEWPORT routine, Vol 2, 22–19
updating, Vol 2, 28–11 SMG$CREATE_VIRTUAL_DISPLAY routine, Vol
writing back, Vol 1, 12–25, 13–23 2, 22–10
section_id data type, Vol 2, B–16 SMG$CREATE_VIRTUAL_KEYBOARD routine,
section_name data type, Vol 2, B–16 Vol 2, 22–25
Security model, Vol 2, 31–21 SMG$DELETE_CHARS routine, Vol 2, 22–23
Security profiles SMG$DELETE_LINE routine, Vol 2, 22–23
displaying, Vol 2, 31–24 SMG$DELETE_MENU routine, Vol 2, 22–24
modifying, Vol 2, 31–24 SMG$DELETE_PASTEBOARD routine, Vol 2,
Segments, item lists, Vol 1, 11–5 22–11
Sequential files SMG$DELETE_SUBPROCESS routine, Vol 2,
creating, Vol 2, 28–12 22–18
updating, Vol 2, 28–13 SMG$DELETE_VIEWPORT routine, Vol 2, 22–19
Servers, Vol 1, 1–6 SMG$DELETE_VIRTUAL_DISPLAY routine, Vol
Service routines 2, 22–16
AST, Vol 1, 8–8 SMG$DRAW_CHARACTER routine, Vol 2, 22–22
SET BREAK debugger command, /HANDLER SMG$DRAW_CHAR routine, Vol 2, 22–20
qualifier, Vol 1, 9–70 SMG$DRAW_LINE routine, Vol 2, 22–22
SET DISPLAY command SMG$DRAW_RECTANGLE routine, Vol 2, 22–22
creating WSA pseudo workstation devices, Vol SMG$ENABLE_UNSOLICITED_INPUT routine,
2, 22–8 Vol 2, 22–36
.SEVERITY directive, Vol 1, 9–59 SMG$END_DISPLAY_UPDATE routine, Vol 2,
Shareable images, Vol 2, 26–3 22–31
privileged, Vol 2, 30–1 SMG$ERASE_CHARS routine, Vol 2, 22–23
Shareable logical names, interprocess SMG$ERASE_COLUMN routine, Vol 2, 22–23
communication, Vol 2, 32–16 SMG$ERASE_DISPLAY routine, Vol 2, 22–23
Shared data SMG$ERASE_LINE routine, Vol 2, 22–23
access, Vol 1, 8–3 SMG$ERASE_PASTEBOARD routine, Vol 2,
AST synchronization, Vol 1, 8–4 22–11
Shared files, Vol 2, 26–13 SMG$EXECUTE_COMMAND routine, Vol 2,
SHARE privilege, Vol 2, 23–4, 23–12 22–18
Sharing data, RMS shared files, Vol 2, 26–13 SMG$HOME_CURSOR routine, Vol 2, 22–19
Signal argument vectors, Vol 1, 9–28, 9–32, 9–63 SMG$INSERT_CHARS routine, Vol 2, 22–20
Signaling, Vol 1, 9–33 SMG$INSERT_LINE routine, Vol 2, 22–21
changing to return status, Vol 1, 9–72 SMG$LABEL_BORDER routine, Vol 2, 22–12
SMG$ADD_KEY_DEF routine, Vol 2, 22–29 SMG$LIST_PASTING_ORDER routine, Vol 2,
SMG$BEGIN_DISPLAY_UPDATE routine, Vol 2, 22–16
22–31 SMG$MOVE_TEXT routine, Vol 2, 22–17
SMG$CHANGE_PBD_CHARACTERISTICS SMG$MOVE_VIRTUAL_DISPLAY routine, Vol 2,
routine, Vol 2, 22–11 22–15
Index–18
SMG$PASTE_VIRTUAL_DISPLAY routine, Vol 2, SS$_ALIGN exception, Vol 1, 9–12
22–10 signal array format, Vol 1, 9–15
SMG$POP_VIRTUAL_DISPLAY routine, Vol 2, SS$_HPARITH exception, Vol 1, 9–12
22–32 signal array format, Vol 1, 9–13
SMG$PUT_CHARS routine, Vol 2, 22–20 Stack frames, Vol 2, 18–3
SMG$PUT_CHARS_HIGHWIDE routine, Vol 2, Stacks
22–20 for Alpha procedure calls, Vol 2, 18–5
SMG$PUT_CHARS_MULTI routine, Vol 2, 22–20 for VAX procedure calls, Vol 2, 18–3
SMG$PUT_CHARS_WIDE routine, Vol 2, 22–20 Stack usage, Vol 2, 18–3, 18–5
SMG$PUT_LINE routine, Vol 2, 22–21 Standards, open, Vol 1, 1–2
SMG$PUT_LINE_MULTI routine, Vol 2, 22–21 STARLET.OLB file, Vol 2, 26–2, 26–5
SMG$PUT_LINE_WIDE routine, Vol 2, 22–21 STARLET data structures and definitions
SMG$PUT_WITH_SCROLL routine, Vol 2, 22–21 for C programmers, Vol 2, 21–1
SMG$READ_COMPOSED_LINE routine, Vol 2, Store-conditional instructions, Vol 1, 6–8
22–29 Sublock, Vol 1, 7–16
SMG$READ_FROM_DISPLAY routine, Vol 2, Subprocesses, Vol 1, 2–1
22–25 connecting to using LIB$ATTACH routine, Vol
SMG$READ_KEYSTROKE routine, Vol 2, 22–24 2, 24–9
SMG$READ_STRING routine, Vol 2, 22–25 creating
SMG$REPASTE_VIRTUAL_DISPLAY routine, with LIB$SPAWN, Vol 1, 2–3
Vol 2, 22–15 with SMG$ routines, Vol 2, 22–18
SMG$RESTORE_PHYSICAL_SCREEN routine, with SYS$CREPRC, Vol 1, 2–6
Vol 2, 22–31 creation of using LIB$SPAWN routine, Vol 2,
SMG$RETURN_CURSOR_POS routine, Vol 2, 24–9
22–19 debugging, Vol 1, 2–15
SMG$SAVE_PHYSICAL_SCREEN routine, Vol 2, disk and directory default, Vol 1, 2–12
22–31 image, Vol 1, 2–12
SMG$SCROLL_DISPLAY_AREA routine, Vol 2, input, output, and error device, Vol 1, 2–7
22–21 priority setting, Vol 1, 4–32
SMG$SCROLL_VIEWPORT routine, Vol 2, 22–19 Subsystem attribute, Vol 2, 31–5
SMG$SELECT_FROM_MENU routine, Vol 2, Supervisor mode ASTs, Vol 1, 8–12
22–24 Supervisor stack, Vol 1, 2–22
SMG$SET_BROADCAST_TRAPPING routine, Vol Suspension, Vol 1, 4–63, 4–67
2, 22–43 compared with hibernation, Vol 1, 4–64
SMG$SET_CURSOR_ABS routine, Vol 2, 22–19 Swapping
SMG$SET_CURSOR_REL routine, Vol 2, 22–19 by suspension, Vol 1, 4–67
SMG$SET_DISPLAY_SCROLL_REGION routine, Symbolic codes, for condition values, Vol 2, 20–8
Vol 2, 22–21 Symbolic definition macros, Vol 2, A–4
SMG$SET_PHYSICAL_CURSOR routine, Vol 2, Symbolic names, for argument lists, Vol 2, A–4
22–19 Symbols
SMG$UNPASTE_VIRTUAL_DISPLAY routine, defining, Vol 2, 26–3
Vol 2, 22–16 global, Vol 2, 26–4
SMP (symmetric multiprocessing), Vol 1, 5–1 local, Vol 2, 26–4
goals, Vol 1, 5–2 referring to, Vol 2, 26–3
Software development life cycle, Vol 1, 1–9 storage, Vol 2, 26–3
Software development tools, Vol 1, 1–8 unresolved, Vol 2, 26–4
Software programs, developing, Vol 1, 1–7 Symmetric Multiprocessing
Sort/Merge utility, high-performance routines, Vol interrupt requests, Vol 1, 5–2
1, 1–19 tightly coupled, Vol 1, 5–1
Special modes for debugging, Vol 1, 1–14 Symmetric Multiprocessing (SMP), Vol 1, 5–1
Specifying access modes of logical names, Vol 2, Synchronization
32–10 asynchronous system traps, Vol 1, 8–1
Specifying attributes of logical names, Vol 2, definition of, Vol 1, 6–1
32–13 hardware-level, Vol 1, 6–7
SRM_CHECK tool inner mode, Vol 1, 6–17
location on kit, Vol 1, 6–9 passing control to another image, Vol 1, 4–67
using to analyze code, Vol 1, 6–9 software-level, Vol 1, 6–16
using detached processes, Vol 1, 4–59
Index–19
Synchronization (cont’d) SYS$DCLAST system service, example, Vol 1,
using events flags, Vol 1, 6–20 8–10
using process priority, Vol 1, 6–18 SYS$DCLCMH system service, Vol 1, 9–3
using spin locks, Vol 1, 6–19 SYS$DCLEXH system service, Vol 1, 9–75
using subprocesses, Vol 1, 4–59 SYS$DELETE_BUFOBJ system service, Vol 2,
Synchronous input/output, Vol 2, 23–19 23–49, 23–51
Synchronous system services, Vol 2, 20–5 SYS$DELPRC system service, Vol 1, 4–74
SYS$ABORT_TRANS system service, Vol 2, 29–2 SYS$DELTVA system service, Vol 2, 28–11
SYS$ABORT_TRANSW system service, Vol 2, SYS$DEQ system service, example, Vol 1, 7–19
29–2, 29–3 SYS$DGBLSC system service, Vol 1, 13–16
SYS$ADD_HOLDER system service, Vol 2, 31–12 SYS$DISMOU system service, Vol 2, 23–36
SYS$ADD_IDENT system service, Vol 2, 31–12 SYS$DLCEFC system service, Vol 1, 6–27
SYS$ADJWSL system service, Vol 1, 12–11, 13–11 SYS$DNS system service, Vol 2, C–1
SYS$ALLOC system service SYS$END_TRANS system service, Vol 2, 29–2
example, Vol 2, 23–33 SYS$END_TRANSW system service, Vol 2, 29–2,
SYS$ASCEFC system service, Vol 1, 6–25 29–3
SYS$ASCTIM system service, Vol 2, 27–6 SYS$ENQ system service, example, Vol 1, 7–11
example, Vol 2, 27–10 SYS$ERROR logical name, Vol 1, 2–7, 2–8, 2–10,
SYS$ASCTOID system service, Vol 2, 31–11 4–69, 9–42, 9–50, 9–55; Vol 2, 32–4
SYS$ASCUTC system service, Vol 2, 27–2 to 27–4 SYS$EXIT system service, Vol 1, 4–69
SYS$ASSIGN system service, Vol 2, 23–12 SYS$EXPREG system service, Vol 1, 12–6, 13–8
example, Vol 2, 23–11 example, Vol 1, 12–6, 13–8
SYS$BINTIM system service, Vol 2, 27–2 to 27–4, SYS$FAO system service, Vol 1, 9–42, 9–50, 9–55;
27–6 Vol 2, 27–2 to 27–4
SYS$BINUTC system service, Vol 2, 27–2 to 27–4 example, Vol 2, 23–38
SYS$BRKTHRU system service, Vol 2, 22–43 SYS$FIND_HELD system service, Vol 2, 31–13,
SYS$CANCEL system service 31–16
example, Vol 2, 23–26 SYS$FIND_HOLDER system service, Vol 2,
SYS$CANTIM system service, Vol 2, 27–13 31–13, 31–16
example, Vol 2, 27–16 SYS$FORCEX system service
SYS$CANWAK system service, Vol 2, 27–13, example, Vol 1, 4–70
27–17 SYS$FORMAT_ACL system service, Vol 2, 31–25,
SYS$CHECK_ACCESS system service, Vol 2, 31–26
31–29 SYS$GETDVI system service, Vol 2, 23–29
SYS$CHECK_PRIVILEGE system service, Vol 2, SYS$GETDVIW system service, Vol 2, 23–29
31–30 SYS$GETJPI system service, Vol 1, 4–5, 4–9
SYS$CHKPRO system service, Vol 2, 31–29 See also SYS$PROCESS_SCAN system service
SYS$CLREF system service, Vol 1, 6–31 AST in target process, Vol 1, 4–26
SYS$COMMAND logical name, Vol 2, 32–4 buffer, Vol 1, 4–24, 4–25
SYS$CPU_CAPABILITIES system service, Vol 1, control flags, Vol 1, 4–26
4–34 item list
SYS$CREATE system service, Vol 2, 28–10 specifying criteria to select processes
SYS$CREATE_BUFOBJ_64 system service, Vol 2, example, Vol 1, 4–20
23–49, 23–51 item-specific flags, Vol 1, 4–16
SYS$CREATE_RDB system service, Vol 2, 31–9 obtaining information about all processes on the
SYS$CREATE_USER_PROFILE system service, local system, Vol 1, 4–9 to 4–14
Vol 2, 31–29 obtaining information about one process, Vol 1,
SYS$CREMBX system service, Vol 1, 2–8, 3–9, 4–9
4–76 obtaining information with wildcard search
SYS$CREPRC system service, example, Vol 1, example, Vol 1, 4–13
2–12 packing information in buffers, Vol 1, 4–24,
SYS$CRETVA system service, Vol 1, 12–8, 13–9 4–25
SYS$CRMPSC system service, Vol 2, 28–4, 28–5 searching for processes on all nodes, Vol 1,
SYS$DACEFC system service, Vol 1, 6–27 4–22
SYS$DALLOC system service, Vol 2, 23–33 searching for processes on specific nodes, Vol 1,
SYS$DASSGN system service, Vol 2, 23–12, 28–11 4–21, 4–22
example, Vol 2, 23–24 searching for selected processes, Vol 1, 4–14
specifying buffer size, Vol 1, 4–24, 4–25
Index–20
SYS$GETJPI system service (cont’d) SYS$IO_PERFORM, Vol 2, 23–51
specifying criteria to select processes SYS$IO_SETUP, Vol 2, 23–51
example, Vol 1, 4–20 SYS$LANGUAGE logical name, Vol 2, 27–24
swapping processes, Vol 1, 4–26 SYS$LCKPAG system service, Vol 1, 12–12, 13–12
synchronizing calls, Vol 1, 4–21, 4–22, 4–23 SYS$LKWSET system service, Vol 1, 12–11,
using item lists, Vol 1, 4–16, 4–24 13–12
with remote procedures, Vol 1, 4–24 SYS$LOGIN logical name, Vol 1, 2–8
using multiple $PROCESS_SCAN service SYS$LOGIN_DEVICE logical name, Vol 1, 2–8
contexts, Vol 1, 4–23 SYS$MGBLSC system service, Vol 2, 26–9
using SYS$PROCESS_SCAN system service SYS$MOD_HOLDER system service, Vol 2, 31–14
item list to specify selection criteria about SYS$MOD_IDENT system service, Vol 2, 31–13
processes, Vol 1, 4–16, 4–20 SYS$MOUNT system service, Vol 2, 23–34
item-specific flags to control selection SYS$NUMTIM system service, Vol 2, 27–2 to
information, Vol 1, 4–16 27–4, 27–7
search, Vol 1, 4–14 SYS$NUMUTC system service, Vol 2, 27–2 to
using SYS$PROCESS_SCAN system service 27–4
item list to specify selection criteria about SYS$OPEN system service, Vol 2, 28–10
processes, Vol 1, 4–17 SYS$OUTPUT logical name, Vol 1, 2–3, 2–7, 2–8,
using wildcards, Vol 1, 4–9 to 4–14 4–69, 8–5, 9–42, 9–50, 9–55; Vol 2, 22–2,
example, Vol 1, 4–13 22–4, 22–6, 22–34, 24–18, 32–4, 32–17
using wildcards as pidadr, Vol 1, 4–9 default value, Vol 2, 22–3
SYS$GETLKI system service, Vol 1, 4–30 example, Vol 1, 2–4, 2–10; Vol 2, 22–7
SYS$GETMSG system service, Vol 1, 9–50 redefining value, Vol 2, 22–3
SYS$GETQUI system service, Vol 2, 27–21 using with LIB$GET_INPUT routine, Vol 2,
SYS$GETSYI system service, Vol 2, 27–21 22–4
SYS$GETTIM system service, Vol 2, 27–2 to 27–4, using with LIB$PUT_OUTPUT routine, Vol 2,
27–10 22–4
SYS$GETUTC system service, Vol 2, 27–2 to 27–4 SYS$PARSE_ACL system service, Vol 2, 31–25,
SYS$GET_ALIGN_FAULT_DATA system service, 31–26
Vol 1, 15–10 SYS$PERM_DIS_ALIGN_FAULT_REPORT
SYS$GET_SECURITY system service, Vol 2, system service, Vol 1, 15–10
31–25, 31–26 SYS$PERM_REPORT_ALIGN_FAULT system
SYS$GET_SYS_ALIGN_FAULT_DATA system service, Vol 1, 15–10
service, Vol 1, 15–11 SYS$PROCESS_AFFINITY system service, Vol 1,
SYS$GOTO_UNWIND system service, Vol 1, 4–36
9–45, 9–49 SYS$PROCESS_CAPABILITIES system service,
SYS$HIBER system service, Vol 1, 4–65 Vol 1, 4–34
example, Vol 1, 4–66 SYS$PROCESS_SCAN system service, Vol 1, 4–5,
SYS$IDTOASC system service, Vol 2, 31–11, 4–9
31–16 See also SYS$GETJPI system service
SYS$INIT_SYS_ALIGN_FAULT_REPORT system obtaining information about processes on nodes,
service, Vol 1, 15–11 Vol 1, 4–22 to 4–23
SYS$INIT_VOL system service, Vol 2, 23–36 obtaining information about processes on
example, Vol 2, 23–36 specific nodes, Vol 1, 4–21, 4–22
SYS$INPUT logical name, Vol 1, 2–3, 2–7, 2–8, searching nodes, Vol 1, 4–22
4–69, 8–5; Vol 2, 22–2, 22–4, 22–34, 26–7, searching on specific nodes, Vol 1, 4–21
32–4, 32–17 setting up multiple contexts, Vol 1, 4–23
default value, Vol 2, 22–3 termination mailboxes, Vol 2, 23–44
example, Vol 1, 2–4, 2–8, 2–10; Vol 2, 22–5, using item lists, Vol 1, 4–16 to 4–24
22–33, 24–4, 24–29 with remote procedures, Vol 1, 4–24
redefining value, Vol 2, 22–3 using item lists to specify selection criteria
using with LIB$GET_INPUT routine, Vol 2, about processes, Vol 1, 4–16, 4–17, 4–20
22–4 example, Vol 1, 4–20
using with LIB$PUT_OUTPUT routine, Vol 2, using item-specific flags to control selection
22–4 information, Vol 1, 4–16
SYS$IO_CLEANUP, Vol 2, 23–51 SYS$PURGWS system service, Vol 1, 13–12
Index–21
SYS$PUTMSG system service, Vol 1, 9–6, 9–42, SYS$ULWSET system service, Vol 1, 12–11,
9–50, 9–55 13–12
SYS$QIO system service, Vol 2, 23–12 SYS$UNWIND system service, Vol 1, 9–45, 9–47,
example, Vol 2, 23–13 9–49, 9–64, 9–67, 9–72
SYS$REM_HOLDER system service, Vol 2, 31–16 example, Vol 1, 9–48
SYS$REM_IDENT system service, Vol 2, 31–16 SYS$UPDSEC system service, Vol 2, 28–11
SYS$SCHDWK system service, Vol 2, 27–13, SYS$WAITFR system service, Vol 1, 6–29
27–16, 27–17 SYS$WAKE system service, Vol 1, 4–65
canceling, Vol 2, 27–17 example, Vol 1, 4–66
example, Vol 2, 27–17 SYS$WFLAND system service, Vol 1, 6–29
request, Vol 2, 27–16 SYS$WFLOR system service, Vol 1, 6–29
SYS$SCRATCH logical name, Vol 1, 2–8 SYSGEN parameter
SYS$SETEF system service, Vol 1, 6–31 MAXBOBMEN, Vol 2, 23–50
SYS$SETEXV system service, Vol 1, 9–24 MAXBOBS0S1, Vol 2, 23–50
example, Vol 1, 9–4 MAXBOBS2, Vol 2, 23–50
SYS$SETIME system service, Vol 2, 27–11 SYSMAN command, class_schedule, Vol 1, 4–37
SYS$SETIMR system service SYSPRV privilege, Vol 2, 23–5
example with ASTs, Vol 1, 8–7 System, directory table, Vol 2, 32–3
routines, Vol 2, 27–13 System clock, setting, Vol 2, 27–11
SYS$SETPRN system service, Vol 1, 4–41 System Dump Analyzer (SDA) utility, Vol 1, 1–15
SYS$SETPRT system service, Vol 1, 12–10 System information
SYS$SETPRV system service, Vol 1, 4–31 See Timers statistics
SYS$SETRWM system service, Vol 2, 23–2 System library, Vol 2, 20–1, A–1
SYS$SETSWM system service, Vol 1, 12–12, System logical name tables, Vol 2, 32–6
13–12 System macro library, default, Vol 2, 20–8
example, Vol 1, 12–12, 13–12 System management, Vol 1, 1–5
SYS$SET_IMPLICIT_AFFINITY system service, System messages, Vol 2, 20–10
Vol 1, 4–35 System objects, access, Vol 2, B–16
SYS$SET_RESOURCE_DOMAIN system service, System routine documentation, Vol 2, 17–1
Vol 1, 7–4 Arguments heading, Vol 2, 17–6
SYS$SET_SECURITY system service, Vol 2, access entry, Vol 2, 17–8
31–25, 31–26 mechanism entry, Vol 2, 17–9
SYS$STARLET_C.TLB OpenVMS usage entry, Vol 2, 17–6
adherence to conventions, Vol 2, 21–2 text entry, Vol 2, 17–10
functional equivalency to STARLETSD.TLB, type entry, Vol 2, 17–7
Vol 2, 21–1 Condition Values Returned heading, Vol 2,
impact on use of ‘‘variant_struct’’ and ‘‘variant_ 17–11
union’’, Vol 2, 21–1 returns, Vol 2, 17–11, 17–12
potential impact on LIB structures, Vol 2, 21–1 returns in I/O status block, Vol 2, 17–12
potential impact on RMS structures, Vol 2, returns in mailbox, Vol 2, 17–12
21–1 returns signaled, Vol 2, 17–12
providing .H files, Vol 2, 21–2 Format heading, Vol 2, 17–2
SYS$START_ALIGN_FAULT_REPORT system explanatory text, Vol 2, 17–4
service, Vol 1, 15–10 JSB call format, Vol 2, 17–4
SYS$START_TRANS system service, Vol 2, 29–2 procedure call format, Vol 2, 17–3
SYS$START_TRANSW system service, Vol 2, Returns heading, Vol 2, 17–4
29–2, 29–3 condition values, Vol 2, 17–4
SYS$STOP_ALIGN_FAULT_REPORT system System routine returns, register data, Vol 2, 17–5
service, Vol 1, 15–10 System routines
SYS$STOP_SYS_ALIGN_FAULT_REPORT system callable, Vol 1, 1–8
service, Vol 1, 15–11 system services
SYS$SYNCH system service, Vol 1, 6–29; Vol 2, asynchronous, Vol 1, 6–35
23–18, 23–19 synchronous, Vol 1, 6–35
SYS$TIMCON system service, Vol 2, 27–2 to 27–4 System routine template, understanding, Vol 2,
SYS$ULKPAG system service, Vol 1, 12–12, 17–1
13–12
Index–22
Systems Time (cont’d)
exception dispatcher, Vol 1, 9–24 numeric and ASCII, Vol 2, 27–7
Systems, mailbox, Vol 2, 23–43 setting system, Vol 2, 27–11
System service access, Vol 2, 24–1, 24–2 using system services, Vol 2, 27–2 to 27–4
System services Time, conversions, Vol 2, 27–2
calling, Vol 2, 20–1 Time, current, Vol 2, 27–9
C function prototypes, Vol 1, 11–11 Time conversions
executing formatting, Vol 2, 27–4
asynchronously, Vol 2, 20–5 Time format logical names, Vol 2, 27–30 to 27–31
synchronously, Vol 2, 20–5 Time manipulation
execution wait, Vol 2, 20–6 using LIB$ADDX routine, Vol 2, 27–7
initializing volumes, Vol 2, 23–36 using LIB$ADD_TIMES routine, Vol 2, 27–7
loading site-specific, Vol 2, 31–30 using LIB$DAY routine, Vol 2, 27–5
MACRO-32, Vol 1, 11–11 using LIB$MULTF_DELTA_TIME, Vol 2, 27–7
macros, Vol 2, 20–1, A–1 using LIB$MULT_DELTA_TIME routine, Vol
obtaining information about processes, Vol 1, 2, 27–7
4–5, 4–9 using LIB$ routines, Vol 2, 27–5 to 27–7
OpenVMS, Vol 1, 1–17 using LIB$SUBX routine, Vol 2, 27–7
privileges, Vol 2, 20–2 using LIB$SUB_TIMES routine, Vol 2, 27–7
resource wait, Vol 2, 20–6 Timer requests, Vol 2, 27–13
restrictions, Vol 2, 20–2 canceling, Vol 2, 27–16
return status, Vol 1, 9–21 Timers
testing for successful completion, Vol 2, 20–9 deallocating, Vol 2, 27–19
System space, definition, Vol 1, 10–2 initializing, Vol 2, 27–19
System timer obtaining statistics, Vol 2, 27–19
canceling, Vol 1, 4–63 statistics, Vol 2, 27–18
setting, Vol 1, 4–62 buffered input/output, Vol 2, 27–18
system_access_id data type, Vol 2, B–16 CPU time, Vol 2, 27–18
direct input/output, Vol 2, 27–18
elapsed time, Vol 2, 27–18
T page faults, Vol 2, 27–18
Tape volumes, mounting, Vol 2, 23–34 time_name data type, Vol 2, B–16
Terminal characteristics, Vol 2, 23–29 .TITLE directive, Vol 1, 9–60
Terminal echo, Vol 2, 22–40 Tools, alignment, Vol 1, 15–9
disabling, Vol 2, 22–41 Traceback handlers, Vol 1, 9–25
Terminal I/O, example, Vol 2, 23–24 Transaction processing, distributed environments,
Terminals, device widths, Vol 2, 22–6 Vol 1, 1–18
Terminal timeouts, Vol 2, 22–41 Transactions
Termination mailboxes, Vol 1, 4–74; Vol 2, 23–44 default, Vol 2, 29–3
Terminators programming, Vol 2, 29–1
See also I/O (input/output) transaction_id data type, Vol 2, B–16
echos, Vol 2, 22–25 Translating logical names, Vol 2, 32–11
file, Vol 2, 23–31 TRM$M_TM_ESCAPE routine, Vol 2, 22–26
record, Vol 2, 23–31 TRM$M_TM_NOECHO routine, Vol 2, 22–26
Text processors, Vol 1, 1–10 TRM$M_TM_NOTRMECHO routine, Vol 2, 22–25
Thread manager, Vol 1, 2–18 TRM$M_TM_PURGE routine, Vol 2, 22–26
Threads, Vol 1, 9–48 Type-ahead buffers, Vol 2, 22–39
Compaq POSIX Threads Library services, Vol Type entry, in argument descriptions, Vol 2, 17–7
1, 1–15
Time U
See also Current time
absolute, Vol 2, 27–1 UFO (user-file open), Vol 2, 28–10
64-bit system format, Vol 2, 27–1 See also User-open routine
128-bit system format, Vol 2, 27–36 uic data type, Vol 2, B–17
converting ASCII to binary, Vol 2, 27–6 UICs (user identification codes), Vol 2, B–16, B–17
delta, Vol 2, 27–1 Unalignment, Vol 1, 15–1
getting current system, Vol 2, 27–10
internal format, Vol 2, 27–2
Index–23
Uniprocessor operations, Vol 1, 6–5 VAX FORTRAN
Unwind condition handlers, Vol 1, 9–67 See Fortran
Upcalls, Vol 1, 2–18 VAX instruction set, accessing through run-time
User capabilities, Vol 1, 4–33 library, Vol 2, 24–9
User-defined condition values VAX language implementation tables
signaling, Vol 1, 9–61 See Implementation tables
User-defined logical name tables, Vol 2, 32–8,
VAX MACRO
32–16
See MACRO
User-file open
VAX Pascal
See UFO See Pascal
User identification codes VAX PL/I
See UICs See PL/I
User interfaces VAX platforms, Vol 1, 1–4
programming tools, Vol 1, 1–19 VAX processors, Vol 1, 1–3
User mode ASTs, Vol 1, 8–12
VAX RPG II
User-open routines, Vol 2, 28–15
See RPG II
User privileges, Vol 2, 20–2
VAX SCAN
User procedures, Vol 2, 19–1
See SCAN
User stacks, Vol 1, 2–22
vector_byte_signed data type, Vol 2, B–17
user_arg data type, Vol 2, B–17
vector_byte_unsigned data type, Vol 2, B–17
Using impersonation system services, Vol 2, 31–20
vector_longword_signed data type, Vol 2, B–17
UTC (Coordinated Universal Time)
vector_longword_unsigned data type, Vol 2, B–17
system services, Vol 2, 27–37
vector_quadword_signed data type, Vol 2, B–17
Utility routines, OpenVMS, Vol 1, 1–18
vector_quadword_unsigned data type, Vol 2, B–17
vector_word_signed data type, Vol 2, B–17
V vector_word_unsigned data type, Vol 2, B–17
Variable-length bit field routine, Vol 2, 24–10 VEST (VAX Environment Software Translator)
Variable-size stack frames, Vol 2, 18–6 alignment, Vol 1, 15–8
‘‘variant_struct’’, impact of SYS$STARLET_C.TLB, Video attributes, Vol 2, 22–12, 22–18, 22–22
Vol 2, 21–2 current, Vol 2, 22–18
‘‘variant_union’’, impact of SYS$STARLET_C.TLB, default, Vol 2, 22–18
Vol 2, 21–2 vi editor, Vol 1, 1–10
varying_arg data type, Vol 2, B–17 Viewports, Vol 2, 22–19
VAX, architecture, Vol 1, 1–4 Virtual address space, Vol 1, 12–2, 12–7, 13–1,
13–8
VAX Ada
increasing and decreasing, Vol 1, 12–6, 13–8
See Ada
mapping section of, Vol 1, 12–19, 13–18
VAX APL
specifying array, Vol 1, 12–8, 13–10
See APL
Virtual displays, Vol 2, 22–12
VAX BASIC
See BASIC See also Viewports
VAX BLISS checking occlusion, Vol 2, 22–14
See BLISS creating, Vol 2, 22–12
VAX C creating a subprocess from, Vol 2, 22–18
See C cursor movement, Vol 2, 22–21
VAXCDEF.TLB deleting, Vol 2, 22–16
replaced by new files, Vol 2, 21–1 deleting text, Vol 2, 22–23
drawing lines, Vol 2, 22–22
VAX COBOL
erasing, Vol 2, 22–16
See COBOL
ID, Vol 2, 22–12, 22–33
VAX data types
inserting text, Vol 2, 22–20, 22–21
See Data types list pasting order of, Vol 2, 22–16
VAX DIBOL, Vol 1, 1–11 logical cursor position, Vol 2, 22–19
VAXELN toolkit, Vol 1, 1–20 modifying, Vol 2, 22–17
VAX Environment Software Translator obtaining the pasting order, Vol 2, 22–16
See VEST overwriting text, Vol 2, 22–20, 22–21
pasting, Vol 2, 22–13
physical cursor position, Vol 2, 22–19
Index–24
Virtual displays (cont’d) Web-enabling tools, Vol 1, 1–8
popping, Vol 2, 22–16 Wildcard searches
reading data from, Vol 2, 22–24 obtaining information about processes
rearranging, Vol 2, 22–15 example, Vol 1, 4–13
scrolling, Vol 2, 22–21 using SYS$GETJPI system service, Vol 1, 4–12
sharing, Vol 2, 22–33 word_signed data type, Vol 2, B–17
specifying double-size characters, Vol 2, 22–21 word_unsigned data type, Vol 2, B–17
specifying video attributes, Vol 2, 22–12 Working sets
viewports, Vol 2, 22–19 adjusting size, Vol 1, 12–11, 13–11
writing double-width characters, Vol 2, 22–20 paging, Vol 1, 12–10, 13–11
writing text to, Vol 2, 22–19 Write-back sections, Vol 1, 12–25, 13–23
Virtual I/O, Vol 2, 23–6 Writing a condition handler
Virtual keyboards example, Vol 1, 9–65
reading data from, Vol 2, 22–24, 22–25
Virtual page size, Vol 1, 13–1
Volume protection, Vol 2, 23–4 Z
Volumes Zones, Vol 1, 14–6 to 14–14
initializing allocation algorithm, Vol 1, 14–14
within a program, Vol 2, 23–36 attributes, Vol 1, 14–8
example, Vol 2, 23–36 creating, Vol 1, 14–7
mounting, Vol 2, 23–34 default, Vol 1, 14–12
deleting, Vol 1, 14–7
W identifier, Vol 1, 14–12
resetting, Vol 1, 14–13
WAIT form services, Vol 1, 6–29 user-created, Vol 1, 14–6
Wait mode, system service, Vol 2, 20–6
Wakeup requests, scheduling, Vol 2, 27–16
Index–25