| **Navigation:**  ISAM File Drivers > ASCII Database Driver >====== ASCII:Driver Strings ====== | [[ascii database driver.htm|{{btn_prev_n.gif|Previous page}}]][[coming future.htm|{{btn_home_n.gif|Return to chapter overview}}]][[ascii supported commands and attributes.htm|{{btn_next_n.gif|Next page}}]] | | || 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.htm|Driver Strings]]// for an overview of these runtime Database Driver switches and parameters. {{notebox.jpg|NoteBox.jpg}} **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 ASCII Driver supports the following Driver Strings: **CLIP** **DRIVER('ASCII', '/CLIP = on | off' **) **[ Clip" = ] SEND(file, 'CLIP [ = on | off ]' **) The driver automatically removes trailing spaces from a record before writing it to file. Conversely, the driver automatically expands the clipped records with spaces when read. To disable this feature, set CLIP to OFF. The default is ON. SEND returns the CLIP setting (ON or OFF) in the form of a STRING(3). **CTRLZISEOF** **DRIVER('ASCII', '/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('ASCII', '/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 ASCII 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. {{tipbox.jpg|TipBox.jpg}} **Mainframes and MACs frequently use just a carriage return to delimit records.** **You can use ENDOFRECORD=1,13 to read these files. UNIX/Linux files frequently** **terminate with just a line feed and can be read using ENDOFRECORD=1,10** **FILEBUFFERS** **DRIVER('ASCII', '/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. {{tipbox.jpg|TipBox.jpg}} **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.** **TAB** **DRIVER('ASCII', '/TAB = n' )** **[ Spaces" = ] SEND(file, 'TAB [ = n ]' )** Sets or queries TAB/SPACE expansion. The ASCII driver expands TABs (ASCII character 9) to spaces when reading. The value indicates the number of spaces with which to replace the tab, subject to the guidelines below. The default value is 8. SEND returns the number of spaces which replace the tab character. //If n > 0//, spaces replace each tab until the character pointer moves to the next multiple of //n//. For example, with the default of 8, if the TAB character is the third character in the record, 6 spaces replace the TAB. //If n = 0//, the driver removes tabs without replacement. //If n <; 0//, the driver removes tabs with the positive value of //n //spaces. For example, "TAB=-4" causes 4 spaces to replace every tab, regardless of the position of the tab in the record. If n = -1, the driver replaces tabs with a single space. //If n = -100//, tabs remain as tabs; the driver //does not //replace them with spaces. **QUICKSCAN** **DRIVER('ASCII', '/QUICKSCAN = on | off' )** **[ QScan" = ] SEND(file, 'QUICKSCAN [ = on | off ]' )** Specifies buffered access behavior. The ASCII 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). **UTF** **DRIVER('ASCII', '/UTF = 8 | 16BE | 16LE' **) **[ Clip" = ] SEND(file, 'UTF [ = 8 | 16BE | 16LE' ]' **) The driver reads and writes data using ASCII, UTF-8, UTF-16LE (little-endian), or UTF-16BE (big-endiant) formats.  ASCII uses 1 byte per character.  As a single byte is not enough space to store every different character, the same byte can represent different characters depending on the code page being used.  The UTF-8 format stores information using 1-4 bytes per character.  Due to backwards compatibility and size, UTF-8 is the most common format of text files currently in use.  UTF-16 uses 2 or 4 bytes per character. The endianness of a 16bit character indicates which order the two bytes are written.  According to RFC 2781 if no BOM is written at the beginning of a file, then big-endian is assumed.  However, Windows (and many programs running under Windows) uses little-endian encoding for LONGs.  Therefore, there are many UTF-16 files without BOM that use little-endian and programs that expect UTF-16LE format. If UTF is not specified, then the driver will check for a Bit Order Marker (BOM) at the start of the file to work out how to read and write data.  If there is no BOM and if there is a USTRING field in the file structure, the driver will read and write data using UTF-8.  If there is no BOM and no USTRING field, then the driver will read and write data using ASCII characters. **UTFBOM** **DRIVER('ASCII', '/UTFBOM = on | off' **) **[ UTFBOM" = ] SEND(file, 'UTFBOM [ = on | off ]' **) By default, the driver will not write a bit order marker if UTF-16 format is being written.  Otherwise no BOM is written.  You can force the driver to write a BOM for UTF-8 files by setting UTFBOM=ON.  You can force the driver to not write a BOM for UTF-16 files by setting UTFBOM=OFF.