Compaq BASIC Translator
User Manual


Previous Contents Index


MAT LINPUT

The VAX BASIC or DEC BASIC MAT LINPUT statement receives string data from a terminal or terminal-format file and assigns it to string array elements.

Translated Equivalent

DECBAS_MATLINPUT channel,item, ...


Remarks

The Translator provides a terminal emulation window on your Windows display. This serves as the standard terminal for typical terminal input and output operations, including MAT LINPUT. From this terminal emulation window, MAT LINPUT (as well as MAT LINPUT # from a terminal-format file) works in much the same manner as under VAX BASIC or DEC BASIC. For more information on I/O issues, see Chapter 5. One major behavioral difference between VAX BASIC or DEC BASIC and the Translator is that the Translator cannot create the matrix within the MAT LINPUT function if the matrix (array) does not already exist. If your current VAX BASIC or DEC BASIC code makes use of this feature, you must modify this code before translation to explicitly create the array that is used in the MAT LINPUT statement. The DECBAS_MATLINPUT support routine uses the Variant type as a way to pass arrays into the function. Although the Translator performs a clean translation, note that Visual Basic does not support arrays of fixed-length strings or user-defined types as Variants and will generate a run-time error if used. See the DIM reference item for any functional differences regarding redimensioning arrays (an optional feature of MAT INPUT). The standard Visual Basic ReDim statement is used if redimensioning is requested in MAT LINPUT. As with most of the other Translator statements and functions, use caution when dealing with explicit VAX BASIC or DEC BASIC error codes, which can differ from those in Visual Basic. The Translator attempts to map between VAX BASIC or DEC BASIC and Visual Basic error codes, but some codes do not convey equivalent meanings. It is important that you check and test each usage of error codes.

Example

VAX BASIC or DEC BASIC Input


MAT LINPUT A1(1,2), A3(4), A5, A6(7,8) 
Translator Output


DECBAS_MATLINPUT 0, A1,1,2, A3,4,, A5,, , A6,7,8 


MAT PRINT

The VAX BASIC or DEC BASIC MAT PRINT statement prints the contents of a one- or two-dimensional array on your terminal or assigns the value of each array element to a record in a terminal-format file.

Translated Equivalent

DECBAS_MATPRINT channel, item, ...


Remarks

The Translator provides a terminal emulation window on the Windows display. This serves as the standard terminal for typical terminal input and output operations, including MAT PRINT. From this terminal emulation window, MAT PRINT (as well as MAT PRINT # from a terminal-format file) works in much the same manner as under VAX BASIC or DEC BASIC. For more information on I/O issues, see Chapter 5. One major behavioral difference between VAX BASIC or DEC BASIC and the Translator is that the Translator cannot create the matrix for you within the MAT PRINT function if the matrix (array) does not already exist. If your current VAX BASIC or DEC BASIC code makes use of this feature, you must modify this code before translation to explicitly create the array that is used in the MAT PRINT statement. The DECBAS_MATPRINT support routine uses the Variant type as a way to pass arrays into the functions. Although the Translator performs a clean translation, note that Visual Basic does not support arrays of fixed-length strings or user-defined types as Variants and will generate a run-time error if used. As with most of the other Translator statements and functions, use caution when dealing with explicit VAX BASIC or DEC BASIC error codes, which can differ from those in Visual Basic. The Translator attempts to map between VAX BASIC or DEC BASIC and Visual Basic error codes, but some codes do not convey equivalent meanings. It is important that you check and test each usage of error codes.

Example

VAX BASIC or DEC BASIC Input


MAT PRINT #4, B(1), C(2,3) ; D 
Translator Output


DECBAS_MATPRINT 4, B,1,,DECBAS_COMMA,C,2,3,DECBAS_SEMI ,D 


MAT READ

The VAX BASIC or DEC BASIC MAT READ statement assigns values from DATA statements to array elements.

Translated Equivalent

DECBAS_MATREAD


Remarks

See the DATA statement for more information. The DECBAS_MATREAD support routine uses the Variant type as a way to pass arrays into the functions. Although the Translator performs a clean translation, note that Visual Basic does not support arrays of fixed-length strings or user-defined types as Variants and will generate a run-time error if used.

Example

VAX BASIC or DEC BASIC Input


MAT READ A,B(3,3) 
Translator Output


DECBAS_MATREAD DECBAS_DATA,DECBAS_DATA_INDEX, A(),,,B(),3,3 


MAX

The VAX BASIC or DEC BASIC MAX function compares the values of two or more numeric expressions and returns the highest value.

Translated Equivalent

DECBAS_MAX(num-exp1, num-exp2 [, num-exp3 ,...])


Remarks

If you specify values with different data types, the Translator performs data type conversions necessary to maintain precision. The Translator returns a function result whose data type is compatible with the values that you supply. For more discussion of data types, see Chapter 4.

MID$

In VAX BASIC or DEC BASIC, MID$ can be used either as a statement or as a function. The MID$ statement performs substring insertion into a string. The MID$ function extracts a specified substring from a string expression.

Translated Equivalent

Mid


Remarks

The Translator actually produces code with the dollar sign ($) retained; however, functionally the code is the equivalent of the Visual Basic function Mid. Visual Basic supports both the function and statement forms. The statement form of MID is identical in VAX BASIC or DEC BASIC and Visual Basic. Multiple assignment targets are not supported. If the source is coded for multiple assignment targets, the Translator gives the following error message: NOMULTASN multiple assignment targets are not supported

MIN

The VAX BASIC or DEC BASIC MIN function compares the values of two or more numeric expressions and returns the smallest value.

Translated Equivalent

DECBAS_MIN(num-exp1, num-exp2 [, num-exp3 ,...])


Remarks

If you specify values with different data types, the Translator performs data type conversions to maintain precision. The Translator returns a function result whose data type is compatible with the values that you supply. For more information on data type conversion, see Chapter 4.

MOD

The VAX BASIC or DEC BASIC MOD function divides a numeric value by another numeric value and returns the remainder.

Translated Equivalent

Mod


Remarks

The VAX BASIC or DEC BASIC MOD function is converted to the Visual Basic Mod operator.

Example

VAX BASIC or DEC BASIC Input


A = MOD(B,C) 
Translator Output


A=(B)MOD(C) 


MOVE

The VAX BASIC or DEC BASIC MOVE statement transfers data between a record buffer and a list of variables.

Translated Equivalent

DECBAS_MOVETO channel , move_type, ...

DECBAS_MOVEFROM channel, move_type, ...


Remarks

DECBAS_MOVETO and DECBAS_MOVEFROM can correctly handle an array variable that has three or fewer dimensions. Arrays of four or more dimensions are not correctly handled.

Examples

VAX BASIC or DEC BASIC Input


MOVE TO #9, FILL$ = 10%, A = 10%, B = 30%, C = 2% 
Translator Output


DECBAS_MOVETO 9,DECBAS_MOVE_FILL,VBSTRING,,10, _ 
    DECBAS_MOVE_VARIABLE,A,,10,DECBAS_MOVE_VARIABLE,B,,30, _ 
    DECBAS_MOVE_VARIABLE,C,,2 
VAX BASIC or DEC BASIC Input


MOVE FROM #1, I, A = J 
Translator Output


DECBAS_MOVEFROM 1,DECBAS_MOVE_VARIABLE,I,,,DECBAS_MOVE_VARIABLE,A,,J 


NAME...AS

The VAX BASIC or DEC BASIC NAME...AS statement renames the specified file.

Translated Equivalent

Name filespec1 As filespec2


NEXT

The VAX BASIC or DEC BASIC NEXT statement marks the end of a FOR, UNTIL, or WHILE loop.

Translated Equivalent

Next


Remarks

If the NEXT is at the end of a VAX BASIC or DEC BASIC WHILE or FOR...WHILE statement, the NEXT is converted to a Visual Basic Wend statement.

NOECHO

The VAX BASIC or DEC BASIC NOECHO function disables echoing of input on a terminal.

Translated Equivalent

DECBAS_NOECHO


Example

VAX BASIC or DEC BASIC Input


Y = NOECHO(0%) 
Translator Output


Y=DECBAS_NOECHO(0) 


NOMARGIN

The VAX BASIC or DEC BASIC NOMARGIN statement removes the right margin limit set with the MARGIN statement for a terminal or a terminal-format file.

Translated Equivalent

DECBAS_NOMARGIN


Example

VAX BASIC or DEC BASIC Input


NOMARGIN #1 
Translator Output


DECBAS_NOMARGIN 1 


NUM

The VAX BASIC or DEC BASIC NUM function returns the row number of the last data element transferred into an array by a MAT I/O statement.

Translated Equivalent

DECBAS_MATNUM


Example

VAX BASIC or DEC BASIC Input


NUMROWS = NUM 
Translator Output


NUMROWS=DECBAS_MATNUM 


NUM2

The VAX BASIC or DEC BASIC NUM2 function returns the column number of the last data element transferred into an array by a MAT I/O statement.

Translated Equivalent

DECBAS_MATNUM2


Example

VAX BASIC or DEC BASIC Input


NUMCOLS = NUM2 
Translator Output


NUMCOLS=DECBAS_MATNUM2 


NUM$

The VAX BASIC or DEC BASIC NUM$ function evaluates a numeric expression and returns a string of characters in PRINT statement format with leading and trailing spaces.

Translated Equivalent

DECBAS_NUM$


Example

VAX BASIC or DEC BASIC Input


NUMB$ = NUM$(34.5500/31.8) 
Translator Output


NUMB_$=DECBAS_NUM$(34.5500/31.8) 


NUM1$

The VAX BASIC or DEC BASIC NUM1$ function changes a numeric expression to a numeric character string without leading and trailing spaces and without rounding.

Translated Equivalent

DECBAS_NUM1$


Example

VAX BASIC or DEC BASIC Input


numb1$ = NUM1$(PI/2) 
Translator Output


numb1_$=DECBAS_NUM1$(3.141592653589793238462643383279502/2) 


ON ERROR GO BACK

Under certain conditions, a VAX BASIC or DEC BASIC ON ERROR GO BACK statement executed in a subprogram or DEF function transfers control to the calling program.

Translated Equivalent

On Error GoTo 0


Remarks

Use caution when dealing with explicit VAX BASIC or DEC BASIC error codes because they can differ from those in Visual Basic. The Translator attempts to map between VAX BASIC or DEC BASIC and Visual Basic error codes, but the OpenVMS and Visual Basic error handling schemes differ in many subtle ways. It is important that you check and test each usage of error codes. For more information on the translation of exception handling statements, see Chapter 6.

Example

VAX BASIC or DEC BASIC Input


ON ERROR GO BACK 
Translator Output


ON ERROR GOTO 0 


ON ERROR GOTO

The VAX BASIC or DEC BASIC ON ERROR GOTO statement transfers program control to a specified line or label in the current program unit when an error occurs under certain conditions.

Translated Equivalent

On Error GoTo


Remarks

Use caution when dealing with explicit VAX BASIC or DEC BASIC error codes because they can differ from those in Visual Basic. The Translator attempts to map between VAX BASIC or DEC BASIC and Visual Basic error codes, but the OpenVMS and Visual Basic error handling schemes differ in many subtle ways. It is important that you check and test each usage of error codes. For more information, see Chapter 6.

Example

VAX BASIC or DEC BASIC Input


ON ERROR GOTO 10 
Translator Output


ON ERROR GOTO 10 


ON ERROR GOTO 0

The VAX BASIC or DEC BASIC ON ERROR GOTO 0 statement disables ON ERROR error handling and passes control to the VAX BASIC or DEC BASIC error handler when an error occurs.

Translated Equivalent

On Error GoTo 0


Remarks

Use caution when dealing with explicit VAX BASIC or DEC BASIC error codes because they can differ from those in Visual Basic. The Translator attempts to map between VAX BASIC or DEC BASIC and Visual Basic error codes, but the OpenVMS and Visual Basic error handling schemes differ in many subtle ways. It is important that you check and test each usage of error codes. For more information on the translation of exception handling statements, see Chapter 6.

Example

VAX BASIC or DEC BASIC Input


ON ERROR GOTO 0 
Translator Output


ON ERROR GOTO 0 


ON...GOSUB

The VAX BASIC or DEC BASIC ON...GOSUB statement transfers program control to one of several subroutines, depending on the value of a control expression.

Translated Equivalent

Without Optional OTHERWISE Clause


DECBAS_TEMP = exp 
IF (DECBAS_TEMP < 1) OR (DECBAS_TEMP > n) THEN Err.Raise 5 
ON DECBAS_TEMP GOSUB t1, t2, ... tn 

With Optional OTHERWISE Clause


DECBAS_TEMP = exp 
IF (DECBAS_TEMP < 1) OR (DECBAS_TEMP > n) THEN GOSUB tx 
ON DECBAS_TEMP GOSUB t1, t2, ... tn 


Remarks

VAX BASIC or DEC BASIC and Visual Basic accept both the ON...GO SUB statement and the ON...GOSUB statement, but the Translator always generates an ON...GOSUB equivalent. Visual Basic has a limit of 255 destinations; VAX BASIC or DEC BASIC has no limit. If more than 255 destinations are given, the Translator issues a warning message.

Example

VAX BASIC or DEC BASIC Input


ON 3 GOSUB l1, l2 OTHERWISE l3 
Translator Output


DECBAS_TEMP=3 
IF(DECBAS_TEMP<1)OR(DECBAS_TEMP>2)THEN 
GOSUB l3 
END IF 
ON DECBAS_TEMP GOSUB l1,l2 


ON...GOTO

The VAX BASIC or DEC BASIC ON...GOTO statement transfers program control to one of several lines or targets, depending on the value of a control expression.

Translated Equivalent

Without Optional OTHERWISE Clause


DECBAS_TEMP = exp 
IF (DECBAS_TEMP < 1) OR (DECBAS_TEMP> n) THEN Err.Raise 5 
ON DECBAS_TEMP GOTO t1, t2, ... tn 

With Optional OTHERWISE Clause


DECBAS_TEMP = exp 
IF (DECBAS_TEMP < 1) OR (DECBAS_TEMP > n) THEN GOTO tx 
ON DECBAS_TEMP GOTO t1, t2, ... tn 


Remarks

VAX BASIC or DEC BASIC and Visual Basic accept both the ON...GO TO statement and the ON...GOTO statement, but the Translator always generates an ON...GOTO equivalent. Visual Basic has a limit of 255 destinations; VAX BASIC or DEC BASIC has no limit. If more than 255 destinations are given, the Translator issues a warning message.

Example

VAX BASIC or DEC BASIC Input


ON 2 GOTO l1, l2 
Translator Output


DECBAS_TEMP=2 
IF(DECBAS_TEMP<1)OR(DECBAS_TEMP>2)THEN 
ERR.RAISE 5 
END IF 
ON DECBAS_TEMP GOTO l1,l2 


Previous Next Contents Index