ASCII:Driver Strings

Top  Previous  Next

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 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.

 

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.

 

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).