HP OpenVMS Systems Documentation

Content starts here

HP Pascal for OpenVMS

User Manual

Order Number: AA-PXSND-TK

January 2005

This manual contains information about selected programming tasks using the HP Pascal programming language.

Revision/Update Information: This revised manual supersedes the Compaq Pascal User Manual for OpenVMS Systems, Version 5.7.

Operating System: OpenVMS I64 Version 8.2 or higher
OpenVMS Alpha Version 6.1 or higher
OpenVMS VAX Version 5.5 or higher

Software Version: HP Pascal for OpenVMS I64 Systems Version 5.9
HP Pascal for OpenVMS Alpha Systems Version 5.9
HP Pascal for OpenVMS VAX Systems Version 5.8

Hewlett-Packard Company Palo Alto, California

© Copyright 2005 Hewlett-Packard Development Company, L.P.

Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.

The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.

Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

Printed in the US


This manual is available on CD-ROM.

Contents Index


This manual describes selected programming tasks using the HP Pascal programming language. It contains information on using some HP Pascal language elements in combination, and it provides examples of how to improve programming efficiency.

You can use the information in this manual to write programs or modules for the OpenVMS operating system. If you need to write HP Pascal programs or modules that must be compiled by another compiler, see the HP Pascal for OpenVMS Language Reference Manual for a checklist of language extensions not included in the Pascal standard. The HP Pascal for OpenVMS Language Reference Manual also provides information on the Pascal standard.

Intended Audience

This manual is intended for experienced applications programmers with a firm understanding of the Pascal language. Some familiarity with the operating system is helpful.

Document Structure

This manual contains the following chapters and appendixes:

  • Chapter 1 provides information on compiling programs, linking programs, running programs, and using text and object-module libraries.
  • Chapter 2 describes the use of separately compiled modules.
  • Chapter 3 describes programming techniques that improve the efficiency of compilation and execution.
  • Chapter 4 provides information on tools that you may want to use to develop HP Pascal programs.
  • Chapter 5 provides information on the OpenVMS Calling Standard as applied to HP Pascal programs.
  • Chapter 6 provides information on HP Pascal system definitions files, and declaring and calling system routines.
  • Chapter 7 provides information on the relationship between HP Pascal input and output, and the underlying OpenVMS VAX Record Management Services (RMS) constructs.
  • Chapter 8 provides information on error processing and writing condition handlers.
  • Chapter 9 provides information on migrating from OpenVMS to OpenVMS I64 or OpenVMS Alpha systems.
  • Appendix A provides a list of possible error values returned by the STATUS and STATUSV functions.
  • Appendix B provides a list of entry points to utilities in the OpenVMS Run-Time Library that can be called as external routines by an HP Pascal program.
  • Appendix C provides descriptions of diagnostic messages that can be generated by an HP Pascal program at compile time and run time.

Related Documents

The following manuals are also part of the HP Pascal documentation set:

  • HP Pascal for OpenVMS Language Reference Manual---Provides information on the syntax and semantics of the HP Pascal programming language, including information about the alignment, allocation, and internal representation of data types supported by HP Pascal.
  • HP Pascal for OpenVMS Installation Guide---Provides information on how to install HP Pascal on your operating system.

Reader's Comments

HP welcomes your comments on this manual. Please send comments to either of the following addresses:

Internet openvmsdoc@hp.com
Postal Mail Hewlett-Packard Company
OSSG Documentation Group, ZKO3-4/U08
110 Spit Brook Rd.
Nashua, NH 03062-2698

HP Pascal Home Page

You can access the HP Pascal home page at:



The following product names may appear in this manual:

  • HP OpenVMS Industry Standard 64 for Integrity Servers
  • OpenVMS I64
  • I64

All three names---the longer form and the two abbreviated forms---refer to the version of the OpenVMS operating system that runs on the Intel® Itanium® architecture.

The following typographic conventions might be 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.

... 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.
A vertical ellipsis indicates the omission of items from a code example or command format; the items are omitted because they are not important to the topic being discussed.
( ) In command format descriptions, parentheses indicate that you must enclose choices in parentheses if you specify more than one.
[ ] In command format descriptions, brackets indicate optional choices. You can choose one or more items or no items. Do not type the brackets on the command line. However, you must include the brackets in the syntax for OpenVMS directory specifications and for a substring specification in an assignment statement.
| In command format descriptions, vertical bars separate choices within brackets or braces. Within brackets, the choices are optional; within braces, at least one choice is required. Do not type the vertical bars on the command line.
{ } In command format descriptions, braces indicate required choices; you must choose at least one of the items listed. Do not type the braces on the command line.
bold type Bold type represents the introduction of a new term. It also represents the name of an argument, an attribute, or a reason.
italic type Italic type indicates important information, complete titles of manuals, or variables. Variables include information that varies in system output (Internal error number), in command lines (/PRODUCER= name), and in command parameters in text (where dd represents the predefined code for the device type).
UPPERCASE TYPE Uppercase type indicates a command, the name of a routine, the name of a file, or the abbreviation for a system privilege.
- A hyphen at the end of a command format description, command line, or code line indicates that the command or statement continues on the following line.
numbers All numbers in text are assumed to be decimal unless otherwise noted. Nondecimal radixes---binary, octal, or hexadecimal---are explicitly indicated.

Chapter 1
Compiling HP Pascal Programs

After you use a text editor to write code to a file, you use Digital Command Language (DCL) commands to compile modules and programs, and to link and run programs. This chapter covers the following topics:

For information on DCL syntax, see HELP or the OpenVMS documentation set.

1.1 PASCAL Command

The PASCAL command invokes the HP Pascal compiler, which verifies program source statements, issues error messages, and generates and groups machine language instructions into an object module for the linker.

The default for compiler output files (object modules) is the .OBJ file type.

The Pascal command format is as follows:

PASCAL [[{/command-qualifier}...]] {file-spec[[{/file-qualifier}...]]}
  • +
  • ,
/qualifier [[=
  • file-spec
  • identifier
  • (identifier,...)
  • n
  • name=identifier,...
  • directory,...


The name of a qualifier that indicates special processing to be performed by the compiler on all files listed.


The name of one of the following:
  • The input source file that contains the program or module to be compiled. If you separate multiple source file specifications with commas, the programs are compiled separately. If you separate the file specifications with plus signs, the files are concatenated and compiled as one program.
    The default file type for an input file is either .PAS (source file) or .TLB (text-library module).
  • The output file used only with the /ANALYSIS_DATA, /ENVIRONMENT, /LIST, /OBJECT, or /DIAGNOSTICS qualifiers.


The name of a qualifier that indicates special processing to be performed by the compiler on the files to which the qualifier is attached.


The name of one or more options that modify the /ALIGN, /CHECK, /DEBUG, /DESIGN, /FLOAT, /OPTIMIZE, /SHOW, /STANDARD, /TERMINAL, and /USAGE qualifiers.


The value of an integer constant. When used with the /ERROR_LIMIT qualifier, this parameter indicates the maximum number of errors to be detected before compilation ceases. When used with the /OPTIMIZATION=LEVEL=n qualifier, this parameter indicates a specific level of optimization.


The definition of a constant or name with the specified value when used with the /CONSTANT qualifier.


The input directory that contains the include file, environment file, or text library processed by a %INCLUDE directive or [INHERIT] attribute when used with the /INCLUDE qualifier.

1.1.1 PASCAL Command Examples

This section contains examples of PASCAL command lines.


The source file M.PAS in directory [DIR] is compiled, producing an object file named M.OBJ and a listing file named M.LIS. The compiler places the object and listing files in the default directory.


Source files A.PAS, B.PAS, and C.PAS are compiled as separate files, producing object files named A.OBJ, B.OBJ, and C.OBJ, and listing files named A.LIS, B.LIS, and C.LIS.

$ PASCAL X + Y + Z
Source files X.PAS, Y.PAS, and Z.PAS are concatenated and compiled as one file producing an object file named X.OBJ. By default, batch mode produces a listing file, which takes its name from the name of the first file on the command line. In this example, the name of the listing file would be X.LIS.

When a qualifier follows the file specification, it applies only to the file immediately preceding it. Files concatenated with plus signs are considered one file. This command line produces four object files, A.OBJ, B.OBJ, C.OBJ, and F.OBJ, and one listing file, D.LIS.


This command completely suppresses the object file; that is, source files A.PAS, CIRC.PAS, and X.PAS are concatenated and compiled, but no object file is produced.

1.1.2 PASCAL Qualifiers

This section describes the command and file qualifiers that you can use when compiling code.


Controls the default alignment rules. Note that specifying the ALIGN attribute overrides any value that was previously specified for the /ALIGN qualifier.

Table 1-1 lists the values for keyword.

Table 1-1 /ALIGN Qualifier Options
Option Action Default Information
NATURAL 1 Uses natural alignment when positioning record fields or array components. Natural alignment is when a record field or an array component is positioned on a boundary based on its size. For example, 32-bit integers are aligned on the nearest 32-bit boundary. Default on OpenVMS I64 and OpenVMS Alpha systems if /ALIGN is not specified.
VAX Uses byte alignment when positioning record fields or array components. Record fields or array components larger than 32 bits are positioned on the nearest byte boundary. Default on OpenVMS VAX systems if /ALIGN is not specified.

1Previous versions of HP Pascal used ALPHA_AXP for this keyword. The NATURAL keyword is now the recommended spelling for the same behavior. The ALPHA_AXP keyword will continue to be recognized for compatibility with old command lines.

On OpenVMS VAX systems, when you specify a value of NATURAL, automatic variables are aligned on longword boundaries instead of quadword boundaries. This occurs because the largest allowable alignment for the stack is longword alignment.



Creates a file containing source code analysis information. If you omit the file specification, the analysis file defaults to the name of your source file with a .ANA file type. The source code analysis file is used with products such as the Language-Sensitive Editor/Source Code Analyzer (LSE/SCA).


/ARCHITECTURE=GENERIC (default) (OpenVMS Alpha systems only)

Specifies which version of the Alpha architecture instructions should be generated for. All Alpha processors implement a core set of instructions and, in some cases, the following extensions: BWX (byte- and word- manipulation instructions) and MAX (multimedia instructions). See the Alpha Architecture Reference Manual for additional information. Table 1-2 lists the available keywords:

Table 1-2 /ARCHITECTURE Qualifier Options
Option Action Default Information
GENERIC Generate instructions that are appropriate for all Alpha processors. This option is the default.
HOST Generate instructions for the processor on which the compiler is running (for example, EV56 instructions on an EV56 processor, and EV4 instructions on an EV4 processor).  
Generate instructions for the EV4 processor (21064, 20164A, 21066, and 21068 chips) and EV5 processor (some 21164 chips). (Note that the EV5 and EV56 processors both have the same chip number - 21164.)  
EV56 Generate instructions for EV56 processors (some 21164 chips). This option permits the compiler to generate any EV4 instruction, plus any instructions contained in the BWX extension.

Applications compiled with this option may incur emulation overhead on EV4 and EV5 processors.

PCA56 Generate instructions for PCA56 processors (21164PC chips). This option permits the compiler to generate any EV4 instruction, plus any instructions contained in the BWX and MAX extensions. However, HP Pascal does not generate any of the instructions in the MAX (multimedia) extension to the Alpha architecture.  
EV6 Generate instructions for EV6 processors (21264 chips). This option permits the compiler to generate any EV4 instruction, any instruction contained in the BWX and MAX extensions, plus any instructions added for the EV6 chip. These new instructions include a floating-point square root instruction (SQRT), integer/floating-point register transfer instructions, and additional instructions to identify extensions and processor groups.

Applications compiled with this option may incur emulation overhead on EV4, EV5, EV56, and PCA56 processors.

EV6 Generate instructions for EV7 processors (21364 chips).

This option permits the compiler to generate any EV67 instruction. There are no additional instructions available on the EV7 processor, but the compiler does have different instruction scheduling and prefetch rules for tuning code for the EV7.

Applications compiled with this option may incur emulation overhead on EV4, EV5, EV56, and PCA56 processors.

Generate instructions for EV67 and EV68 processors (21264A chips).

This option permits the compiler to generate any EV6 instruction, plus the new bit count instructions (CTLZ, CTPOP, and CTTZ). However, HP Pascal does not currently generate any of the new bit count instructions, and the EV67 and EV68 have identical instruction scheduling models, so the EV67 and EV68 are essentially identical to the EV6.

Applications compiled with this option may incur emulation overhead on EV4, EV5, EV56, and PCA56 processors.


Beginning with OpenVMS Alpha V7.1 and continuing with subsequent versions, the operating system includes an instruction emulator. This capability allows any Alpha chip to execute and produce correct results from Alpha instructions, regardless of whether some of the instructions are not implemented on the chip. Applications using emulated instructions will run correctly, but may incur significant emulation overhead at run time.

/ASSUME=([NO]ACCURACY_SENSITIVE) (OpenVMS I64 and Alpha systems only)


Specifies whether certain code transformations that affect floating-point operations are allowed. These changes may or may not affect the accuracy of the program's results.

If you specify NOACCURACY_SENSITIVE, the compiler is free to reorder floating-point operations based on algebraic identities (inverses, associativity, and distribution). This allows the compiler to move additional floating-point operations outside of loops or reduce or remove floating-point operations totally, thereby improving performance.

The default, ACCURACY_SENSITIVE, directs the compiler to avoid certain floating-point trasformations that might slighly affect the program's accuracy.



Directs the compiler to generate code to perform run-time checks. A single identifier or a list of identifiers enclosed in parentheses can follow /CHECK; these identifiers are the names of options that tell the compiler which aspects of the compilation unit to check.

The system issues an error message and normally terminates execution if any of the conditions in the options list occur. Table 1-3 lists the available checking options, their corresponding actions, and their negations.

Table 1-3 /CHECK Qualifier Options
Option Action Negation
ALL Generates checking code for all options. NONE
BOUNDS Verifies that an index expression is within the bounds of an array's index type, that character-string sizes are compatible with the operations being performed, and that schemata are compatible. NOBOUNDS
CASE_SELECTORS Verifies that the value of a case selector is contained in the corresponding case-label list. NOCASE_SELECTORS
DECLARATIONS Verifies that schema definitions yield valid types and that uses of GOTO from one block to an enclosing block are correct. Also controls whether the ASSERT statement is processed. NODECLARATIONS
OVERFLOW Verifies that the result of an integer computation does not exceed the machine representation. NOOVERFLOW
POINTERS Verifies that the value of a pointer variable is not NIL. NOPOINTERS
SUBRANGE Verifies that values assigned to variables of subrange types are within the subrange; verifies that a set expression is assignment compatible with a set variable; verifies that MOD operates on positive numbers. NOSUBRANGE

The BOUNDS and DECLARATIONS options are the only checking options enabled by default. The /CHECK qualifier without options is equivalent to /CHECK=ALL. The negation /NOCHECK is equivalent to /CHECK=NONE.

The CHECK attribute in the source program or module overrides the /CHECK qualifier on the command line.


The /CONSTANT qualifier allows a limited set of Pascal constants to be defined from the command line. This capability can be used to augment the conditional-compilation facility.

name is the name of a Pascal constant to create. You cannot define any predeclared Pascal name by the command line.

value can be one of the following:

  • integer-literal
  • --integer-literal
  • TRUE
  • "string-literal"
  • 'string-literal'

Nonbase-10 integer literals are not supported on the command line. For example:


Note that the definition of /CONSTANT is such that DCL does not remove any double-quote characters used in the name=value clauses. All characters are literally passed to the compiler for processing. This behavior is slightly different from the usual behavior of putting items in double quotes on DCL commands to preserve the case, but not to pass the double quotes to the target application.

This definition of /CONSTANT allows you to define Pascal string literals with embedded single quotes and for DCL symbol substitutions. For example,


PASCAL/CONSTANT=MSG="Special compile run for Monday"

IDENT = "V1.0"


Inserting double-quote characters and inserting adjacent single-quote characters can be accomplished by using the \ escape character allowed in HP Pascal double-quoted string constants.

Next Contents Index