[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

OpenVMS Programming Concepts Manual


Previous Contents Index

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 provide 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 the 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 an OpenVMS Cluster 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.

1.6.4 Using OpenVMS Utility Routines

OpenVMS programs can access some OpenVMS utilities through callable interfaces. Utility routines enable programs to invoke the utility, execute utility-specific functions, and exit the utility, returning to the program. Table 1-7 lists the OpenVMS utility routines.

Table 1-7 OpenVMS Utility Routines
Routine Utility/Facility
ACL$ Access control list editor (ACL editor)
CLI$ Command Definition Utility (CDU)
CONV$ Convert and Convert/Reclaim utilities (CONVERT and CONVERT/RECLAIM)
DCX$ Data Compression/Expansion facility (DCX)
EDT$ EDT editor
FDL$ File Definition Language utility (FDL)
LBR$ Librarian utility (LIBRARIAN)
LGI$ LOGINOUT routines
MAIL$ Mail utility (MAIL)
NCS$ National Character Set utility (NCS)
PSM$ Print Symbiont Modification facility (PSM)
SMB$ Symbiont/Job-Controller Interface facility (SMB)
SOR$ Sort/Merge utility (SORT/MERGE)
TPU$ DEC Text Processing Utility (DECTPU)

You can use an optional, portable library of user-callable routines to perform high-performance sorting on OpenVMS Alpha systems. The high-performance sort supports a subset1 of the functionality present on the OpenVMS Sort/Merge utility, using the callable interface to the SOR$ routine. The high-performance sort/merge provides better performance for most sort and merge operations.

Note

1 Available with OpenVMS Alpha Version 7.0; full functionality is planned for a future version of OpenVMS Alpha.

1.7 Programming User Interfaces

User interfaces to the OpenVMS VAX and OpenVMS Alpha operating systems include the DCL interface and the optional Compaq DECwindows Motif for OpenVMS graphical user interface. Another user interface is through electronic forms.

You can use DCL commands to invoke program development software (compilers, editors, linkers) and to run and control execution of programs. You can use DCL command procedures to perform repetitious operations in software development.

The Command Definition Utility (CDU) enables application developers to create DCL-level commands with a syntax similar to OpenVMS DCL commands. Using CDU, the developer can create applications with user interfaces similar to those of operating system applications. The Message utility permits an application developer to create application messages to supplement the system messages supplied by the OpenVMS operating system.

The Compaq DECwindows Motif for OpenVMS software provides a consistent user interface for developing software applications and includes an extensive set of programming libraries and tools. Compaq DECwindows Motif for OpenVMS supports both the OSF/Motif standards-based graphical user interface and the X user interface (XUI) in a single run-time and development environment. Compaq DECwindows Motif for OpenVMS Alpha requires a DECwindows X11 display server (device driver and fonts) that supports the portable compiled format (PCF), permitting use of vendor-independent fonts.

An applications programmer can use the following Compaq DECwindows Motif for OpenVMS software to construct a graphical user interface:

  • A user interface toolkit composed of graphical user interface objects (widgets and gadgets); widgets provide advanced programming capabilities that permit users to create graphic applications; gadgets, similar to widgets, require less memory to create labels, buttons, and separators
  • A user interface language to describe visual aspects of objects (menus, labels, forms) and to specify changes resulting from user interaction
  • The OSF/Motif Window Manager, which allows users to customize the interface

The Compaq DECwindows Motif for OpenVMS programming libraries provided include:

  • Standard X Window System libraries such as Xlib and the intrinsics
  • Libraries needed to support the current base of XUI applications
  • OSF/Motif toolkit support for developing applications using the Motif user interface style
  • Compaq libraries that give users capabilities beyond the standards


Previous Next Contents Index