Previous | Contents | Index |
The VAX BASIC or DEC BASIC INT function returns the floating-point value of the largest whole number less than or equal to a specified expression.
The VAX BASIC or DEC BASIC INTEGER function converts a numeric expression or numeric string to a specified or default INTEGER data type.
If you specify the optional conversion size, the Translator converts BYTE to DECBAS_BYTE, WORD to DECBAS_WORD, and LONG to DECBAS_LONG. The Translator converts the VAX BASIC or DEC BASIC WORD data type to the Visual Basic Integer data type. For more information, see Chapter 4.
The VAX BASIC or DEC BASIC ITERATE statement allows you to explicitly reexecute a loop. ITERATE label allows escape from a loop.
VAX BASIC or DEC BASIC Input
FOR I = 1 TO 5 IF I > X THEN ITERATE NEXT |
FOR I = 1 TO 5 IF I > X THEN GOTO DECBAS_00001 DECBAS_00001: NEXT |
C: FOR I = 1 TO 10 A = A + 1 PRINT A; IF A > 5 THEN ITERATE C END IF A = A+2 NEXT I |
Translator Output
C: FOR I=1 TO 10 A=A+1 DECBAS_PRINT 0,A,DECBAS_SEMI IF A>5 THEN GOTO DECBAS_000003 END IF A=A+2 DECBAS_000003: NEXT I |
The VAX BASIC or DEC BASIC KILL statement deletes a disk file, removes the file's directory entry, and releases the file's storage space.
File path names on OpenVMS Alpha systems will have a different syntax from path names on Windows NT systems. When you decide where the various files used by your application are to reside, you must adjust these path names accordingly.
The VAX BASIC or DEC BASIC LBOUND function returns the lower bounds of a compile-time or run-time dimensioned array.
The VAX BASIC or DEC BASIC LEFT$ function extracts a specified substring from a string's left side and leaves the main string unchanged.
The Translator actually produces code with the dollar sign ($) retained; however, functionally the code is the equivalent of the Visual Basic function Left.
The VAX BASIC or DEC BASIC LEN function returns an integer value equal to the number of characters in a specified string.
The VAX BASIC or DEC BASIC LET statement assigns a value to one or more variables.
For information about performing division in Visual Basic, see Section 3.8. VAX BASIC or DEC BASIC and Visual Basic differ when assigning a floating-point value to an integer variable. VAX BASIC or DEC BASIC truncates the fractional part of the value before doing the assignment. The assignment I% = 0.625 produces the result 0. Visual Basic rounds the value first. The assignment I% = 0.625 produces the result 1. When you have an expression of the form integer_variable = expression , you can use the Fix function to achieve the same result as VAX BASIC or DEC BASIC: integer_variable = Fix ( expression ) . Visual Basic does not support multitarget assignment, whereas VAX BASIC and DEC BASIC do. The Translator includes partial support for multitarget assignment. In addition to the LET statement (including the plain assignment statement that omits the optional LET keyword), this support affects the LSET and RSET statements. To illustrate the kind of multitarget assignment supported, the following example has two assignment targets:
LET var1,var2 = the_expression |
decbas_temp = the_expression LET var1 = decbas_temp LET var2 = decbas_temp |
a(i),i = 5 i,a(i) = 5 |
Following is a sample of source code from a program called MULTASN.BAS:
! Fill the array with recognizable items. for i = 0 to 10 a(i) = i*10 next i ! VAX&DEC BASIC assign to r before a(r) r = 1 a(r),r = 9 ! VAX&DEC BASIC assign to r before a(r) r=5 r,a(r) = 7 ! See what we got mat print a; ! more multi-target examples a,b,c = pi*r^2 here: d,e = a*b-3 now: let f,g,h,i = a+b*c a$,b$,c$ = "123456789" d$ = "1234567890123456789" rset a$,b$,c$ = num$(h) lset d$ = a$ + b$ print "|";a$;"|";b$;"|";c$;"|";d$;"|" |
Attribute VB_Name = "MULTASN" SUB MAIN() DECBAS_INIT"%Bbo7dVXCOUON6","QybCX" ' Fill the array with recognizable items. for i=0 to 10 a(i)=i*10 next i ' VAX&DEC BASIC assign to r before a(r) r=1 DECBAS_TEMP=9 a(r)=DECBAS_TEMP r=DECBAS_TEMP ' VAX&DEC BASIC assign to r before a(r) r=5 DECBAS_TEMP=7 r=DECBAS_TEMP a(r)=DECBAS_TEMP ' See what we got DECBAS_MATPRINT 0,a,,,DECBAS_SEMI ' more multi-target examples DECBAS_TEMP=3.141592653589793238462643383279502*r^2 a=DECBAS_TEMP b=DECBAS_TEMP c=DECBAS_TEMP here:DECBAS_TEMP=a*b-3 d=DECBAS_TEMP e=DECBAS_TEMP now:DECBAS_TEMP=a+b*c let f=DECBAS_TEMP let g=DECBAS_TEMP let h=DECBAS_TEMP let i=DECBAS_TEMP DECBAS_TEMP="123456789" a_$=DECBAS_TEMP b_$=DECBAS_TEMP c_$=DECBAS_TEMP d_$="1234567890123456789" DECBAS_TEMP=DECBAS_NUM$(h) rset a_$=DECBAS_TEMP rset b_$=DECBAS_TEMP rset c_$=DECBAS_TEMP lset d_$=a_$+b_$ DECBAS_PRINT 0,"|",DECBAS_SEMI,a_$,DECBAS_SEMI,"|",DECBAS_SEMI,b_$ _ ,DECBAS_SEMI,"|",DECBAS_SEMI,c_$,DECBAS_SEMI,"|" _ ,DECBAS_SEMI,d_$,DECBAS_SEMI,"|",DECBAS_EOL DECBAS_EXIT: DECBAS_END END SUB |
The VAX BASIC or DEC BASIC LINPUT statement assigns a string value, without line terminators, 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 LINPUT. From this terminal emulation window, LINPUT (as well as LINPUT # 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
LINPUT "type two words", Z, "type something else"; N |
DECBAS_LINPUT 0,"type two words",DECBAS_COMMA, Z , "type something else",DECBAS_SEMI, N |
The VAX BASIC or DEC BASIC LOC function returns a longword integer specifying the virtual address of a simple or subscripted variable or the address of an external function. For dynamic strings, the LOC function returns the address of the descriptor rather than the address of the data.
or
AddressOf
Visual Basic does not have the capability to determine the memory address of a variable, an array element, or a descriptor. There is no Visual Basic function that is equivalent to the VAX BASIC or DEC BASIC LOC function. The Visual Basic Loc function, which returns the current read/write position within an open file, is unrelated. Address of a Function In Version 4.0, Visual Basic cannot determine the memory address of a function. As of Version 5.0, Visual Basic adds the AddressOf operator, which can determine the memory address of a function, but only when used as a parameter in a function call; for example:
FNC1(A, AddressOf FNC2, B) |
VALUE1 = FNC1(A, LOC(FNC2), B) |
VALUE1 = FNC1(A, AddressOf FNC2, B) |
VAR_ADRS = LOC (COUNT_VAR) |
VAR_ADRS = DECBAS_LOC (COUNT_VAR) |
The VAX BASIC or DEC BASIC LOG function returns the natural logarithm (base e) of a specified number. The LOG function is the inverse of the EXP function.
The VAX BASIC or DEC BASIC LOG10 function returns the common logarithm (base 10) of a specified number.
Because the internal format of floating-point numbers is different between VAX BASIC or DEC BASIC and Visual Basic, DECBAS_LOG10 does not yield exactly the same result as the LOG10 function. For more information on floating-point differences, see Chapter 4.
The VAX BASIC or DEC BASIC LSET statement assigns left-justified data to a string variable. LSET does not change the length of the destination string variable.
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.
The VAX BASIC or DEC BASIC MAG function returns the absolute value of a specified expression. The returned value has the same data type as the expression.
The VAX BASIC or DEC BASIC MAGTAPE function permits your program to control unformatted magnetic tape files.
Visual Basic does not support access to magnetic tapes; therefore, the Translator does not support conversion of the MAGTAPE function.
The VAX BASIC or DEC BASIC MAP statement defines a named area of statically allocated storage called a PSECT, declares data fields in the record, and associates them with program variables.
Visual Basic does not have MAP statements; they are translated to Visual Basic classes. Refer to Section 4.2.6 for detailed information on the MAP statement.
The VAX BASIC or DEC BASIC MAP DYNAMIC statement names the variables and arrays whose size and position in a storage area can change at run time. The MAP DYNAMIC statement is used in conjunction with the REMAP statement. The REMAP statement defines or redefines the position in the storage area of variables named in the MAP DYNAMIC statement.
Because Visual Basic does not have a concept that corresponds to dynamic mapping, the Translator does not support conversion of the MAP DYNAMIC statement. The Translator produces a warning and converts the code as if it were a MAP statement. Strings, if not specified, default to a size of 16 bytes.
The VAX BASIC or DEC BASIC MAR function returns the current margin width of a specified channel.
VAX BASIC or DEC BASIC Input
width = MAR(0) |
width = DECBAS_MAR(0) |
The VAX BASIC or DEC BASIC MARGIN statement specifies the margin width for a terminal or for records in a terminal-format file.
VAX BASIC or DEC BASIC Input
MARGIN 60 |
DECBAS_MARGIN 0,MARGIN_WIDTH:=60 |
The VAX BASIC or DEC BASIC MAT statement lets you delete and manipulate one- and two-dimensional arrays. You can use the MAT statement to assign values to array elements or to redimension a previously dimensioned array. You can also perform matrix arithmetic operations such as multiplication, addition, and subtraction, and other matrix operations such as transposing and inverting matrices.For syntax, see the hardcopy manual.
Visual Basic does not support the VAX BASIC or DEC BASIC MAT statement. Therefore, the Translator translates all calls to the MAT statement to calls to DECBAS_MAT* support routines. Output variables must exist and must be declared explicitly because Visual Basic does not allow the implicit creation and deletion of one- and two-dimensional arrays. Also, if the output variable needs to be resized, it must be declared a dynamic array. The DECBAS_MAT* support routines use 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.
The following table shows examples of VAX BASIC or DEC BASIC input and Visual Basic output:
Purpose | VAX BASIC or DEC BASIC Input | Translated Output |
---|---|---|
Initialization | MAT NA_ME$ = NUL$(5,5) | DECBAS_MATNUL NA_ME_$(),5,5 |
Numeric Initialization | MAT CONVERT = zer(10,10) | DECBAS_MATZER Convert(),10,10 |
Array Arithmetic | MAT NEW_INT = OLD_INT - RSLT_INT | DECBAS_MATSUB NEW_INT(), OLD_INT(), RSLT_INT() |
Scalar Multiplication | MAT Z40 = (4.24) * Z | DECBAS_MATMUL Z40(), 4.24, Z() |
Transposition | MAT Q% = TRN (Z) | DECBAS_MATTRN Q__%(),Z() |
Inversion | MAT A=INV(XYZ) | DECBAS_MATINV A(),XYZ() |
The VAX BASIC or DEC BASIC MAT INPUT statement assigns values from a terminal or terminal-format file to array elements.
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 INPUT. From this terminal emulation window, MAT INPUT (as well as MAT INPUT # 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 INPUT 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 INPUT statement. The DECBAS_MATINPUT 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 DIMENSION 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 INPUT. 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.
VAX BASIC or DEC BASIC Input
MAT INPUT XYZ(5,5) |
DECBAS_MATINPUT 0,XYZ,5,5 |
Previous | Next | Contents | Index |