Technical Capabilities
Having trouble finding what you need?
Get in touch with us, so we can answer your specific questions directly.
Get In Touch

VX/PASCAL – OpenVMS PASCAL to ANSI C++

Overview

VX/PASCAL is a source-to-source translator that rewrites OpenVMS and VAX Pascal into ANSI-compliant C++, so existing Pascal applications compile, link, and run on x86 Linux and Windows with no manual code changes. It works on a typed model of the whole program rather than doing text substitution, so it understands the VMS-specific extensions a real OpenVMS estate depends on: VARYING and packed string types, VMS string descriptors, stack argument tracking, CDD record definitions, and RMS file handling all carry across intact rather than being passed through as unrecognised text.

The migration is fully automated. Pascal type declarations become C++ classes and templates, VMS system service calls are routed through call-compatible runtime jackets, and file and record access is served by the VX/RMS runtime, so the translated program behaves the same as it did on OpenVMS. The emitted C++ is readable, standard source that the GNU or Clang toolchain builds, debugs, and maintains, and teams keep developing in Pascal while each release is migrated, so there is no code freeze during a long project.

Translation model and pipeline

VX/PASCAL is a compile-time source-to-source translator, not a runtime emulator. It reads OpenVMS and VAX Pascal and writes ANSI C++, which the GNU (g++) or Clang toolchain then builds into a native Linux or Windows executable. The translator parses the full Pascal source into a typed program model with a recursive-descent parser and symbol table, so it can tell a VMS language extension apart from a semantic difference and apply the correct transformation to each rather than doing text substitution.

Two things ship together: the translator that rewrites the source, and the Pascal runtime library the emitted C++ links against for VMS string, descriptor, file, and system-service behaviour. Generated units include a single runtime header and link the runtime archive, so constructs such as VARYING strings, VMS descriptors, RMS files, and SYS$ service calls keep working because they are routed to the runtime rather than being left to the target compiler.

Compile-time, not runtime. VX/PASCAL emits ordinary ANSI C++, so the output is standard source the GNU or Clang toolchain builds, debugs, and profiles. Every emitted unit includes VxPascal.hxx and links the Pascal runtime, which supplies the string, descriptor, file, and OpenVMS system-service behaviour the code depends on.

Pipeline

Input
OpenVMS or VAX Pascal.pas source
01LexTokenises the Pascal source and its VMS language extensions.
02ParseBuilds the structured program model from the token stream.
03Resolve typesResolves symbols, declarations, and Pascal type relationships.
04TranspileRewrites VMS Pascal semantics into standard C++ forms.
05EmitWrites ANSI C++ source as .cxx.
06Target compilerGNU C++ (g++) or Clang compiles and links the emitted source.
Output
x86 Linux or Windows binaryNative executable using VxPascal.hxx and linked against the Pascal runtime

What runs the migration

StageRole
Source code analysisScans Pascal source for VMS-specific constructs, CDD record references, and complex data types, and reports diagnostics with a numbered error code rather than dropping anything silently.
TranspileRewrites VMS Pascal declarations, statements, and expressions into readable, maintainable ANSI C++ while preserving the original logic and structure.
Compile and linkThe GNU C++ (g++) or Clang compiler builds the emitted C++ into an optimised native binary linked against the Pascal runtime.
Execute and validateAutomated test cases confirm identical execution behaviour between the original VMS Pascal and the translated C++.

Options and customisation

Translation is driven by a setup table read from a customer setup file, so output can be tuned to house conventions without editing source: variable naming, code formatting (braces, indentation, and line breaks), VMS logical-name translation, POSIX error-code mapping, and inherited system-file handling are all controllable. Runtime checks (case, array bounds, nil pointers, allocation, and file state) can be enabled together for a validation build, and a compiler-style preset selects strict ANSI output in one switch.

Source dialect coverage

VX/PASCAL parses the full OpenVMS and VAX Pascal surface into a typed model, so it understands the extensions a real estate uses rather than passing them through as text. The table groups the VMS-specific constructs it recognises and shows how each one is carried onto the target platform: some are rewritten inline to standard C++, others are routed to the Pascal runtime, and the remainder are recognised and preserved through the emitted code.

VMS Pascal constructHow it is migrated
VARYING [n] OF CHAR and PACKED ARRAY [lo..hi] OF CHAR string typesRewritten to the runtime string class templates that carry VMS string semantics.
String descriptor parameters ([CLASS_S], by-descriptor arguments)Bridged to the runtime descriptor class and passed with the correct cast at the call site.
External and system-service headers ([EXTERNAL(SYS$...)], SYS$ routines)Emitted as extern "C" prototypes bound to call-compatible runtime jackets.
Argument mechanisms and defaults (%IMMED, %REF, %DESCR, := %IMMED 0)Preserved as C++ default arguments and the host calling convention.
Attribute-qualified declarations ([VOLATILE], [UNSAFE], [QUAD], [WORD], [ASYNCHRONOUS])Mapped to the matching C++ qualifier, packed layout, or width; volatile emission is switchable.
Variant records (RECORD ... CASE tag OF ...)Rewritten to a C++ struct containing an anonymous union of the variant layouts.
Sets, subranges, and schema types (SET OF, lo..hi, name(p) = ...)Mapped to the runtime set, subrange, and template-instantiation forms.
Preprocessing and inheritance (%IF conditional compilation, %INCLUDE, [INHERIT] system files)Conditional blocks evaluated, includes resolved, and inherited system files (for example starlet) pulled in.
Embedded SQL and CDD records (EXEC SQL, DICTIONARY references)CDD record definitions extracted and integrated so dictionary-defined types carry through.
Named gaps, not silent ones. Any construct the translator cannot fully represent surfaces a numbered diagnostic in the analysis output rather than being dropped, so the migration is auditable and nothing disappears without a trace.

Built-in procedures and functions

The predefined Pascal procedures and functions are lowered to their runtime equivalents, including SUBSTR, INDEX, LENGTH, PAD, ORD, CHR, PRED, SUCC, ODD, ABS, ROUND, TRUNC, NEW, DISPOSE, and PRESENT, alongside the file verbs OPEN, CLOSE, RESET, REWRITE, GET, PUT, FIND, READ, READLN, WRITE, WRITELN, and UPDATE.

Type mapping: Pascal to C++

Because the translator carries a typed model of the program, every Pascal type is mapped to a specific C++ type rather than a generic byte layout. Scalars map to fixed-width integer and floating types, and the structured Pascal types map to the runtime class templates that reproduce VMS layout and semantics. The result is readable C++ where a Pascal declaration still looks like the type it came from.

Pascal typeC++ type
INTEGER / INTEGER8/16/64int32_t / int8_t, int16_t, int64_t
UNSIGNED / UNSIGNED8/16/64uint32_t / uint8_t, uint16_t, uint64_t
BOOLEAN / CHARbool / uchar_t
REAL / SINGLE, DOUBLE / LONGREAL, QUADRUPLEfloat, double, long double (or __float128 where available)
subrange lo..hi_Subrange_t<base, lo, hi>
VARYING [n] OF CHAR_VaryingString<n>
PACKED ARRAY [lo..hi] OF CHAR_FixedString<lo, hi>
ARRAY [lo..hi] OF T_FixedArray<lo, hi, T>
SET OF subrange_Set<base, lo, hi> bitset
RECORD ... END / [UNSAFE] RECORDstruct (packed when unsafe)
RECORD ... CASE tag OF ...struct with an anonymous union of variants
^T pointerT *
FILE OF T / TEXTFile_t / _TEXT
enumerationenum with generated bound and size markers
schema name(p) = ...name<p> C++ template instantiation
Strings keep VMS semantics. VARYING and fixed strings become runtime class templates rather than raw char arrays, so length handling, padding, and descriptor passing behave exactly as they did under VMS Pascal.

Program entry and exit

A Pascal PROGRAM ... BEGIN ... END. becomes a standard C++ int main(int argc, const char *argv[]), and the program terminates through the runtime exit entry point rather than a bare return, so condition values and exit status are reported to the host the way they were on OpenVMS.

Before and after

These worked examples show VX/PASCAL rewriting real OpenVMS Pascal constructs into ANSI C++. The identifiers use a banking demo estate; the syntax is exactly the kind of change the translation applies.

VMS strings and a system service

A routine declares a VMS VARYING string, a fixed packed-array string, and an external OpenVMS system service with by-descriptor arguments and immediate defaults:

TYPE
   VString255_t = Varying[255] of Char;
   PString80_t  = Packed Array[1..80] OF Char;
[ASYNCHRONOUS,EXTERNAL(SYS$ASCTIM)] FUNCTION $ASCTIM (
        VAR TIMLEN : [VOLATILE] $UWORD := %IMMED 0;
        VAR TIMBUF : [CLASS_S,VOLATILE] Packed Array[$l2..$u2:INTEGER] OF Char;
        TIMADR : $UQUAD := %IMMED 0) : INTEGER; EXTERNAL;
VAR
  Stmt_Time    : PString80_t;
  Stmt_Display : VString255_t;
  Length_Time  : [WORD] 0..65535 := 0;

becomes:

#include "VxPascal.hxx"

extern "C" int32_t sys$asctim(
    $UWORD* TIMLEN = 0,
    DXX*    TIMBUF = NULL,
    $UQUAD* TIMADR = 0) ;

typedef _VaryingString<255> VString255_t ;
typedef _FixedString<1,80> PString80_t ;

    PString80_t   Stmt_Time;
    VString255_t  Stmt_Display;
    uint16_t      Length_Time = 0;

The VARYING and packed-array string types become the _VaryingString and _FixedString runtime templates, the [CLASS_S] descriptor parameter is bridged to the runtime DXX descriptor class, and the external VMS service is emitted as an extern "C" prototype whose := %IMMED 0 defaults become C++ default arguments.

Program body and string operations

BEGIN
  $ASCTIM (TIMLEN := Length_Time, TIMBUF := Stmt_Time);
  Stmt_Display := SUBSTR(Stmt_Time, 1, Length_Time);
  WRITELN ('Statement time [', Stmt_Time, ']');
END.

becomes:

int main(int argc, const char *argv[])
{
    sys$asctim(&Length_Time, Stmt_Time);
    Stmt_Display = Substr(Stmt_Time, 1, (Length_Time));
    Writeln(VXP_OUTPUT, E_CONTINUE, "%s%D%c",
            "Statement time [", (DXX *)(Stmt_Time), ']');
    vxrt_exit(0);
}

The BEGIN ... END. block becomes int main, SUBSTR and WRITELN resolve to their runtime entry points, string arguments are passed as DXX descriptors, and the program terminates through vxrt_exit so the exit status is reported to the host as it was on OpenVMS.

Variant records

A Pascal variant record keeps its tag and case structure as a C++ struct with an anonymous union, so overlaid layouts such as a transaction record carry across without hand editing:

TYPE
  Txn_t = RECORD
    Account : INTEGER;
    CASE Kind : Txn_Kind OF
      Debit  : (Amount   : INTEGER);
      Detail : (Ref_Text : Varying[40] of Char);
  END;

The fixed fields become struct members and the CASE variants become an anonymous union of the alternative layouts, preserving the original storage overlay.

Runtime, files, and system libraries

The emitted ANSI C++ links against the Pascal runtime library, which supplies the OpenVMS behaviour the source relied on. String handling, descriptors, file and record access, VMS system services, and CDD data structures all resolve against this runtime and the shared VX libraries rather than being left to the target compiler, so the migrated program behaves as it did on OpenVMS.

AreaWhat the runtime provides
Strings and descriptorsThe _VaryingString and _FixedString class templates and the DXX descriptor class, so VMS string length, padding, and by-descriptor passing behave as they did on VMS. OpenVMS STR$ routines such as STR$CONCAT and STR$COPY resolve through STR$ and C++ operator overloading.
File and record I/OSequential, relative, indexed (ISAM), and block files with keyed access, RFA access, and record locking, served by VX/RMS.
System servicesOpenVMS SYS$ services emitted as extern "C" prototypes bound to call-compatible runtime jackets, delivered through the SYS$ libraries in VX/RT.
CDD data structuresCommon Data Dictionary record definitions retained and integrated through VX/CDD, so CDD-defined types and references carry into the translated C++.
BuildMMS descriptions and command files converted to make and shell equivalents through VX/MMS, so the build carries across with the source.

Runtime routine families

The runtime library groups its entry points into the same families the emitted C++ calls: string operations (Substr, Index, Pad, Chr), arithmetic and radix conversion (Bin, Dec, Hex, Oct, Mod, Rem, Ord), file I/O (Open, Close, Reset, Rewrite, Find, Update), heap and array management, condition handlers (Establish, Halt), descriptors, and date and time. Argument presence built-ins such as PRESENT are supplied so VMS stack argument tracking keeps its meaning.

VMS stack argument tracking

Linux and Windows do not natively carry the VMS notion of a present or absent optional argument, which would otherwise cause incorrect behaviour when a routine tests whether an argument was supplied. VX/PASCAL preserves the PRESENT and not-present semantics in the emitted C++ and its runtime so optional-argument handling behaves as it did on OpenVMS.

System services and DCL

Applications that call OpenVMS system services keep working because those calls resolve against the VX/RT jacket libraries rather than the VMS executive, and logical-name and command-procedure behaviour is available through VX/DCL, so no source changes are needed to reach the services the application depends on. The Pascal runtime jackets are named to stay distinct from platform natives and use C++ overloading to bridge the VMS by-descriptor and by-reference calling mechanisms.

Compatibility and status

VX/PASCAL produces ANSI C++ for the GNU and Clang toolchains on Linux and Windows and preserves the OpenVMS behaviours applications depend on. The matrix summarises what is supported, and the subsections cover the diagnostics and continuous-migration model the tool provides along the way.

CapabilitySupport
VAX and OpenVMS Pascal to ANSI C++ translationlive
Target toolchain: GNU C++ (g++) and Clanglive
VARYING, fixed, and packed string typeslive
VMS string descriptors and by-descriptor argumentslive
VMS stack argument tracking (PRESENT / not present)live
External and SYS$ service calls via runtime jacketslive
RMS file I/O (indexed, relative, sequential, block) via VX/RMSlive
Condition handlers (ESTABLISH / REVERT)live
Embedded SQL and CDD record integrationlive
Compile-after-translate and error-classification workflowlive

Diagnostics and exit codes

The translator reports every problem it finds with a numbered error code and a severity, so warnings and notes can be suppressed for a clean build while genuine errors are surfaced. It returns a specific exit code for each outcome rather than a single pass or fail, so an automated pipeline can tell a clean translation from a file-not-found, a too-many-errors stop, a watchdog timeout, or an out-of-memory condition:

OutcomeMeaning
SuccessTranslation completed with no errors.
Translation errorsFinished, but with diagnostic errors that need attention.
Too many errorsStopped after exceeding the configured error ceiling.
File not foundAn input or inherited system file could not be located.
Bad option or setup fileAn unrecognised command-line option or a setup-file parse error.

An error-classification workflow can accumulate and report diagnostic categories across many runs, so a large estate can be triaged and tracked release by release rather than fixed one file at a time.

Continuous migration without a code freeze

Because conversion is fully automated, a team keeps developing in OpenVMS Pascal while each release is migrated to Linux and Windows on demand. Source stays synchronised between the Pascal and C++ versions and builds carry across through converted MMS and command files, so there is no code freeze during a long project and the estate keeps shipping.

How this differs from a generic Pascal compiler

A generic Pascal compiler does not understand VMS extensions, CDD records, RMS file handling, or VMS stack operations, so it rejects or misinterprets the constructs a real OpenVMS estate is built on. VX/PASCAL is a compile-time translator that recognises those constructs and emits readable, maintainable ANSI C++ that the GNU or Clang toolchain builds and developers can read, debug, and maintain with mainstream tools. Every change is applied against a typed model, and any construct the translator cannot represent is named with a diagnostic rather than dropped, so the migration is auditable rather than a black box.

Quick reference

Pipeline

lex → parse → resolve types → transpile → emit, then build the emitted ANSI C++ with the GNU or Clang toolchain and link the Pascal runtime.

# 1. Translate: OpenVMS Pascal in, ANSI C++ out
account.pas   ->   account.cxx

# 2. Translate and compile in one step
vxpascal --g account.pas         # emits account.cxx, then builds it

# 3. Write the C++ to a named file
vxpascal --output=account.cxx account.pas

Signature transforms to remember

OpenVMS PascalANSI C++
VARYING [n] OF CHAR_VaryingString<n>
PACKED ARRAY [lo..hi] OF CHAR_FixedString<lo, hi>
[CLASS_S] descriptor argumentDXX * runtime descriptor
RECORD ... CASE ... OFstruct + anonymous union
[EXTERNAL(SYS$...)] serviceextern "C" jacket prototype
:= %IMMED 0 defaultC++ default argument
PROGRAM ... BEGIN ... END.int main(...) + vxrt_exit
SUBSTR / INDEX / PADRuntime string entry points

What migrates

VMS Pascal extensions
VARYING / fixed strings
VMS descriptors
Stack argument tracking
RMS / ISAM I/O
SYS$ services
CDD records
Condition handlers
STR$ string routines
MMS / command-file builds

Frequently Asked Questions

Curious about how Sector7 can facilitate your application migration? Explore our FAQs for expert insights.

Our OpenVMS application makes use of multiple System Services. How do you support that?

Sector7 has an extensive library of these services running on Linux to perform the same functions as on OpenVMS.  our language conversion tools will adapt the arguments in the procedure API to work with this library.  For instance, VX/COBOL or VX/FORTRAN etc will transform the argument passed BY DESCRIPTOR to a method that will work on Linux.

When the code is compiled on Linux, the compiled objects are linked with the Sector7 library of system services and the program executes on Linux just as it does on OpenVMS, making full use of the various system services.

The critical point here is that there is no need to touch the original source code, the Sector7 tools do all the work.

What is VX/PASCAL and how does it help with OpenVMS Pascal migration?

VX/PASCAL is an automated transpiler that converts OpenVMS Pascal to ANSI-compliant C++ for execution on Linux. It carries VMS-specific extensions, CDD data structures, and RMS file handling across to Linux, so the translated program behaves the same as it did on OpenVMS. To explore VX/PASCAL for your migration, contact us.

How does the VX/PASCAL migration process work technically?

VX/PASCAL automates migration in four steps: source code analysis, transpile to C++, compile with GNU C++, and validate with automated testing to ensure identical behavior.

What customization options are available in VX/PASCAL?

VX/PASCAL is driven by a setup table read from a customer setup file, so output can be tuned to house conventions without editing source. Variable naming, code formatting (braces, indentation and line breaks), VMS logical-name translation, POSIX error-code mapping and inherited system-file handling are all controllable, and runtime checks (case, array bounds, nil pointers, allocation and file state) can be enabled together for a validation build.

What are the key benefits and proven results of using VX/PASCAL?

VX/PASCAL translates OpenVMS and VAX Pascal to ANSI C++ automatically, with zero code freeze: teams keep developing in Pascal while each release is migrated. Any construct the translator cannot fully represent is named with a numbered diagnostic rather than dropped. Contact us to discuss your requirements.

What makes VX/PASCAL different from other migration tools?

VX/PASCAL converts OpenVMS PASCAL to readable, maintainable C++ code, allowing programs to compile, link, and run on Linux with no manual code changes. Our PASCAL Process Control bundle preserves the behaviour of the original application.

What does VX/PASCAL convert, and what does it produce?

It is an automated source-to-source translator that converts OpenVMS and VAX Pascal into ANSI-compliant C++, which then compiles, links, and runs on x86 Linux and Windows. It targets readable, maintainable C++ rather than opaque machine-generated output.

Does VX/PASCAL support VMS-specific Pascal extensions, or only standard Pascal?

It supports VMS-specific extensions, including VMS stack operations, string descriptors, CDD data structures, and RMS file handling: the constructs a generic Pascal compiler would not understand, so it preserves compatibility with the original application.

How does VX/PASCAL handle VMS stack argument tracking (PRESENT and not present)?

Linux and Windows do not natively carry the VMS notion of an optional argument being present or absent. VX/PASCAL preserves the PRESENT and not-present semantics in the emitted C++ and its runtime, so optional-argument handling behaves as it did on OpenVMS.

Do I have to freeze development while migrating with VX/PASCAL?

No. VX/PASCAL is built for continuous migration: you can keep developing in OpenVMS Pascal while each release is migrated, with source kept synchronized between the Pascal and C++ versions and builds carried across through converted MMS and command files.

How are OpenVMS Pascal string operations translated to C++?

VARYING and packed string types become runtime string class templates that keep VMS length and padding semantics, and VMS string routines such as STR$CONCAT and STR$COPY are handled through the STR$ runtime and C++ operator overloading.

What RMS file operations are supported after migration?

Through the VX/RMS runtime, the generated code supports indexed, relative, sequential, and block files, plus keyed access, RFA access, and record locking, so file behavior carries over without a data conversion step.

How does VX/PASCAL keep the CDD data structures from my Pascal application?

It integrates with VX/CDD to retain Common Data Dictionary record definitions during conversion, so CDD-defined data types and references carry through into the translated C++.

How does VX/PASCAL verify the translated program behaves the same as the original?

The migration process ends with an execute-and-validate step that runs automated test cases to confirm identical behavior between the original VMS Pascal and the translated C++, and any construct the translator cannot represent is named with a numbered diagnostic rather than dropped.

Transform Your Legacy Software Today!

Get In Touch
Unlock the potential of your legacy software with our expert migration services.