Previous | Contents | Index |
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.
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.
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.
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.
The VAX BASIC or DEC BASIC FORMAT$ function converts an expression to a formatted string.
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.
VAX BASIC or DEC BASIC Input
FMAT = FORMAT$(NUM_EXP,"##.###") |
FMAT = DECBAS_FORMAT$(NUM_EXP,"##.###") |
The VAX BASIC or DEC BASIC FREE statement unlocks all records and buckets associated with a specified channel.
DECBAS_FREE is not supported for Sequential and Relative files that are local to the Windows environment.
The VAX BASIC or DEC BASIC FSP$ function returns a string describing an open file on a specified channel.
The Translator does not support conversion of the VAX BASIC or DEC BASIC FSP$ function.
The VAX BASIC or DEC BASIC FUNCTION statement marks the beginning of a FUNCTION subprogram and defines the subprogram's parameters.
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:
FUNCTION data-type fn-name [pass-mech] [( [formal-param],... )] |
FUNCTION fn-name [( [vb-formal-param],... )] AS vb-data-type |
[data-type] var-name [( [int-const],... )] [= str-len] [pass-mech] |
vb-pass-mech var-name [()] [AS vb_data_type] |
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.
During translation, any value returned from the function is moved to the line preceding the End Function in an assignment to the function name.
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 |
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 |
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.
During translation, any value returned from the function is moved to the line preceding the Exit Function in an assignment to the function name.
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 |
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 |
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.
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.
VAX BASIC or DEC BASIC Input
GET #2 , KEY# 2 EQ "X", WAIT 6 |
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 |
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.
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.
VAX BASIC or DEC BASIC Input
RARRAY(I%) = GETRFA(1) |
RARRAY(I_%) = DECBAS_GETRFA(1) |
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.
The VAX BASIC or DEC BASIC GOTO statement transfers control to a specified line number or label.
The VAX BASIC or DEC BASIC HANDLER statement marks the beginning of a detached handler.
handler-name:
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.
VAX BASIC or DEC BASIC Input
HANDLER HAND1 CONTINUE END HANDLER |
GoTo DECBAS_000001 HAND1: Resume Next Resume Next DECBAS_000001: |
The VAX BASIC or DEC BASIC IF statement evaluates a conditional expression and transfers program control depending on the resulting value.
VAX BASIC or DEC BASIC Input
IF X=0 THEN Y=5 ELSE Y=27 END IF |
IF X=0 THEN Y=5 ELSE Y=27 END IF |
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.
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" |
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" |
VAX BASIC or DEC BASIC Input
KEYSTROKE = INKEY$(0%,WAIT) |
KEYSTROKE = DECBAS_INKEY(0, DECBAS_WAIT) |
The VAX BASIC or DEC BASIC INPUT statement assigns values from your terminal or from a terminal-format file to program variables.
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.
VAX BASIC or DEC BASIC Input
INPUT "type two words", Z, "type something else"; N |
DECBAS_INPUT 0,"type two words",DECBAS_COMMA, Z, "type something else", DECBAS_SEMI, N |
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.
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.
VAX BASIC or DEC BASIC Input
INPUT LINE 4, "what time is it" ; T |
DECBAS_INPUTLINE 4, "what time is it",DECBAS_SEMI, T |
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.
Previous | Next | Contents | Index |