[an error occurred while processing this directive]

HP OpenVMS Systems

BASIC Translator
Content starts here

Compaq BASIC Translator
User Manual


Previous Contents Index


FNEXIT

The VAX BASIC or DEC BASIC FNEXIT statement is a synonym for the VAX BASIC or DEC BASIC EXIT DEF statement. See the DEC BASIC and VAX BASIC for OpenVMS Systems Reference Manual for more information.

Translated Equivalent

Exit Function


Remarks

Visual Basic does not support the equivalent of the VAX BASIC or DEC BASIC DEF and DEF* statements. DEF and DEF* statements are translated to the Visual Basic Function statement; therefore, EXIT DEF and EXIT DEF* (synonymous with FNEXIT) are translated to Exit Function. Any value returned from the function is moved to the previous line in an assignment to the function name. DEF statements can be defined within FUNCTION and SUB statements, but FUNCTION statements must be defined at the outermost level. You must edit the result to move the FUNCTION (originally, DEF) out to the top level. The DEC BASIC and VAX BASIC for OpenVMS Systems Reference Manual discusses in detail the differences among the DEF, DEF*, and FUNCTION statements. You should review this material to determine whether those differences are significant to your program. Finally, revisit those FUNCTION statements where the differences are significant and verify that they are translated to execute with the desired behavior.

FOR

The VAX BASIC or DEC BASIC FOR statement repeatedly executes a block of statements, while incrementing a specified control variable for each execution of the statement block. FOR loops can be conditional or unconditional and can modify other statements.

Translated Equivalent

For


Remarks

VAX BASIC or DEC BASIC has the ability to use FOR statements as modifiers (conditional and unconditional) to other statements. Visual Basic does not have this capability. If your application uses VAX BASIC or DEC BASIC statement modifiers, they are translated into standard control statements. The VAX BASIC or DEC BASIC FOR statement also has an optional WHILE clause; Visual Basic does not. VAX BASIC or DEC BASIC WHILE clauses are translated to Visual Basic While statements.

FORMAT$

The VAX BASIC or DEC BASIC FORMAT$ function converts an expression to a formatted string.

Translated Equivalent

DECBAS_FORMAT$


Remarks

In native mode, Visual Basic has formatting routines, but they are not the equivalent of those routines provided in VAX BASIC or DEC BASIC. You are advised to rewrite the code to use the Visual Basic native formatting routines where performance is an issue.

Example

VAX BASIC or DEC BASIC Input


FMAT = FORMAT$(NUM_EXP,"##.###")
Translator Output


FMAT = DECBAS_FORMAT$(NUM_EXP,"##.###")

FREE

The VAX BASIC or DEC BASIC FREE statement unlocks all records and buckets associated with a specified channel.

Translated Equivalent

DECBAS_FREE


Remarks

DECBAS_FREE is not supported for Sequential and Relative files that are local to the Windows environment.

FSP$

The VAX BASIC or DEC BASIC FSP$ function returns a string describing an open file on a specified channel.

Translated Equivalent

None


Remarks

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

FUNCTION

The VAX BASIC or DEC BASIC FUNCTION statement marks the beginning of a FUNCTION subprogram and defines the subprogram's parameters.

Translated Equivalent

Function


Remarks

Data type declarations in the parameter list are changed as appropriate. The other words are reordered to conform to the Visual Basic format, as follows:

VAX BASIC or DEC BASIC Format


FUNCTION data-type fn-name [pass-mech] [( [formal-param],... )]

Visual Basic Format


FUNCTION fn-name [( [vb-formal-param],... )] AS vb-data-type
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 default passing mechanism is made explicit by the Translator for each parameter. 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, 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.

FUNCTIONEND

The VAX BASIC or DEC BASIC FUNCTIONEND statement is a synonym for the END FUNCTION statement. See the DEC BASIC and VAX BASIC for OpenVMS Systems Reference Manual for more information.

Translated Equivalent

End Function


Remarks

During translation, any value returned from the function is moved to the line preceding the End Function in an assignment to the function name.

Example

VAX BASIC or DEC BASIC Input


FUNCTION REAL DOUBLE_OR_SQUARE (REAL X)

IF X < 0
THEN
    EXIT FUNCTION X*X
END IF

END FUNCTION X+X
Translator Output


FUNCTION DOUBLE_OR_SQUARE(ByRef X AS SINGLE)AS SINGLE
IF X < 0 THEN
    DOUBLE_OR_SQUARE=X*X
    EXIT FUNCTION
END IF
DOUBLE_OR_SQUARE=X+X
END FUNCTION

FUNCTIONEXIT

The VAX BASIC or DEC BASIC FUNCTIONEXIT statement is a synonym for the EXIT FUNCTION statement. See the DEC BASIC and VAX BASIC for OpenVMS Systems Reference Manual for more information.

Translated Equivalent

Exit Function


Remarks

During translation, any value returned from the function is moved to the line preceding the Exit Function in an assignment to the function name.

Example

VAX BASIC or DEC BASIC Input


FUNCTION REAL DOUBLE_OR_SQUARE (REAL X)

IF X < 0
THEN
    EXIT FUNCTION X*X
END IF

END FUNCTION X+X
Translator Output


FUNCTION DOUBLE_OR_SQUARE(ByRef X AS SINGLE)AS SINGLE
IF X < 0 THEN
    DOUBLE_OR_SQUARE=X*X
    EXIT FUNCTION
END IF
DOUBLE_OR_SQUARE=X+X
END FUNCTION

GET

The VAX BASIC or DEC BASIC GET statement moves a record from a file to a record buffer and makes the data available for processing. GET statements are valid on sequential, relative, and indexed files.

Translated Equivalent

DECBAS_GET CHANNEL := channel [ , position-clause] [,lock-clause] [,WAIT_VALUE := int-exp]


Remarks

Unlike VAX BASIC or DEC BASIC, for local sequential and local relative files, Visual Basic does not support the LOCK clause or its ALLOW subclause, or any of the values of LOCK and ALLOW. For more information on I/O, see Chapter 5.

Example

VAX BASIC or DEC BASIC Input


GET #2 , KEY# 2 EQ "X", WAIT 6
Translator Output


DECBAS_GET CHANNEL:= 2 ,POS_CLAUSE_TYPE:= DECBAS_POS_KEY, _
  KEY_NUMBER:= 2 ,KEY_REL_OP:= DECBAS_REL_OP_EQ,KEY_COMP_EXP:="X", _
  WAIT_VALUE:= 6,LOCK_CLAUSE_TYPE:= DECBAS_LOCK_WAIT

GETRFA

The VAX BASIC or DEC BASIC GETRFA function returns the record's file address (RFA) of the last record accessed in an RMS file open on a specified channel.

Translated Equivalent

DECBAS_GETRFA


Remarks

RFA is supported for an RMS data file residing on a remote OpenVMS system when the file is accessed in the remote I/O access mode using the Translator RMS Server component. RFA is a low-level RMS performance optimization feature that is not directly available for local Windows files using the Translator local I/O access mode. For local files, the Translator simulates RFA using the record number, which results in performance loss compared to that of the original OpenVMS RMS RFA implementation. If the original RMS RFA level of performance optimization is critical to your translated application, you should consider leaving the RMS data file on the remote OpenVMS system in order to access the file in the remote I/O access mode using the Translator RMS Server component.

Example

VAX BASIC or DEC BASIC Input


RARRAY(I%) = GETRFA(1)
Translator Output


RARRAY(I_%) = DECBAS_GETRFA(1)

GOSUB

The VAX BASIC or DEC BASIC GOSUB statement transfers control to a specified line number or label and stores the location of the GOSUB statement for eventual return from the subroutine.

Translated Equivalent

GoSub


GOTO

The VAX BASIC or DEC BASIC GOTO statement transfers control to a specified line number or label.

Translated Equivalent

GoTo


HANDLER

The VAX BASIC or DEC BASIC HANDLER statement marks the beginning of a detached handler.

Translated Equivalent

GoTo DECBAS_xxxx


handler-name:


Remarks

The VAX BASIC or DEC BASIC HANDLER statement is converted to a branch to the line that follows the end of the detached handler. The name of the handler becomes a label. See the Example section. Please refer to Chapter 6 for more information on exception handling.

Example

VAX BASIC or DEC BASIC Input


HANDLER HAND1
    CONTINUE
END HANDLER
Translator Output


GoTo DECBAS_000001
HAND1:
    Resume Next
Resume Next
DECBAS_000001:

IF

The VAX BASIC or DEC BASIC IF statement evaluates a conditional expression and transfers program control depending on the resulting value.

Translated Equivalent

If


Example

VAX BASIC or DEC BASIC Input


IF X=0
THEN
    Y=5
ELSE
    Y=27
END IF
Translator Output


IF X=0 THEN
    Y=5
ELSE
    Y=27
END IF

INKEY$

The VAX BASIC or DEC BASIC INKEY$ function reads a single keystroke from a terminal opened on a specified channel and returns the typed character.

Translated Equivalent

DECBAS_INKEY


Remarks

DECBAS_INKEY does not necessarily return the same strings as VAX BASIC or DEC BASIC, because the keyboard layout on a Windows NT or Windows 95 workstation (PC) is different from that of a VTnnn terminal. You may need to modify your applications accordingly. The PC's Enter key cannot be differentiated from the main keyboard's Enter or Return key. For this reason, DECBAS_INKEY will return a carriage-return character. This is regardless of whether the NUM LOCK indicator is on or off. The strings returned by DECBAS_INKEY for some of the keypad keys, however, are dependent upon whether the NUM LOCK indicator is on or off. The following table shows which keys have the dependency:
  String Returned  
Keypad Key NUM LOCK off NUM LOCK on  
NUM LOCK "PF1" "PF1"  
/ "PF2" "PF2"  
* "PF3" "PF3"  
- "PF4" "PF4"  
7 "7" "HOME"  
8 "8" "UP"  
9 "9" "PAGEUP"  
+ "KP+" "KP+"  
4 "4" "LEFT"  
5 "5" "KP5"  
6 "6" "RIGHT"  
1 "1" "END"  
2 "2" "DOWN"  
3 "3" "PAGEDOWN"  
0 "0" "INSERT"  
. "." "DELETE"  
F1 through F12 return the strings "F1" through "F12" respectively and are not affected by the Shift, Ctrl, or Alt keys, or the NUM LOCK state. The editing keypad of a PC keyboard returns the following strings:
Editing Key String
Ins or INSERT "INSERT"
HOME "HOME"
Pg Up or PAGE UP "PAGEUP"
Del or DELETE "DELETE"
END "END"
Pg Down or PAGE DOWN "PAGEDOWN"
These values are also not affected by the Shift, Ctrl, or Alt keys, or the NUM LOCK state.

Example

VAX BASIC or DEC BASIC Input


KEYSTROKE = INKEY$(0%,WAIT)
Translator Output


KEYSTROKE = DECBAS_INKEY(0, DECBAS_WAIT)

INPUT

The VAX BASIC or DEC BASIC INPUT statement assigns values from your terminal or from a terminal-format file to program variables.

Translated Equivalent

DECBAS_INPUT channel, input_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 INPUT. From this terminal emulation window, INPUT (as well as INPUT # from a terminal-format file) works in much the same manner as under VAX BASIC or DEC BASIC. 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. For more information on I/O, see Chapter 5.

Example

VAX BASIC or DEC BASIC Input


INPUT "type two words", Z, "type something else"; N
Translator Output


DECBAS_INPUT 0,"type two words",DECBAS_COMMA, Z, "type something else",
DECBAS_SEMI, N

INPUT LINE

The VAX BASIC or DEC BASIC INPUT LINE statement assigns a string value (including the line terminator in some cases) from a terminal or terminal-format file to a string variable.

Translated Equivalent

DECBAS_INPUTLINE channel, input_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 INPUT LINE. From this terminal emulation window, INPUT LINE (as well as INPUT LINE # from a terminal-format file) works in much the same manner as under VAX BASIC or DEC BASIC. 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. For more information on I/O, see Chapter 5.

Example

VAX BASIC or DEC BASIC Input


INPUT LINE 4, "what time is it" ; T
Translator Output


DECBAS_INPUTLINE 4, "what time is it",DECBAS_SEMI, T

INSTR

The VAX BASIC or DEC BASIC INSTR function searches for a substring within a string. It returns the position of the substring's starting character.

Translated Equivalent

DECBAS_INSTR


Previous Next Contents Index