A_SYB_FAST_ACCESS is a configuration variable that is set from your COBOL program. Files opened while this variable is set to a nonzero value are optimized for forward sequential access. While the default value is 0 (OFF, FALSE, NO), this configuration variable can also take values of ON (TRUE, YES).
This option improves the READ NEXT performance in some cases. For example, testing the benchmark program iobench.cbl in three different ways, yielded the following results for the READ AND SKIP operation:
No FAST_ACCESS: | 72.76 seconds |
FAST_ACCESS, ROWCOUNT 0: | 148.88 seconds |
FAST_ACCESS, ROWCOUNT 10: | 8.09 seconds |
(10 is the perfect value for ROWCOUNT in this benchmark, because the program does a START, 10 READ NEXT operations, and then does it again.)
For certain reporting programs, this option can dramatically improve performance. However, please note the following restrictions. Files must be open INPUT or open IO with MASS-UPDATE. FAST_ACCESS gives a performance boost only when no locking is required. In files that allow locking, a record must be reread after being locked; this prevents an uninterrupted forward sequential traversal.
Files opened with FAST_ACCESS use a dedicated connection for reading from the file. Since connections are memory-intensive (both on the client and on the server), the number of files opened with FAST_ACCESS should be kept to a minimum. In the event that opening a connection fails, the file open still continues, but FAST_ACCESS mode is disabled, with the following message appearing in the trace file:
FAST_ACCESS mode not available.
Also, a new connection technically uses a new concurrent Sybase license from Sybase.
Files opened with FAST_ACCESS do not participate in transactions, and may even cause the runtime to hang if transactions are used, especially if the FAST_ACCESS file is updated within the transaction. We suggest that if you use transactions, you don’t use FAST_ACCESS. At the minimum, if you use transactions, we suggest that you use FAST_ACCESS only for files open INPUT.
Files opened with FAST_ACCESS cannot be read backwards. In other words, READ PREVIOUS does not work with FAST_ACCESS files. In fact, if you try to READ PREVIOUS on a file opened with FAST_ACCESS, you get an error 9D/20.
The ANSI standard states that READ NEXT after a READ will return the next record. Some applications depend on this, and some applications just want to read dynamically from a file, and don’t use the positioning facility. Because of this ambiguity, files that are open with FAST_ACCESS cannot be READ dynamically. If you try to READ on a file open with FAST_ACCESS, you get an error 9D/20.
There are no restrictions on WRITE, REWRITE, and DELETE. However, these operations use the cursor-based connection, not the dedicated connection. This is the reason transactions may not complete.