[an error occurred while processing this directive]

HP OpenVMS Systems

BASIC Translator
Content starts here

Compaq BASIC Translator
User Manual


Previous Contents Index


RECORD

The VAX BASIC or DEC BASIC RECORD statement lets you name and define data structures in a program. It also provides the VAX BASIC or DEC BASIC interface to the Oracle CDD/Repository. You can use the defined RECORD name anywhere a VAX BASIC or DEC BASIC data type keyword is valid if all data types are valid in that context.

Translated Equivalent

Visual Basic Class


Remarks

The Translator does not support extracting record definitions from the CDD/Repository. The definitions must be extracted manually. For more information, see Section 4.2.7.

RECOUNT

The VAX BASIC or DEC BASIC RECOUNT function returns the number of characters transferred by the last input operation.

Translated Equivalent

DECBAS_RECOUNT


Example

VAX BASIC or DEC BASIC Input


character_count = RECOUNT
Translator Output


character_count=DECBAS_RECOUNT()

REM

The VAX BASIC or DEC BASIC REM statement allows you to document your program.

Translated Equivalent

Rem


Remarks

For more information and an example, see Section 3.3.

REMAP

The VAX BASIC or DEC BASIC REMAP statement defines or redefines the position in the storage area of variables named in the MAP DYNAMIC statement.

Translated Equivalent

None


Remarks

The Translator does not support conversion of the VAX BASIC or DEC BASIC REMAP statement.

RESET

The VAX BASIC or DEC BASIC RESET statement is a synonym for the RESTORE statement. See the RESTORE statement for more information.

Translated Equivalent

RESET File
DECBAS_RESTORE_KEY [[CHANNEL := channel [,KEY := int-exp]]

RESET Data
DECBAS_DATA_INDEX=0


Remarks

The VAX BASIC or DEC BASIC RESET and RESTORE statements are synonyms.

Example

VAX BASIC or DEC BASIC Input (RESET Key)


RESET #7, KEY #4
Translator Output


DECBAS_RESTORE_KEY CHANNEL:= 7,KEY_NUMBER:= 4

RESTORE

The VAX BASIC or DEC BASIC RESTORE statement resets the DATA pointer to the beginning of the DATA sequence or sets the record pointer to the first record in a file.

Translated Equivalent

RESTORE File
DECBAS_RESTORE_KEY [[CHANNEL := channel [,KEY := int-exp]]

RESTORE Data
DECBAS_DATA_INDEX=0


Example

VAX BASIC or DEC BASIC Input (RESTORE Data)


RESTORE
Translator Output


DECBAS_DATA_INDEX = 0

RESUME

The VAX BASIC or DEC BASIC RESUME statement marks an exit point from an ON ERROR error-handling routine. VAX BASIC or DEC BASIC clears the error condition and returns program control to a specified line number, label, or to the program block in which the error occurred.

Translated Equivalent

Resume Next

Resume label


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, in particular for the translation of RESUME to Resume Next. For more information, see Chapter 6.

Example

VAX BASIC or DEC BASIC Input


RESUME
Translator Output


RESUME NEXT

RETRY

The VAX BASIC or DEC BASIC RETRY statement clears an error condition and reexecutes the statement that caused the error inside a protected region of a WHEN block.

Translated Equivalent

Resume


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


RETRY
Translator Output


RESUME

RETURN

The VAX BASIC or DEC BASIC RETURN statement transfers control to the statement immediately following the most recently executed GOSUB or ON...GOSUB statement in the current program unit.

Translated Equivalent

Return


RIGHT$

The VAX BASIC or DEC BASIC RIGHT$ function extracts a substring from a string's right side, leaving the string unchanged.

Translated Equivalent

DECBAS_RIGHT$


Remarks

There is no equivalent in Visual Basic for the VAX BASIC or DEC BASIC RIGHT$ function. The Visual Basic Right function would extract a different substring. (VAX BASIC or DEC BASIC treats the numeric argument as an offset from the beginning of the source string and returns a string from that point to the end. The Visual Basic Right function treats the numeric argument as the number of characters to return from the end of the string.)

Example

VAX BASIC or DEC BASIC Input


s = RIGHT$("1234567", 3)
Translator Output


s=DECBAS_RIGHT$("1234567",3)
Result


"34567"
The translated equivalent, DECBAS_RIGHT$, returns the same result as VAX BASIC or DEC BASIC RIGHT$. (The Visual Basic Right function, by contrast, would return the string "567" for this example.)

RMSSTATUS

The VAX BASIC or DEC BASIC RMSSTATUS function returns the RMS status or the status value of the last I/O operation on a specified open I/O channel.

Translated Equivalent

None


Remarks

The Translator does not support conversion of the VAX BASIC or DEC BASIC RMSSTATUS function.

RND

The VAX BASIC or DEC BASIC RND function returns a random number greater than or equal to zero and less than 1.

Translated Equivalent

Rnd


Remarks

VAX BASIC or DEC BASIC and Visual Basic do not use identical internal algorithms to generate the random value. The translated program produces random values but might not produce the same sequence of random values as the VAX BASIC or DEC BASIC source program.

Example

VAX BASIC or DEC BASIC Input


x = RND
Translator Output


x=RND

RSET

The VAX BASIC or DEC BASIC RSET statement assigns right-justified data to a string variable. RSET does not change a string variable's length.

Translated Equivalent

RSet


Remarks

The VAX BASIC or DEC BASIC LSET statement allows multitarget assignment, while the Visual Basic statement allows only one. The Translator includes partial support for multitarget assignments. See the LET statement for a description and examples. VAX BASIC or DEC BASIC and Visual Basic semantics differ. When the source string is longer than the destination string, the operation of VAX BASIC or DEC BASIC RSET and the operation of Visual Basic RSet differ. If n is the length of the destination string, then VAX BASIC or DEC BASIC uses the n rightmost characters of the source string. Visual Basic uses the n leftmost characters of the source string.

Example

VAX BASIC or DEC BASIC Input


s = "ABCDE"
RSET s = "1234567"
Translator Output


s="ABCDE"
RSET s="1234567"
VAX BASIC or DEC BASIC Result


s is 34567
Visual Basic Result


s is 12345

SCRATCH

The VAX BASIC or DEC BASIC SCRATCH statement deletes the current record and all following records in a sequential file.

Translated Equivalent

DECBAS_SCRATCH channel


Remarks

Visual Basic does not have a corresponding function. DECBAS_SCRATCH, therefore, simulates a deletion on a local sequential file by overwriting the record and all following records with NUL characters. In VAX BASIC or DEC BASIC, if you deleted Record No. 10 with the SCRATCH statement and later tried to access Record No. 10, a Record Not Found error would be issued. By contrast, in Visual Basic, Record No. 10 would still exist, but would contain only NUL characters.

Example

VAX BASIC or DEC BASIC Input


SCRATCH #4%
Translator Output


DECBAS_SCRATCH 4

SEG$

The VAX BASIC or DEC BASIC SEG$ function extracts a substring from a main string, leaving the original string unchanged.

Translated Equivalent

DECBAS_SEG$ (inputstring,startpos,endpos)


Example

VAX BASIC or DEC BASIC Input


string1$ = SEG$ (OrigString$,4,7)
Translator Output


string1$=DECBAS_SEG$(OrigString$,4,7)

SELECT

The VAX BASIC or DEC BASIC SELECT statement lets you specify an expression, a number of possible values that the expression can have, and a number of alternative statement blocks to be executed for each possible case.

Translated Equivalent

Select Case expression


Example

VAX BASIC or DEC BASIC Input


    SELECT A% + B% + C%
            CASE = 100
            PRINT 'THE VALUE IS EXACTLY 100'
            CASE 1 TO 99
                   PRINT 'THE VALUE IS BETWEEN 1 AND 99'
            CASE > 100
                   PRINT 'THE VALUE IS GREATER THAN 100'
            CASE ELSE
                   PRINT 'THE VALUE IS LESS THAN 1'
    END SELECT
Translator Output


    SELECT CASE A__% + B__% + C__%
            CASE = 100
            PRINT 'THE VALUE IS EXACTLY 100'
            CASE 1 TO 99
                   PRINT 'THE VALUE IS BETWEEN 1 AND 99'
            CASE > 100
                   PRINT 'THE VALUE IS GREATER THAN 100'
            CASE ELSE
                   PRINT 'THE VALUE IS LESS THAN 1'
    END SELECT

SET PROMPT

The VAX BASIC or DEC BASIC SET PROMPT statement enables a question mark prompt to appear after the compiler executes either an INPUT, LINPUT, INPUT LINE, MAT INPUT, or MAT LINPUT statement on channel #0. The SET NO PROMPT statement disables the question mark prompt.

Translated Equivalent

DECBAS_SET[NO]PROMPT


Example

VAX BASIC or DEC BASIC Input


SET NO PROMPT
Translator Output


DECBAS_SETNOPROMPT

SGN

The VAX BASIC or DEC BASIC SGN function determines whether a numeric expression is positive, negative, or zero. It returns 1 if the expression is positive, --1 if the expression is negative, and zero if the expression is zero.

Translated Equivalent

Sgn


SIN

The VAX BASIC or DEC BASIC SIN function returns the sine of an angle in radians or degrees.

Translated Equivalent

Sin


SLEEP

The VAX BASIC or DEC BASIC SLEEP statement suspends program execution for a specified number of seconds or until the return key is pressed from the controlling terminal.

Translated Equivalent

DECBAS_SLEEP


Example

VAX BASIC or DEC BASIC Input


SLEEP 20
Translator Output


DECBAS_SLEEP 20

SPACE$

The VAX BASIC or DEC BASIC SPACE$ function creates a string containing a specified number of spaces.

Translated Equivalent

Space


Remarks

The Translator actually produces code with the dollar sign ($) retained; however, functionally the code is the equivalent of the Visual Basic function Space.

SQR

The VAX BASIC or DEC BASIC SQR (SQRT) function returns the square root of a positive number.

Translated Equivalent

Sqr


STATUS

The VAX BASIC or DEC BASIC STATUS function returns an integer value containing information about the last opened channel. Your program can test each bit to determine the status of the channel.

Translated Equivalent

None


Remarks

The Translator does not support conversion of the VAX BASIC or DEC BASIC STATUS function.

STOP

The VAX BASIC or DEC BASIC STOP statement halts program execution allowing you to optionally continue execution.

Translated Equivalent

Stop


STR$

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

Translated Equivalent

CStr


STRING$

The VAX BASIC or DEC BASIC STRING$ function creates a string containing a specified number of identical characters.

Translated Equivalent

String


Remarks

The Translator actually produces code with the dollar sign ($) retained; however, functionally the code is the equivalent of the Visual Basic function String.

SUB

The VAX BASIC or DEC BASIC SUB statement marks the beginning of a subprogram and specifies the number and data type of its parameters.

Translated Equivalent

Sub


Remarks

Data type declarations in the parameter list are changed as appropriate. The other words are reordered as follows:

VAX BASIC or DEC BASIC Format


SUB sub-name [pass-mech] [( [formal-param],... )]

Visual Basic Format


SUB sub-name [( [vb-formal-param],... )]

Any default passing mechanism is made explicit by the Translator for each parameter. Each formal-param is translated as follows:

VAX BASIC or DEC BASIC Format


[data-type] var-name [( [int-const],... )] [= str-len] [pass-mech]

Visual Basic Format


vb-pass-mech var-name [()] [AS vb_data_type]

Any int-const array sizes are omitted, as are any str-len declarations of string lengths. Visual Basic does not need these because it passes enough information with array and string parameters to determine the sizes at run time, even when parameters are passed by reference. Visual Basic does not implement descriptors as such, so parameters cannot be passed BY DESC. These parameters are translated to pass BY REF, so that the called routine can modify the caller's copy of the value(s). You may wish to modify this behavior.


Previous Next Contents Index