Previous | Contents | Index |
The Translator provides support both for traditional terminal input
and output (I/O) and for the major file organizations: terminal-format,
sequential, relative, and indexed.
5.1 File Input/Output Strategies
The Translator supports two different file I/O strategies: remote file access and local file access.
The Translator provides a terminal emulation window on your Windows display. This window remains on the display until you close it. Traditional VAX BASIC or DEC BASIC terminal I/O is performed on this channel #0 terminal emulator without any special action on your part.
If you wish, you can also assign other terminals to the channel #0 emulator. To do this, open another channel with a nonzero channel number and use one of the standard terminal names as the file specification, for example, SYS$INPUT, SYS$OUTPUT, SYS$ERROR. TT:, or KB:.
You can also open one or more additional virtual terminals, separate and distinct from the channel #0 terminal. To do this, open a file on a different channel and specify the LOCATION parameter in the translated DECBAS_OPEN call to be DECBAS_ LOCATION_TERMINAL.
The Translator supports the following VAX BASIC or DEC BASIC statements in the terminal emulator:
BUFSIZ
CCPOS
CLOSE
CTRLC
ECHO
INKEY
INPUT
INPUT LINE
LINPUT
MAR
MARGIN
MAT INPUT
MAT LINPUT
MAT PRINT
NOECHO
NOMARGIN
NUM
NUM2
OPEN
PRINT USING
RCTRLC
RCTRLO
RECOUNT
SETNOPROMPT
SETPROMPT
SLEEP
WAIT
For a list of the supported terminal emulator functions, refer to
Appendix C.
5.3 File Organizations
The Translator supports the following file organizations:
If you do not specify a file organization when opening a file, the
organization defaults to terminal-format. This is consistent with VAX
BASIC and DEC BASIC.
5.3.1 Terminal-Format Files
If your VAX BASIC or DEC BASIC OPEN statement does not specify ORGANIZATION, the Translator uses local file I/O to emulate VAX BASIC or DEC BASIC terminal-format I/O. The terminal-format file is resident on the Windows system.
The Translator supports the following VAX BASIC or DEC BASIC statements for terminal-format files:
BUFSIZ
CCPOS
CLOSE
INPUT
INPUT LINE
LINPUT
MAR
MARGIN
MAT INPUT
MAT LINPUT
MAT PRINT
NOMARGIN
NUM
NUM2
OPEN
PRINT USING
RECOUNT
If your VAX BASIC or DEC BASIC OPEN statement specifies ORGANIZATION SEQUENTIAL, by default the Translator uses local file I/O in Visual Basic in which the files are resident on the Windows system. This default can be overridden to specify remote files using a method described in Section 5.3.5.
For local sequential files, VAX BASIC or DEC BASIC sequential file I/O is emulated with Visual Basic random file I/O. What Visual Basic refers to as its own "sequential" file I/O more closely resembles VAX BASIC or DEC BASIC terminal-format file I/O, so the Translator uses random file I/O to better emulate RMS sequential file operations. The fixed-length file format is the only one supported within Visual Basic for local sequential files.
The Translator supports the following VAX BASIC or DEC BASIC I/O statements for sequential files:
BUFSIZ
CLOSE
DELETE
FIND
FREE
GET
GETRFA
MAP
MOVE FROM
MOVE TO
OPEN
PUT
RECOUNT
RESTORE
SCRATCH
UNLOCK
UPDATE
If your VAX BASIC or DEC BASIC OPEN statement specifies ORGANIZATION RELATIVE, by default the Translator uses local file I/O in Visual Basic, with the files resident on the Windows system. You can override this default and specify remote files using a method described in Section 5.3.5.
For local relative files, VAX BASIC or DEC BASIC sequential file I/O is emulated with Visual Basic random file I/O. The fixed-length file format is the only one supported within Visual Basic for local relative files.
The Translator supports the following VAX BASIC or DEC BASIC I/O statements for relative files:
BUFSIZ
CLOSE
DELETE
FIND
FREE
GET
GETRFA
MAP
MOVE FROM
MOVE TO
OPEN
PUT
RESTORE
UNLOCK
UPDATE
If your VAX BASIC or DEC BASIC OPEN statement specifies ORGANIZATION INDEXED, the Translator must use remote file I/O to access the file on an OpenVMS system. Because certain parameters necessary for remote file I/O are not normally contained in your original VAX BASIC or DEC BASIC source program, it will be necessary for you to perform some one-time post-translation modifications to your translated program to specify these parameters, using a method described in Section 5.3.5.
The Translator supports the following VAX BASIC or DEC BASIC statements for indexed files:
BUFSIZ
CLOSE
DELETE
FIND
FREE
GET
GETRFA
MAP
MOVE FROM
MOVE TO
OPEN
PUT
RESTORE
UNLOCK
UPDATE
OPEN statements are translated into calls to the DECBAS_OPEN procedure, a run-time component that calls lower-level methods in the RTL DLL. The default file access method for sequential and relative files is local file I/O, with the files resident on the Windows system as opposed to being resident on a remote OpenVMS system. The default access method for indexed files is remote file I/O, because indexed files must always be resident on a remote OpenVMS system.
Remote data files must already exist on the remote OpenVMS file server system. The translated program cannot create new RMS files across the network.
If you access remote indexed files in your program, or if you access sequential or relative files that you plan to keep on an OpenVMS system, and you have installed the Translator RMS Server component on the OpenVMS system, you will need to perform some one-time post-translation modifications to your translated program to specify remote file I/O parameters.
To specify remote file access in your translated program, locate the appropriate DECBAS_OPEN procedure call in the translated code and change the following three parameters as follows:
DECBAS_STRING_ARG_DEFAULT |
poiuyt.servu.com;myacct;mypasswd |
ConnectString = HostAddress & ";" & _ HostUserName & ";" & _ HostPassword |
DECBAS_LOCATION_UNSPECIFIED |
DECBAS_LOCATION_LOCAL |
DECBAS_LOCATION_REMOTE |
After making the above one-time modifications to the translated DECBAS_OPEN procedure call, the remote RMS file will be accessed over the network at run-time without any further changes, transparently to the users of the translated program.
A translated program running on Windows can be connected to many
different remote OpenVMS systems at one time, performing remote I/O
operations independently on each system over the network. Conversely,
translated applications running on many different Windows systems can
be simultaneously connected to the same OpenVMS server and file
(assuming the OPEN statement specified the proper sharing
characteristics).
5.4 File and Record Operations
The Translator supports some file and record operations in all
access modes, while other operations are supported by only some of the
modes. Refer to Chapter 7 for more detail on the individual
operations.
5.4.1 Opening Files
This section discusses some considerations regarding opening files: code differences, file location, and keys.
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. |
As with most of the other Translator statements and functions, use caution when dealing with explicit VAX BASIC or DEC BASIC error codes, which may be different 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, so it is best to check and test each usage of error codes.
The Translator attempts to determine whether the file that 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 may be occasions when the Translator is unable to make the correct determination. In those cases, you must 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.
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.
5.5 Unsupported File Input and Output
The Translator does not support the following types of file I/O:
Previous | Next | Contents | Index |