VX/BASIC OpenVMS BASIC Migration/Translator for Linux and UNIX - OpenVMS Migration


VX/BASIC is a full-featured OpenVMS BASIC to ANSI C Compiler/Transpiler®. VX/BASIC allows 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 OpenVMS BASIC syntax to working C.

Learn More

INTRODUCTION

VX/BASIC allows developers to maintain their code in OpenVMS BASIC and transpile the code for Linux/UNIX. 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 OpenVMS BASIC and transpile for the target hardware platform. For OpenVMS BASIC developers, compiling the OpenVMS BASIC is only half the story. Most 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/UNIX.

MAPS and RECORDS

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 UNIX 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.

STATEMENTS

All OpenVMS BASIC commands have been implemented except graphics. Generally the 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 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 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 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().

DATATYPES

VX/BASIC supports all 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/UNIX 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 OpenVMS BASIC. All OpenVMS BASIC string operations are fully implemented.

ERROR HANDLING

VX/BASIC supports the full range of 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 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.

INTEGRATED RMS

VX/BASIC translates BASIC statements in C functions. All BASIC statements that are involved in RMS I/O (OPEN, GET FIND, PUT etc) take as arguments the original OpenVMS file specification including LOGICALS. Vx/Tools includes Vx/RMS an OpenVMS API and functionality compatible file system. Vx/RMS

STATEMENTS
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
STATEMENTS
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
PRINT
STATEMENTS
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

FUNCTIONS
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$
FUNCTIONS
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
FUNCTIONS
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