Previous | Contents | Index |
The VAX BASIC or DEC BASIC OPEN statement opens a file for processing. It transfers user-specified file characteristics to OpenVMS Record Management Services (RMS) and verifies the results.
Some of the VAX BASIC or DEC BASIC OPEN clauses work differently in Visual Basic, and some of the clauses are not supported. Where there are differences, it is typically because there is no reasonable corresponding Visual Basic or Win32 mechanism, or because the clause conflicts with some underlying feature or architectural construct of Visual Basic or the Windows system. For example, RMS is not available as a native API on Windows systems. Although the Translator provides access to RMS files via the Translator RMS Server component, there are some VAX BASIC or DEC BASIC I/O clauses that are not currently supported by the Translator. The following VAX BASIC or DEC BASIC OPEN clauses are not currently supported:
BLOCKSIZE
BUCKETSIZE
BUFFER
CONTIGUOUS
DEFAULTNAME
EXTENDSIZE
FILESIZE
NOREWIND
NOSPAN
ORGANIZATION UNDEFINED
ORGANIZATION VIRTUAL
ORGANIZATION [any format] STREAM
RECORDTYPE
SPAN
USEROPEN
WINDOWSIZE
Perhaps the most obvious and important difference in behavior involves the OPEN FOR OUTPUT clause for the local-file (Windows-resident) access mode. In VAX BASIC or DEC BASIC, if the file already exists, a new version of the file is created. The FAT file system on Windows systems does not maintain file versions. Therefore, if you specify OPEN FOR OUTPUT and the file already exists, the existing file is deleted! To keep the previous version of the file, you must either modify your VAX BASIC or DEC BASIC code before translation, or modify the translated code before executing the program. Prior to the OPEN statement, determine whether the file exists, and if it does, rename it. |
Location
The Translator attempts to determine whether the file you are
opening is a terminal (the terminal itself, not a terminal-format
file), a locally resident sequential or relative file, or a remotely
resident indexed file. There can be occasions when the Translator is
unable to make the correct determination. In those cases, you would
have to modify the DECBAS_OPEN procedure call in the translated code to
change the LOCATION parameter (the thirteenth parameter in the
DECBAS_OPEN call). The Translator always provides a channel-zero
terminal emulator window for the usual console terminal I/O operations
(PRINT, INPUT, and so forth). If you are opening a separate terminal
window on another channel, using one of the standard designations such
as SYS$INPUT, SYS$OUTPUT, SYS$ERROR, KB: or TT:, the Translator
recognizes that you are opening the terminal. Otherwise, you must
change the LOCATION parameter of the DECBAS_OPEN call, to be
DECBAS_LOCATION_TERMINAL. Refer to Section 5.3.5 for information on how
to modify the LOCATION parameter and other parameters for the various
file organizations.
Keys
If you are making use of a large number of alternate keys or segmented
keys, it is possible to exceed the Visual Basic maximum number of
continuation lines per statement in the translated Visual Basic
DECBAS_OPEN call. If this happens, you may need to shorten the length
of your key variable names or perhaps even reduce the number of
segments or alternate keys.
VAX BASIC or DEC BASIC Input
OPEN "XYZ" AS FILE 1 |
DECBAS_OPEN "XYZ",DECBAS_FOR_UNSPECIFIED,1,DECBAS_ORG_UNSPECIFIED _ + DECBAS_ORG_RFM_UNSPECIFIED,DECBAS_ACCESS_UNSPECIFIED, _ DECBAS_ALLOW_UNSPECIFIED,DECBAS_STRING_ARG_DEFAULT, _ DECBAS_STRING_ARG_DEFAULT,DECBAS_RECORDSIZE_UNSPECIFIED, _ DECBAS_INTEGER_ARG_DEFAULT,FALSE,FALSE,DECBAS_LOCATION_UNSPECIFIED |
The VAX BASIC or DEC BASIC OPTION statement allows you to set compilation qualifiers such as default data type, size, and scale factor. You can also set compilation conditions such as severity of run-time errors to handle, constant type checking, subscript checking, overflow checking, decimal rounding, and setup in a source program. The options that you set affect only the program module in which the OPTION statement occurs.
The Translator takes the OPTION declaration into account when possible (some clauses are supported) and gives a warning message otherwise. You should review the warning messages and modify the Visual Basic source as necessary to correct problems. The following is a list of the VAX BASIC or DEC BASIC OPTION clauses with issues for each clause:
The VAX BASIC or DEC BASIC PLACE$ function explicitly changes the precision of a numeric string. PLACE$ returns a numeric string, truncated or rounded, according to the value of an integer argument that you supply.
VAX BASIC or DEC BASIC Input
s = PLACE$ ("9999.9999", 3) |
s=DECBAS_PLACE$("9999.9999",3) |
The VAX BASIC or DEC BASIC POS function searches for a substring within a string and returns the substring's starting character position.
VAX BASIC or DEC BASIC Input
p = POS ("ABCDEFG", "DEF", 1) |
p=DECBAS_POS("ABCDEFG","DEF",1) |
The VAX BASIC or DEC BASIC PRINT statement transfers program data to a terminal or a terminal-format file.
VAX BASIC or DEC BASIC Input
PRINT #1, a, b |
DECBAS_PRINT 1,a,DECBAS_COMMA,b,DECBAS_EOL |
The VAX BASIC or DEC BASIC PRINT USING statement generates output formatted according to a format string (either numeric or string) to a terminal or a terminal-format file.
See the PRINT statement for more information.
VAX BASIC or DEC BASIC Input
PRINT USING "##.##", 12.345 |
DECBAS_PRINTUSING 0,"##.##",12.345,DECBAS_EOL |
The VAX BASIC or DEC BASIC PROD$ function returns a numeric string that is the product of two numeric strings. The precision of the returned numeric string depends on the value of an integer argument.
The algorithm used is simple long-hand multiplication. For compatibility with VAX BASIC or DEC BASIC, DECBAS_PROD$ raises an Illegal Number error if either input string exceeds 60 characters.
VAX BASIC or DEC BASIC Input
n = PROD$("34.555", "297.676", 1) |
n=DECBAS_PROD$("34.555","297.676",1) |
The VAX BASIC or DEC BASIC PROGRAM statement allows you to identify a main program with a name other than the file name.
An explicit PROGRAM statement is translated to a Visual Basic Sub Main() statement followed by a remark (Rem Program program-name) and a call to the routine DECBAS_INIT to initialize the state of the run-time library. If the PROGRAM statement is missing (implied), a Visual Basic Sub Main() is inserted to provide an explicit entry point where the Visual Basic program can start execution.
VAX BASIC or DEC BASIC Input
PROGRAM examples |
SUB MAIN() REM PROGRAM examples |
The VAX BASIC or DEC BASIC PUT statement transfers data from the record buffer to a file. PUT statements are valid on RMS sequential, relative, and indexed files. You cannot use PUT statements on terminal-format files or virtual array files.
For local relative and sequential files, the Translator does not support the COUNT clause. These files have fixed record length in Visual Basic.
VAX BASIC or DEC BASIC Input
PUT #5, RECORD 133, COUNT 16% |
DECBAS_PUT CHANNEL:= 5,RECORD_NUMBER:= 133, COUNT_SIZE:= 16 |
The VAX BASIC or DEC BASIC QUO$ function returns a numeric string that is the quotient of two numeric strings. The precision of the returned numeric string depends on the value of an integer argument.
The algorithm used is simple long-hand division. For compatibility with VAX BASIC or DEC BASIC, DECBAS_QUO$ raises an Illegal Number error if either input string exceeds 60 characters.
VAX BASIC or DEC BASIC Input
n = QUO$ ("458996.43", "123222.444", 2) |
n=DECBAS_QUO$("458996.43","123222.444",2) |
The VAX BASIC or DEC BASIC RAD$ function converts a specified integer in Radix-50 format to a 3-character string.
The Translator does not support conversion of the obsolete VAX BASIC or DEC BASIC RAD$ function.
The VAX BASIC or DEC BASIC RANDOMIZE (RANDOM) statement gives the random number function, RND, a new starting value.
The Visual Basic version of this function takes an optional argument that provides a seed value, but the Translator does not use it.
VAX BASIC or DEC BASIC Input
RANDOM |
RANDOMIZE |
The VAX BASIC or DEC BASIC RCTRLC function disables Ctrl/C trapping.
VAX BASIC or DEC BASIC Input
Y = RCTRLC |
Y=DECBAS_RCTRLC() |
The VAX BASIC or DEC BASIC RCTRLO function cancels the effect of Ctrl/O typed on a specified channel.
VAX BASIC or DEC BASIC Input
Y% = RCTRLO(0%) |
Y__%=DECBAS_RCTRLO(0) |
The VAX BASIC or DEC BASIC READ statement assigns values from a DATA statement to variables.
Although there is no simple, exact equivalent for the VAX BASIC or DEC BASIC READ statement, the Translator uses the DECBAS_DATA array created by the translation of the VAX BASIC or DEC BASIC DATA statement to assign values to variables. See the Example section.
VAX BASIC or DEC BASIC Input
SUB RD DATA ABC,DEF,GHI READ X,Y,Z RESTORE END SUB |
SUB RD DIM DECBAS_DATA() DIM DECBAS_DATA_INDEX AS VARIANT DECBAS_READ_RD DECBAS_DATA, DECBAS_DATA_INDEX, X,Y,Z DECBAS_DATA_INDEX = 0 END SUB SUB DECBAS_READ_DATA_RD( DECBAS_DATA, DECBAS_DATA_INDEX ) REDIM DECBAS_DATA(3) DECBAS_DATA(0) = """ABC""" DECBAS_DATA(1) = """DEF""" DECBAS_DATA(2) = """GHI""" END SUB |
The VAX BASIC or DEC BASIC REAL function converts a numeric expression or numeric string to a specified or default floating-point data type.
If you have specified the optional conversion size, the Translator converts SINGLE to DECBAS_SINGLE and DOUBLE to DECBAS_DOUBLE. Also, the Translator converts GFLOAT to DECBAS_DOUBLE.
VAX BASIC or DEC BASIC Input
a = REAL(rvar, SINGLE) |
a=DECBAS_REAL(rvar,DECBAS_SINGLE) |
Previous | Next | Contents | Index |