Home | Previous Page | Next Page   Using the Optical Subsystem > Reading TEXT and BYTE Data Columns from an Optical Platter >

Managing Volumes on the Optical Drives

Your application can perform the following operations to manage the volumes on the optical drives and, consequently, affect the performance of the application:

Reserving an Optical Volume

You can use the RESERVE statement to keep a required optical volume mounted on an optical drive while you periodically access it during a set of operations. The RESERVE statement implies a request to mount the specified volume if it is not currently mounted.

When multiple users access the optical platters simultaneously, you might need to reserve a volume if your application accesses it consecutively. Otherwise, individual accesses are interleaved with requests from other applications so that each access by your application could require the volume to be remounted on the optical drive. Not reserving a volume can result in an unsatisfactory response time from the optical-storage subsystem.

For each RESERVE request, the optical-storage subsystem adds the value 1 to a reserve counter for that volume. If the value of the reserve counter is greater than zero, you cannot remove the volume. You can issue multiple RESERVE requests for a volume, but you must release each one before you can remove the volume from the drive. When you finish accessing the volume, use the RELEASE statement to release it. For details, see Releasing a Reserved Optical Volume.

If all the optical volumes mounted on the optical drives are reserved when you issue a RESERVE statement, the optical-storage subsystem waits for the number of seconds that the SET MOUNTING TIMEOUT statement specifies or for the default time-out period. For more information, see the RESERVE (+, DB-Access, ESQL/C) and SET MOUNTING TIMEOUT (+, DB-Access, ESQL/C) statements in SQL for the Optical Subsystem.

You can use a SELECT statement to obtain the family name and volume number of the volume that you want to reserve. The FAMILY() and VOLUME() function expressions return the family name and volume number, respectively. In the following example, the SELECT statement uses the FAMILY() and VOLUME() functions to identify the volume that contains pictures of stock for manufacturer HRO. The RESERVE statement then reserves the volume, using the family name and volume number that the SELECT statement returned.

SELECT FAMILY(cat_picture), VOLUME(cat_picture)
   FROM catalog
   WHERE manu_code = 'HRO'
...
RESERVE 'catalog_1991' 013

Releasing a Reserved Optical Volume

You must release each RESERVE request for an optical volume with the RELEASE statement. The RELEASE statement cancels the latest RESERVE request for an optical volume by subtracting the value one (1) from the reserve counter for that volume. When the reserve counter is reduced to zero, you can remove the optical volume from the drive. The following statement releases volume 013 of the optical family:

RELEASE 'catalog_1991' 013

An error is returned if you issue a RELEASE statement for a volume that is not reserved.

The vendor of your optical-storage subsystem supplies a utility that you can also use to release a volume. The optical-storage subsystem administrator must release a volume with this utility when a program terminates prior to releasing a reserved volume.

Setting the Mounting Time-Out

The SET MOUNTING TIMEOUT statement controls the amount of time that your application waits for a volume to be mounted before it abandons the request. When you request access to an optical volume, the optical-storage subsystem cannot mount it immediately if all the optical drives are busy processing requests from other users. In addition, one or more drives might be reserved at the time of your request. If a SET MOUNTING TIMEOUT statement is not executed, the optical-storage subsystem times out after five minutes (300 seconds) if it cannot mount the requested volume.

The SET MOUNTING TIMEOUT statement provides the following options for setting the time-out period:

If it is mandatory that a particular optical volume be mounted before an application continues, it might be appropriate for the application to wait an indefinite amount of time for that volume to mount. If so, the following statement has that effect:

SET MOUNTING TIMEOUT TO WAIT

If multiple users and multiple applications are competing for the optical drives, you might not always want your application to wait for a volume that is not currently mounted. You might set the mounting time-out to NOT WAIT. For example, if your application retrieves data about an item of merchandise and the TEXT or BYTE data on an optical platter is desirable but not required, the application might not display the data if it is not immediately available.

The following example causes a request for a volume to return immediately if the volume is not currently mounted:

SET MOUNTING TIMEOUT TO NOT WAIT

Normally, you should set the time-out period to the number of seconds that is appropriate for the application to wait for a volume. The following statement sets the mounting time-out period to 30 seconds. If the volume is not mounted within 30 seconds, the process times out and control is returned to the application.

SET MOUNTING TIMEOUT TO 30

Set the mounting time-out period to zero seconds to cause the process to wait for a volume to be mounted only if a drive is currently available, as follows:

SET MOUNTING TIMEOUT TO 0

When you specify a time-out period of zero, the optical-storage subsystem waits for a volume to mount if a drive is currently available for it. When you specify the NOT WAIT option, the optical-storage subsystem does not wait for the requested volume to mount if it is not currently available on a drive.

For more information, see SET MOUNTING TIMEOUT (+, DB-Access, ESQL/C).

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]