There are switches or “driver strings” you can set to control the way your application creates, reads, and writes files with a specific driver. Driver strings are simply messages or parameters that are sent to the file driver at run-time to control its behavior. See Common Driver Features–Driver Strings for an overview of these runtime Database Driver switches and parameters.
Some driver strings have no effect after the file is open, so no SEND function syntax is listed for those strings. However, the SEND function syntax to return the value of the switch is listed for all driver strings.
The Basic Driver supports the following Driver Strings:
ALWAYSQUOTE
DRIVER('BASIC', '/ALWAYSQUOTE = on | off' )
[ QScan“ = ] SEND(file, 'ALWAYSQUOTE [ = on | off ]' )
For compatibility with Basic format data files created by products that do not place string values in quotes, set ALWAYSQUOTE to OFF.
When the contents of a string field includes the comma or quote character(s), and ALWAYSQUOTE is off, the Basic driver automatically places quotes around the string when writing to file. This also applies to delimiter characters specified with FIELDDELIMITER, or COMMA. For example, with the defaults in use and ALWAYSQUOTE off, a STRING field containing the value 1313 Mockingbird Lane, Apt. 33 is automatically stored as: “1313 Mockingbird Lane, Apt. 33”
SEND returns the ALWAYSQUOTE setting (ON or OFF) in the form of a STRING(3).
COMMA
DRIVER('BASIC', /COMMA = n' )
[ Comma” = ] SEND(file, 'COMMA [ = n ]' )
Specifies a single character field separator.
n represents the ANSI code for the field separator character. The default is 44, which is equivalent to “/FIELDDELIMITER=1,44.”
SEND returns the ASCII code for the field separator character.
CTRLZISEOF
DRIVER('BASIC', '/CTRLZISEOF = on | off' )
[ EOF“ = ] SEND(file, 'CTRLZISEOF [ = on | off ]' )
By default (CTRLZISEOF=on) the file driver assumes that any Ctrl-Z characters in the file indicate the end of file. To disable this feature set CTRLZISEOF=off. SEND returns the CTRLZISEOF setting in a STRING(3).
ENDOFRECORD
DRIVER('BASIC', '/ENDOFRECORD = n [,m ]' )
[ EOR” = ] SEND(file, 'ENDOFRECORD [ = n [,m ]]' )
Specifies the end of record delimiter.
n represents the number of characters that make up the end-of-record delimiter.
m represents the ANSI code(s) for the end-of-record delimiter, separated by commas. The default is 2,13,10, indicating 2 characters mark the end-of-record, namely, carriage return (13) and line feed (10). SEND returns the end of record delimiter.
Mainframes frequently use just a carriage return to delimit records. You can use ENDOFRECORD to read these files.
ENDOFRECORDINQUOTE
DRIVER('BASIC', '/ENDOFRECORDINQUOTE = on | off' )
[ EORQuote“ = ] SEND(file, 'ENDOFRECORDINQUOTE [ = on | off ]' )
By default (ENDOFRECORDINQUOTE=ON) the file driver does not recognize an end-of-record marker that is within a quoted string. To force End-Of-Record markers to always terminate a record, set ENDOFRECORDINQUOTE=OFF. SEND returns the ENDOFRECORDINQUOTE setting (ON or OFF) in the form of a STRING(3).
FIELDDELIMITER
DRIVER('BASIC', '/FIELDDELIMITER = n [,m ]' )
[ Limiter” = ] SEND(file, 'FIELDDELIMITER [ = n [,m ]]' )
Specifies the field separator. This is in addition to any string delimiter specified by the /QUOTE driver string.
n represents the number of characters that make up the field separator.
m represents the ANSI code(s) for the field separator characters, separated by commas. The default is 1,44 which indicates the comma character.
SEND returns the field delimiter character.
If both FIELDDELIMITER and COMMA are specified, the last specification prevails.
FILEBUFFERS
DRIVER('BASIC', '/FILEBUFFERS = n' )
[ Buffers“ = ] SEND(file, 'FILEBUFFERS [ = n ]' )
Sets the size of the buffer used to read and write to the file, where the buffer size is (n * 512 bytes). Use the /FILEBUFFERS driver string to increase the buffer size if access is slow. Maximum buffer size is 4,294,967,264. SEND returns the size of the buffer in bytes.
The default buffer size for files opened denying write access to other users is the larger of 1024 or (2 * record size), and the larger of 512 or record size for all other open modes.
FIRSTROWHEADER
DRIVER('BASIC', '/FIRSTROWHEADER=[ON|OFF]' )
[ Buffers” = ] SEND(file, '/FIRSTROWHEADER [ = ON|OFF]' )
This indicates if the first row of the file contains the labels of the columns.
By default this switch is off. If turned on, then CREATE(file) will add a line containing the labels of the fields separated by the comma character (as specified by the COMMA switch or ','), further the first line will always be skipped when reading from the file.
QUICKSCAN
DRIVER('BASIC', '/QUICKSCAN = on | off' )
[ QScan“ = ] SEND(file, 'QUICKSCAN [ = on | off ]' )
Specifies buffered access behavior. The BASIC driver reads a buffer at a time (not a record), allowing faster access. In a multi-user environment these buffers are not 100% trustworthy for subsequent access, because another user may change the file between accesses. As a safeguard, the driver rereads the buffers before each record access. To disable the reread, set QUICKSCAN to ON. The default is ON for files opened denying write access to other users, and OFF for all other open modes. SEND returns the QUICKSCAN setting (ON or OFF) in the form of a STRING(3).
TAB-delimited values are a common format compatible with the Windows clipboard. Using the BASIC file driver string
/COMMA=9 lets you read Windows clipboard files
QUOTE
DRIVER('BASIC', '/QUOTE = n' )
[ Quote” = ] SEND(file, 'QUOTE [ = n ]' )
Specifies a single character string delimiter.
n is the ANSI code of the delimiter character. The default is 34, the ASCII value for the quotation mark.
SEND returns the ASCII code of the single character string delimiter.
Popular File Formats
The following demonstrates how to use the driver strings to create two popular file formats:
Microsoft Word for Windows Mail Merge:
/ALWAYSQUOTE=OFF
/FIELDDELIMITER=1,9
/ENDOFRECORD=1,13
TAB delimited format:
/COMMA=9