VX/BASIC is a full-featured VMS / OpenVMS BASIC to ANSI C Compiler/Transpiler®. VX/BASIC allows VMS / OpenVMS BASIC source code to be compiled on multiple host machines. The application can be maintained in the original BASIC language or converted into C code. VX/BASIC will convert 100% of supported VMS / OpenVMS BASIC syntax to working C.
HP BASIC for OpenVMS is the latest name for a dialect of the BASIC programming language created by Digital Equipment Corporation (DEC) and now owned by Hewlett-Packard Enterprise (HPE). It was originally developed in the 1970s for the RSTS-11 operating system on the PDP-11 minicomputer. It was later ported to OpenVMS, first on VAX, then Alpha, and most recently Integrity.
Past names for the product include: BASIC-PLUS, Basic Plus 2 (BP2 or BASIC-Plus-2), VAX BASIC, DEC BASIC, and Compaq BASIC for OpenVMS. Multiple variations of the titles noting the hardware platform (VAX, AlphaServer, etc.) also exist.
HP BASIC has many FORTRAN-like extensions, as well as supporting the original Dartmouth BASIC matrix operators.
line numbers are optional, unless the "ERL" function is present. It allows you to write "WHEN ERROR" error handlers around protected statements. The more traditional but less elegant "ON ERROR" statement lacks such context or scope.
One of HP BASIC's more innovative features is built-in support for OpenVMS's powerful Record Management Services (RMS). Before VAX BASIC (as it was then called), you would only get native RMS support in DEC's COBOL compiler.
VX/BASIC allows developers to maintain their code in VMS / OpenVMS BASIC and Transpire the code for Linux/Windows. Using C as the intermediate language, VX/BASIC takes advantage of all the elements of C compilers and object code optimizers. By generating ANSI C, users of VX/BASIC are assured that no matter how chip technology changes, the Transpiled code can be compiled.
VX/BASIC retains the original structure, variable names and comments, thus, developers can choose any time to move to C and maintain the source code in C, or retain all the investment in VMS / OpenVMS BASIC and Transpire for the target hardware platform. For VMS / OpenVMS BASIC developers, compiling the VMS / OpenVMS BASIC is only half the story. Most VMS / OpenVMS BASIC programs use VMS system service calls (implicitly for RMS or explicitly). Sector7 has developed more than 900 VMS system service calls (VX/RT API's) for Linux/Windows.
Maps and records are converted into C structures. VX/BASIC supports two conversion types. For processors that allow numeric data types to align on any boundary, the BASIC data types are converted in standard C data types, and regular C structure accessing code is generated. Most Linux processors and C compilers will force numeric data types to be aligned on even byte boundaries. They do this by automatically inserting "slack" bytes to pad the structures. This can cause serious problems for BASIC users who would expect overlaid MAPS to align. For these processors VX/BASIC has an option to treat all numeric data types as arrays of bytes (long words are typedef'd to char[4], doubles to char[8]).
VX/BASIC then generates code that will access this data without causing processor bus errors. This access method does add some overhead to the execution time and users are strongly urged to re-organize Maps and RECORDs for even byte alignment. For details on your target machine please contact Sector7.
Maps of the same name are overlaid identically to VMS. VX/BASIC supports GLOBAL (SHARE) Maps. Unlike VMS, all Maps are linked by default NOSHARE.
All VMS / OpenVMS BASIC commands have been implemented except graphics. Generally the VMS / OpenVMS BASIC commands translate to the same name, lowercased except the first character with "'Vxb_" prepended. Some commands (such as PRINT, READ, INPUT) take format strings that define the data types to be acted upon and the line formatting to be applied.
All VX/BASIC functions perform identically to their VMS / OpenVMS BASIC equivalents. In the case above all three string functions would check the length of the input string and apply the same rules as VMS / OpenVMS BASIC.
Some VX/BASIC functions will also generate ERROR traps in certain conditions (VAL("HH") will generate ERROR 52). Others like BUFSIZ() on an unopened channel simply return 0 (As VMS / OpenVMS BASIC).
A few VX/BASIC functions are generated with different designators, depending on the input data type. For optimization, VX/BASIC recognizes that VAL has been passed an INTEGER quantity and generates Vxb_Vali() rather than Vxb_Val().
VX/BASIC supports all VMS / OpenVMS BASIC data types except GFLOAT and HFLOAT. If these are declared in a program VX/BASIC will convert them to DOUBLE. Note that DOUBLE on Linux/Windows has a similar range and precision to GFLOAT on the VMS.
DECIMAL data types are supported, but have a maximum range of (15,8). Both DYNAMIC and STATIC strings are implemented. VX/BASIC uses the same descriptor structure as VMS / OpenVMS BASIC. All VMS / OpenVMS BASIC string operations are fully implemented.
VX/BASIC supports the full range of VMS / OpenVMS BASIC error numbers and error handling.
Whenever an error is generated, the current error handler is evoked and the error processing executed. VX/BASIC returns the same error codes as VMS / OpenVMS BASIC (52 = ILLEGAL VALUE, 15 = WAIT EXHAUSTED etc).
If your program calls the VMS service routines directly, and checks the return value, it will still perform in the identical manner using the VX/RT libraries. Each VX/RT system service call returns the same codes as VMS (SYS$OPEN returns 98962, RMS$_FNF, if the file does not exist).
The BASIC error functions ERR, ERL, ERT$, ERN$ are set in the identical manner. If another error occurs in an error processing routine before the error has been cleared a BASIC stack dump is issued.
CALL |
CASE |
CAUSE |
CHAIN |
CHANGE |
CLOSE |
COM |
COMMON |
CONTINUE |
DATA |
DECLARE |
DEF |
DEF* |
DELETE |
DIM |
DIMENSION |
DRAW |
ELSE |
END |
ENDIF |
EXIT |
EXTEND |
EXTERNAL |
FIELD |
FIND |
FNEND |
FNEXIT |
FOR |
FREE |
FUNCTION |
FUNCTIONEND |
FUNCTIONEXIT |
GET |
GO |
GOSUB |
GOTO |
HANDLER |
IF |
IFEND |
INPUT |
ITERATE |
KILL |
LET |
LINPUT |
LSET |
MAP |
MARGIN |
MAT |
MOVE |
NAME |
NEXT |
NO |
NOEXTEND |
NOMARGIN |
ON |
ONERROR |
OPEN |
OPTION |
PICTURE |
PROGRAM |
PUT |
RANDOM |
RANDOMIZE |
READ |
RECORD |
REM |
REMAP |
RESET |
RESTORE |
RESUME |
RETRY |
RETURN |
RSET |
RUN |
SCRATCH |
SELECT |
SET |
SLEEP |
STOP |
SUB |
SUBEND |
SUBEXIT |
UNLOCK |
UNTIL |
UPDATE |
USE |
WAIT |
WHEN |
WHILE |
ABS |
ABS% |
AND |
ASC |
ASCII |
ATN |
BUFSIZ |
CCPOS |
CHR$ |
COMP% |
COS |
COT |
CTRLC |
CVT$$ |
CVT$% |
CVT%$ |
DATE$ |
DATE4$ |
DET |
DIF$ |
ECHO |
EDIT$ |
EQV |
ERN$ |
ERR |
ERT |
ERT$ |
EXP |
FIX |
FSP$ |
FSS$ |
IMP |
INSTR |
INT |
LEFT |
LEFT$ |
LEN |
LEN |
LINE |
LOG |
LOG10 |
MAGTAPE |
MAGTAPE |
MAR |
MAR% |
MOD |
NOECHO |
NOT |
NUM |
NUM2 |
ONECHR |
OR |
PEEK |
PLACE$ |
POS |
PROD$ |
QUO$ |
RAD$ |
RCTRLC |
RCTRLO |
RECOUNT |
RIGHT |
RIGHT$ |
RND |
SEG$ |
SGN |
SIN |
SPACE$ |
SPEC |
SPEC% |
SQR |
SQRT |
STATUS |
STRING$ |
SUM$ |
SWAP |
SWAP% |
TAB |
TAN |
TIME |
TIME$ |
TRM$ |
VAL |
VAL% |
VMSSTATUS |
XLATE |
XLATE$ |
XOR |