Document revision date: 30 March 2001

## OpenVMS Programming Concepts Manual

Previous | Contents | Index

### 1.5.2 Creating Object Files

OpenVMS supports a variety of optional language compilers, interpreters, and assemblers that translate source code to object code (in the form of object modules). These language implementations adhere to industry standards, including ISO, ANSI, X/Open standards as well as U.S. Federal Information Processing Standards (FIPS) and Military Standards (MIL-STD), as applicable.

Table 1-3 lists language compilers, interpreters, and assemblers supported in the OpenVMS VAX and OpenVMS Alpha environments. Names that begin with DEC refer to software available on Alpha and VAX platforms unless otherwise indicated.

Table 1-3 Compilers, Interpreters, and Assemblers
Language | Characteristics
--- | ---
Compaq Ada | Complete production-quality implementation of Ada language; fully conforms to ANSI and MIL-STD standards; has Ada validation
VAX APL | Interpreter with built-in editor, debugger, file system, communication facility
VAX BASIC | Either an interpreter or a compiler; fully supported by the OpenVMS debugger; fully reentrant code
Compaq BASIC for OpenVMS Alpha | An optimizing compiler; highly compatible with VAX BASIC; no environment/interpreter support
Compaq BLISS-32 | Advanced set of language features supporting development of modular software according to structured programming concepts
Compaq BLISS-64 | Development of modular software support for 64-bit programs
VAX C | Full implementation of C programming language with added features for performance enhancement in the OpenVMS environment
Compaq C for OpenVMS Alpha | Compliant with ISO/ANSI-standard Programming Language C; supports 64-bit virtual addressing
Compaq C++ | C++ compiler with class libraries, a new C Run-Time Library, and debug support; facilitates object-oriented program design
Compaq COBOL | Compliant with ANSI-standard COBOL; includes as enhancements screen-handling, file-sharing, and report-writing facilities
VAX DIBOL | For interactive data processing; includes a compiler, debugger, and utility programs for data handling, data storing, and interprogram communication
Compaq Fortran for OpenVMS VAX | ANSI-standard FORTRAN-77 support with many industry-leading extensions; conforms to FIPS standards; has a high optimization compiler and takes full advantage of features of OpenVMS environment
Compaq Fortran for OpenVMS Alpha | ANSI-standard FORTRAN-77 support, nearly all Compaq Fortran for OpenVMS VAX extensions support, and other language features, including recursion
Compaq Fortran 90 | ANSI-standard FORTRAN-90 support for high-performance capabilities using parallel and clustered resources
VAX MACRO | Assembly language for programming the VAX computer under the OpenVMS operating system; uses all OpenVMS resources; supports large instruction set enabling complex programming statements
MACRO-32 Compiler | Available on OpenVMS Alpha systems to port existing VAX MACRO code to an Alpha system
MACRO-64 Assembler | Available on OpenVMS Alpha systems; a RISC assembly language that provides precise control of instructions and data
Compaq OPS5 | Highly efficient language for implementing expert systems; used to apply artificial intelligence technology to production systems
Compaq Pascal | ANSI-standard Pascal features and added features support using character instruction sets and OpenVMS virtual memory
VAX PL/I | A compile-time preprocessor that allows language extension and conditional compilation
Compaq PL/I for OpenVMS Alpha | For complex programs; supports many data types including floating-point

### 1.5.3 Creating Runnable Programs

After a program source file is coded, it must be compiled or assembled into object modules by a language processor and then linked. The OpenVMS Linker binds the object modules into an image that can be executed on the OpenVMS operating system.

The linker processes object modules and shareable image files, as well as symbol table files, library files, and options files (used to manage the linking operation and simplify the use of complex, repetitious linker operations). The most common output of the linker is an executable image of the program. The linker can also produce a shareable image, a system image, an image map, or a symbol table file to be used by other programs being linked. Certain linking tasks, such as creating shareable images, are performed differently on OpenVMS VAX and OpenVMS Alpha systems.

The Librarian utility provides for efficient storage in central, easily accessible files of object modules, image files, macros, help text, or other record-oriented information.

### 1.5.4 Testing and Debugging Programs

The debugger allows users to trace program execution and to display and modify register contents using the same symbols as are in the source code.

The following debugger utilities available on both the OpenVMS VAX and OpenVMS Alpha operating systems contain some system-specific features related to the platform architecture:

- The OpenVMS Debugger (debugger), which debugs user-mode code
- The Delta/XDelta Debugger (DELTA/XDELTA), which debugs code in other modes as well as user mode

The OpenVMS symbolic debugger is more useful than DELTA/XDELTA for most programs: the symbolic commands entered using different interfaces (keypad, command line, or file of commands), display source code lines on the screen, have more descriptive error messages, and provides help information.

The debugger command language specified in the OpenVMS Debugger Manual provides more than 100 commands to control a debugging session, including these tasks:

- Control program execution on a line-by-line basis or at a user-specified breakpoint
- Display breakpoints, tracepoints, watchpoints, active routine calls, stack contents, variables, symbols, source code, and source directory search list
- Define symbols
- Create key definitions
- Change values in variables
- Evaluate a language or address expression
- Create or excute debugger command procedures

The OpenVMS symbolic debugger provides enhanced support for programs that have multiple threads of execution within an OpenVMS process, including any program that uses Compaq POSIX Threads Library for developing real-time applications.

The debugger has been modified to support debugging of programs that contain 64-bit data addresses.

An additional debugger utility is available only on an OpenVMS Alpha system: the OpenVMS Alpha System-Code Debugger, which can be used to debug non-pageable system code and device drivers. The system-code debugger is a symbolic debugger that lets the user employ the familiar OpenVMS Debugger interface to observe and manipulate system code interactively as it executes. The system-code debugger can display the source code where the software is executing and allows the user to advance by source line.

Users can perform the following tasks using the system-code debugger:

- Control the system software's execution, stopping at points of interest, resuming execution, intercepting fatal exceptions, and so on
- Trace the execution path of the system software
- Monitor exception conditions
- Examine and modify the value of variables
- In some cases, test the effect of modifications without having to edit the source code, recompile, and relink

You can use the OpenVMS Alpha System-Code Debugger to debug code written in the following languages: C, BLISS, and MACRO. Information about using the system-code debugger and how it differs from the OpenVMS Debugger is given in Writing OpenVMS Alpha Device Drivers in C.

#### 1.5.4.1 Special Modes of Operation for Debugging

The OpenVMS operating system has a number of special modes of operation designed to aid in debugging complex hardware and software problems. In general terms, these special modes enable an extra level of tracing, data recording, and consistency checking that is useful in identifying a failing hardware or software component. These modes of operation are controlled by the following system parameters:

- MULTIPROCESSING
- POOLCHECK
- BUGCHECKFATAL
- SYSTEM_CHECK

MULTIPROCESSING is useful for debugging privileged code that uses spinlocks, such as device driver code. POOLCHECK is useful for investigating frequent and inexplicable failures in a system. When POOLCHECK is enabled, pool-checking routines execute whenever pool is deallocated or allocated. BUGCHECKFATAL is useful for debugging the executive. SYSTEM_CHECK turns on the previous three system parameters and also activates other software that aids in detecting problems. It enables a number of run-time consistency checks on system operation and records some trace information.

If you are using one of these special modes, for example, to debug a device driver or other complex application, under certain conditions generally related to high I/O loads, it is possible to incur a CPUSPINWAIT bugcheck. To prevent a CPUSPINWAIT bugcheck, use either the system default settings for these system parameters, or reduce the loading of the system.

If you have reason to change the default settings, you can reduce the likelihood of encountering a problem by setting the SMP_LNGSPINWAIT system parameter to a value of 9000000.

### 1.5.5 Using Other Program Development Utilities

Other OpenVMS utility programs used for program development are listed in Table 1-4. RMS utilities, which permit file analysis and tuning, are covered in Section 1.10.2.

Table 1-4 Other OpenVMS Program Development Utilities
Utility | Function
--- | ---
Command Definition Utility (CDU) | Enables an application developer to create commands with a syntax similar to DIGITAL Command Language (DCL) commands
Message utility | Permits user to create application messages to supplement the OpenVMS system messages
Patch utility 1 | Permits users to make temporary changes (in the form of patches) to an image file; the new version can then be run without recompiling and relinking
SUMSLP utility | Supplies batch-oriented editor used to make several updates to a single source file; one update program can be applied to all versions of a file
National character set utility | Permits users to define non-ASCII string collating sequences and to define conversion functions; allows an RMS indexed file to be collated using user-specified collating sequences
System Dump Analyzer utility 2 | Determines the cause of system failures; reads the crash dump file and formats and displays it; also used to diagnose root causes that lead to an error

1VAX specific.
2Different versions run on the VAX and Alpha platforms.

### 1.5.6 Managing Software Development Tasks

You can use optional products that run on OpenVMS systems to manage the complexity of software development tasks:

- Compaq Code Management System (CMS) for OpenVMS provides an efficient method of storing project files (such as documents, object files, and other records) and tracking all changes to these files.
- Compaq Module Management System (MMS) for OpenVMS automates building of software applications.

## 1.6 Using Callable System Routines

OpenVMS provides extensive libraries of prewritten and debugged routines that can be accessed by programs. Libraries specific to OpenVMS VAX and OpenVMS Alpha systems supply commonly needed routines optimized for the OpenVMS environment; these libraries include run-time library routines, system services, utility routines, and RMS services. These libraries are described in this section.

### 1.6.1 Using the POSIX Threads Library Routines

The POSIX Threads Library, previously known as DECthreads, routine library provides a set of portable services that support concurrent programming by creating and controlling multiple threads of execution within the address space provided by a single process on an OpenVMS system. POSIX threads services are based on the IEEE POSIX standard 1003.1c and are compliant with OSF Distributed Computing Environment (DCE) standards. On OpenVMS Alpha systems, POSIX threads are layered over kernel threads.

POSIX threads run-time library services provide an application programming interface usable from all OpenVMS languages and an open C-only POSIX interface that adheres to the POSIX threads standard.

On OpenVMS Alpha systems, POSIX threads provide support to accept 64-bit parameters.

The highly portable POSIX threads interface contains routines grouped in the following functional categories:

- General threads
- Object attributes
- Mutex
- Condition variable
- Thread context
- Thread cancellation
- Thread priority and scheduling
- Debugging

For more information about threads, see the Guide to POSIX Threads Library.

### 1.6.2 Using OpenVMS Run-Time Library Routines

The OpenVMS Run-Time Library (RTL) is a set of language-independent procedures for programs to be run specifically in the OpenVMS environment. RTL routines establish a common run-time environment for application programs written in any language supported in the OpenVMS common language environment. RTL procedures adhere to the OpenVMS calling standard and can be called from any program or program module in a language supported by OpenVMS (see Section 1.5.2).

The run-time library provides general-purpose functions for application programs. Table 1-5 summarizes the groups of RTL routines.

Table 1-5 Groups of OpenVMS Run-Time Library Routines
Routine | Description
--- | ---
DTK$ routines | Routines that control the Compaq DECtalk system
LIB$ routines | Library routines that perform generally needed system functions such as resource allocation and common I/O procedures; provide support for 64-bit virtual addressing on OpenVMS Alpha systems
MTH$ routines 1 | Math routines that perform arithmetic, algebraic, and trigonometric functions
DPML$ routines 2 | Compaq Portable Mathematics Library for OpenVMS Alpha; a set of highly accurate mathematical functions
OTS$ routines | Language-independent routines that perform tasks such as data conversion
SMG$ routines | Screen management routines used in the design of complex images on a video screen
STR$ routines | String manipulation routines

1VAX specific
2Alpha specific

In addition, language-specific RTL routines support procedures in Ada, BASIC, C, COBOL, Fortran, Pascal, and PL/I as well as in POSIX C. Compaq C RTL routines support 64-bit programming on OpenVMS Alpha systems.

The Digital Extended Math Library (DXML) for OpenVMS is a set of libraries of mathematical subroutines that are optimized for Compaq platforms. DXML includes four libraries covering the areas of basic linear algebra, linear system and eigenproblem solvers, sparse linear system solvers, and signal processing. DXML offers development and run-time options and is suitable for high-performance applications such as seismic analysis, signal and image processing, and antenna design.

### 1.6.3 Using OpenVMS System Services

OpenVMS system services are procedures that control resources available to processes, provide for communication among processes, and perform basic operating system functions such as I/O coordination. Application programs can call OpenVMS system services to perform the same operations that the system services provide for the OpenVMS operating system (for example, creating a process or subprocess).

At run time, an application program calls a system service and passes control of the process to it. After execution of the system service, the service returns control to the program and also returns a condition value. The program analyzes the condition value, determines the success or failure of the system service call, and alters program execution flow as required.

OpenVMS system services are divided into functional groups, as shown in Table 1-6. System services can be used to protect and fine-tune the security of the OpenVMS environment, handle event flags and system interrupts, designate condition handlers, and provide logical name services and timer services to the application. Other system services control and provide information about processes, manage virtual memory use, and synchronize access to shared resources.

Table 1-6 Groups of OpenVMS System Services
Service Group | Function
--- | ---
Security | Provides mechanisms to enhance and control system security
Event flag | Clears, sets, and reads event flags; places process in wait state until flags are set
AST | Controls handling of software interrupts called asynchronous system traps (ASTs)
Logical names | Provide a generalized logical name service
Input/output | Performs input and output operations directly at the device driver level, bypassing RMS
Process control | Creates, deletes, and controls the execution of processes (on a clusterwide basis); permits a process on one node to request creation of a detached process on another node
Process information | Provides information about processes
Timer and time conversion | Permits scheduling of program events at specific times or time intervals; supplies binary time values
Condition handling | Designates condition-handling procedures that gain control when an exception/condition occurs
Memory management | Permits control of an application program's virtual address space
Change mode | Changes the access mode of a process
Lock management | Permits cooperating processes to synchronize their access to shared resources
DECdtm services | Provide for complete and consistent execution of distributed transactions and for data integrity
Cluster event notification 1 | Requests notification when a VMScluster configuration event occurs

1Alpha specific

OpenVMS I/O system services perform logical, physical, and virtual I/O and network operations, and queue messages to system processes. The $QIO system service provides a direct interface to the operating system's I/O routines. These services are available from within most programming languages supported by OpenVMS and can be used to perform low-level I/O operations efficiently with a minimal amount of system overhead for time-critical applications.

On OpenVMS Alpha systems, new system services provide access to 64-bit virtual address space for process private use. Additionally, new system services are available to provide high CPU performance and improved symmetric multiprocessing (SMP) scaling of I/O operations. These services exhibit high-performance gains over the $QIO service.

DECdtm services ensure consistent execution of applications on the OpenVMS operating system. In transaction processing applications, many users may be simultaneously making inquiries and updating a database. The distributed transaction processing environment typically involves communication between networked systems at different locations. DECdtm services coordinate distributed transactions by using the two-phase commit protocol and implementing special logging and communication techniques. DECdtm services ensure that all parts of a transaction are completed or the transaction is aborted.

Previous | Next | Contents | Index

| privacy and legal statement |
5841PRO_002.HTML