Compaq BASIC Translator
User Manual


Previous Contents Index

3.8 Operators

Table 3-7 compares operators for VAX BASIC or DEC BASIC and Visual Basic.

Table 3-7 Use of Operators in VAX BASIC and DEC BASIC and Visual Basic
Operator VAX BASIC and DEC BASIC Visual Basic
Assignment = =
Exponentiation ^, ** 1 ^
Negation -- --
Multiplication * *
Division / / (or \ for integer division)
Residue mod mod
Addition + +
Subtraction -- --
String concatentation + &, + 2
Equality =, == 1 =
Inequality <>, >< 1 <>
Greater than > >
Less than < <
Greater than or equal to >=, => 1 >=
Less than or equal to <=, =< 1 <=
Logical negation not not
Logical and and and
Inclusive or or or
Exclusive or xor xor
Logical equivalence eqv eqv
Implication imp imp
Subobject separator :: .


1The Translator converts alternate forms to the form accepted by Visual Basic.
2Although the preferred concatenation operator in Visual Basic is the ampersand (&), the Translator does not convert the plus sign to an ampersand in this case.

The Translator does not support the following language incompatibility in the handling of the integer data type: When division is performed with the slash (/) operator in Visual Basic, integer arguments are converted to floating-point values first and then the division is performed. Therefore, a quotient represented as a floating-point number is returned, which might not be expressible as an integer. Consider the following example:


5% / 8%  <-->  0.625 

VAX BASIC or DEC BASIC would give a different answer. When both arguments are of the integer data type (as, for example, when the % suffix is used), VAX BASIC or DEC BASIC returns an integer quotient formed by dropping any fractional part as illustrated by the following example:


5% / 8%  <-->  0 

Assume a VAX BASIC or DEC BASIC expression of the form:

integer / integer

The Visual Basic equivalent would use a backslash ("\") character:

integer \ integer

The Translator does not support these cases.

3.9 Translations Performed

Table 3-8 summarizes VAX BASIC and DEC BASIC statements and routines that the Translator converts directly to corresponding Visual Basic statements and routines or to calls to DECBAS_* routines (coded in Visual Basic), or that are not supported.

Table 3-8 Translation Table
VAX BASIC and DEC BASIC Translation Description
ABS Abs Return absolute value of specified floating-point expression; floating-point number returned
ABS% DECBAS_ABSP% Return absolute value of specified floating-point expression; integer returned
ASCII Asc Return ASCII character of integer
ATN Atn Return arctangent (angular value) of a specified tangent
BUFSIZ DECBAS_BUFSIZ Return record buffer size of channel
CALL Call Transfer control
CAUSE ERROR DECBAS_CAUSEERROR Generate run-time error
CCPOS DECBAS_CCPOS Return current character or cursor position in output record
CHAIN Not supported Transfer control to another executable image
CHANGE DECBAS_CHANGE Convert character string or number to ASCII
CHR$ Chr Convert ASCII value to 1-character string
CLOSE DECBAS_CLOSE End I/O processing
COMMON Visual Basic Class Define a named, shared storage area
COMP% DECBAS_COMP% Compare numeric strings
CONTINUE Resume Clear error condition
COS Cos Return cosine of an angle
CTRLC DECBAS_CTRLC Enable Ctrl/C trapping
CVT$$ 1 (see also EDIT$) DECBAS_CVTSS Perform string editing functions
CVT$% 1 DECBAS_CVTSP Map first two characters into 16-bit integer
CVT%$ 1 DECBAS_CVTPS Translate 16-bit integer into 2-character string
CVT$F 1 DECBAS_CVTSF Map a 4- or 8-character string into floating-point variable
CVTF$ 1 DECBAS_CVTFS Translate floating-point number into a 4- or 8-byte character string
DATA No exact equivalent. The Translator creates a subroutine to initialize the data array. Create a data block for READ statement
DATE$ DECBAS_DATE$ Return dd-mmm-yy from 1970 relative yyyddd
DATE4$ DECBAS_DATE4$ Return dd-mmm-yyyy from 1970 relative yyyddd
DECIMAL CDEC (Visual Basic Version 5.0 only. Not supported in Visual Basic Version 4.0. See Chapter 7) Convert argument to DECIMAL subtype. Precision and scale ignored
DECLARE Dim Assign a name and data type to variable
DEF/DEF* Function Define single line or multiline function
DELETE DECBAS_DELETE Remove record from relative file or indexed file
DET DECBAS_DET Return the value of the determinant of the last matrix inverted
DIF$ DECBAS_DIF$ Return numeric string whose value is difference between two numeric strings
DIMENSION Dim Create and name a static, dynamic, or virtual array
ECHO DECBAS_ECHO Echo characters on terminal channel
EDIT$ (see also CVT$$ 1) DECBAS_EDIT$ Perform string editing functions
END End Mark the physical and logical end of a main program, a program module, or a block of statements
ERL Not supported Return number of BASIC line where last error occurred
ERN$ DECBAS_ERN$ Return routine name executing when last error occurred
ERR DECBAS_ERR Return error number of current run-time error
ERT$ DECBAS_ERT$ Return error message text
EXIT Exit Exit from main program, SUB or FUNCTION subprogram, multiline DEF, statement block, or handler
EXP Exp Perform exponentiation
EXTERNAL CONSTANT Not supported Declare constant external to program
EXTERNAL data-type Not supported Declare variable external to program
EXTERNALFUNCTION DECLARE FUNCTION
<DLL Name>
Declare function external to program
EXTERNALSUB DECLARE SUB <DLL Name> Declare subroutine external to program
FIELD Not supported Dynamically associate string variables with all or parts of record buffer
FIND DECBAS_FIND Locate specified record
FIX Fix Return integer portion of floating-point number
FOR For Repeatedly execute a block of statements
FORMAT$ DECBAS_FORMAT$ Convert an expression to a formatted string
FREE DECBAS_FREE Unlock all records and buckets
FSP$ 1 Not supported Return string describing an open file
FUNCTION Function Mark beginning of FUNCTION subprogram and define subprogram's parameters
GET DECBAS_GET Move record from file to record buffer
GETRFA DECBAS_GETRFA Return RFA for last accessed record on channel
GOSUB GoSub Transfer control to a specified line number or label
GOTO GoTo Transfer control to a specified line number or label
HANDLER GoTo DECBAS_ xxxx
handler_name:
Mark the beginning of detached handler
IF If Evaluate conditional expression
INKEY$ DECBAS_INKEY Read single keystroke and return typed character
INPUT DECBAS_INPUT Assign values from terminal to program variables
INPUT LINE DECBAS_INPUTLINE Assign string value from terminal to program variables
INSTR DECBAS_INSTR Search for substring within string and return position of substring's starting character
INT Int Return floating-point value of largest whole number less than or equal to specified expression
INTEGER DECBAS_INTEGER Convert number or numeric string to integer type
ITERATE GoTo DECBAS_ xxxxx Explicitly reexecute a loop
KILL Kill Delete a file
LBOUND LBound Return lower bound of array dimension
LEFT$, LEFT Left Extract lefthand substring
LEN Len Return integer value indicating length of string
LET Let Assign a value to one or more variables
LINPUT DECBAS_LINPUT Assign a string value, without line terminators, to string variable
LOC DECBAS_LOC for variables only Return address of object (only correct for variables; if object is a function, Visual Basic will issue an error)
LOG Log Return natural logarithm
LOG10 DECBAS_LOG10 Return common logarithm
LSET LSet Assign left-justified data to a string variable
MAG Abs Return absolute value of specified expression
MAGTAPE Not supported Magnetic tape control
MAP Visual Basic Class Define PSECT, declare data fields in record, and associate them with program variables
MAP DYNAMIC Not supported Name variables and arrays whose size and position in a storage area can change at run time
MAR DECBAS_MAR Return current margin width of channel
MARGIN DECBAS_MARGIN Specify the margin width
MAT CON DECBAS_MATCON Create a constant matrix
MAT IDN DECBAS_MATIDN Create an identity matrix
MAT ZER DECBAS_MATZER Create a zero matrix
MAT NUL$ DECBAS_MATNUL Create a matrix of empty strings
MAT + DECBAS_MATADD Add two matrices
MAT - DECBAS_MATSUB Subtract two matrices
MAT * DECBAS_MATMUL Multiply two or more matrices
MAT ()* DECBAS_MATSMUL Multiply a matrix by a scalar
MAT INV DECBAS_MATINV Find inverse of a matrix
MAT TRN DECBAS_MATTRN Transpose a matrix
MAT = DECBAS_MATASSIGN Copy contents of one array to another
MAT INPUT DECBAS_MATINPUT Assign values from terminal to array elements
MAT LINPUT DECBAS_MATLINPUT Assign string values from terminal to string array elements
MAT PRINT DECBAS_MATPRINT Print contents of array to terminal
MAT READ DECBAS_MATREAD Assign values from DATA statements to array elements
MAX DECBAS_MAX Return the highest value in a comparison of two or more
MID$ statement Mid Insert substring
MID$ function Mid Extract substring
MIN DECBAS_MIN Return the smallest value in a comparison of two or more
MOD Mod Return the remainder
MOVE DECBAS_MOVETO[FROM] Transfer data
NAME...AS Name As Rename specified file
NEXT Next Mark the end of FOR loop
NEXT Wend Mark the end of UNTIL or WHILE loop
NOECHO DECBAS_NOECHO Disable input terminal echoing
NOMARGIN DECBAS_NOMARGIN Remove right margin limit
NUM DECBAS_MATNUM Return row number of last I/O reference of array element
NUM2 DECBAS_MATNUM2 Return column number of last I/O reference of array element
NUM$ DECBAS_NUM$ Convert number to string for printing
NUM1$ DECBAS_NUM1$ Convert number to numeric character string
ON ERROR
GO BACK
On Error GoTo 0 Transfer control to calling program
ON ERROR GOTO On Error GoTo Transfer control to specified line or label
ON ERROR GOTO 0 On Error GoTo 0 Disable ON ERROR error handling
OPEN DECBAS_OPEN Open file for processing
OPTION Only the TYPE and SIZE options are supported Set compilation qualifiers
PLACE$ DECBAS_PLACE$ Change precision of numeric string
POS DECBAS_POS Search for substring and return position
PRINT DECBAS_PRINT Transfer program data to terminal
PRINT USING DECBAS_PRINTUSING Generate output formatted according to format string
PROD$ DECBAS_PROD$ Return numeric string that is product of numeric strings
PROGRAM Sub Main Identify main program with name other than file name
PUT DECBAS_PUT Transfer data from the record buffer to a file
QUO$ DECBAS_QUO$ Return numeric string that is quotient of numeric strings
RAD$ 1 Not supported Convert integer to Radix-50
RANDOMIZE Randomize Give random number function new starting value
RCTRLC DECBAS_RCTRLC Disable Ctrl/C trapping
RCTRLO DECBAS_RCTRLO Cancel Ctrl/O effect
READ DECBAS_READ Assign values from DATA statement to variables
REAL DECBAS_REAL Convert number or string to floating-point data type
RECORD Type...End Type Name and define simple record
RECORD Visual Basic Class Name and define complex record
RECOUNT DECBAS_RECOUNT Return number of characters in last I/O operation
REM Rem Document program in a comment
REMAP Not supported Define or redefine position in storage area
RESET DECBAS_DATA_INDEX=0 Reset DATA pointer to beginning of DATA sequence
RESTORE DECBAS_DATA_INDEX=0 Reset DATA pointer to beginning of DATA sequence
RESTORE DECBAS_RESTORE_KEY Reset record pointer to first record in file
RESUME Resume Next, Resume label Mark exit point from ON ERROR
RETRY Resume Clear error condition
RETURN Return Transfer control to statement following most recently executed GOSUB or ON...GOSUB
RIGHT$ DECBAS_RIGHT$ Extract righthand substring
RMSSTATUS Not supported Return RMS status of last I/O operation
RND Rnd Return random number greater than or equal to zero and less than 1
RSET Rset Assign right-justified data to a string variable
SCRATCH DECBAS_SCRATCH Delete current record and all following records in a sequential file
SEG$ DECBAS_SEG$ Extract substring
SELECT Select Case Evaluate one of a list of statement blocks
SET [NO] PROMPT DECBAS_SET[NO]PROMPT Enable [disable] question mark prompt
SGN Sgn Determine whether numeric expression is positive, negative, or zero
SIN Sin Return the sine of an angle
SLEEP DECBAS_SLEEP Suspend program execution
SPACE$ Space Create string of spaces
SQR, SQRT Sqr Return square root
STATUS Not supported Return integer status value of last I/O operation
STOP Stop Halt program execution
STR$ CStr Change number to numeric character string
STRING$ String$ Create string containing specified number of identical characters
SUB Sub Mark beginning of BASIC subprogram
SUM$ DECBAS_SUM$ Return string whose value is sum of numeric strings
SWAP% 1 DECBAS_SWAP% Transpose bytes of 16-bit integer
TAB DECBAS_TAB Inside PRINT statement, move cursor to column n in output
TAB Space Outside PRINT statement, create a string of spaces
TAN Tan Return tangent of an angle
TIME DECBAS_TIME Return time of day, CPU time, process time
TIME$ DECBAS_TIMES Return time of day as hh:mm am/pm
TRM$ RTrim Remove trailing blanks and tabs
UBOUND Ubound Return upper bound of array dimension
UNLESS If Not Modify a statement
UNLOCK DECBAS_UNLOCK Unlock current record or bucket
UNTIL While Not Mark beginning of UNTIL loop
UPDATE DECBAS_UPDATE Replace record in file
VAL Val Convert numeric string to floating-point value
VAL% DECBAS_VALP Convert numeric string to integer value
VMSSTATUS Not supported Return underlying OpenVMS condition code on error
WAIT DECBAS_WAIT Specify seconds program waits for input
WHEN ERROR On Error GoTo Mark beginning of WHEN ERROR construct
WHILE While Mark beginning of WHILE loop
XLATE$ DECBAS_XLATE$ Translate one string to another using table string you specify


1Obsolete function

<recto_head>(cancel_h) <verso_head>(cancel_h)


Previous Next Contents Index