Optical support provides Control File System (QHFCTLFS) functions to perform unique operations for the optical file system.
The functions described below are optical specific functions that are not otherwise available through the HFS APIs. Different functions are available for directly attached and LAN-attached optical devices.
The following functions are available for directly attached optical devices.
Use the Control File System program to save a held optical file. A process must be allowed read access to a held optical file to save it.
The following is the syntax for the input buffer for the QHFCTLFS program:
'SAV' + '/' + held-file-path + '//' + destination-file-path
This function is also available using an option on the Work with Held Optical File (WRKHLDOPTF) display. However, unlike the save option on the Work with Held Optical File (WRKHLDOPTF) display, the save held optical file function of the control file system API does not automatically release a held file after it is saved. Therefore, an explicit release held optical file request is needed afterward.
Use the Control File System program to clear the held status of a file and release the optical file system from its obligation to write to the optical disk. A process must be allowed read and write access to a held file in order to release it; this means that no locks may currently be imposed on the file by other active jobs.
'RLS' + '/' + held-file-path
This function is also available using an option on the Work Held Optical File (WRKHLDOPTF) display.
The Control file system program can be used to do a sector reading of optical media. The sector read function is useful if the application knows precisely where data is stored on optical media. Sector read functions can be accomplished without opening and closing files and independently of all HFS APIs. Multiple sectors may be read at one time.
SRD/VOL/volume_name/starting sector/number of sectors
SRD/DEV/device_name/starting sector/number of sectors
Both return the range of sectors requested by the user. Sectors can be requested from an optical volume or optical device. For example, if an application wanted to read five sectors of optical volume VOL01 beginning at sector 1000, the following is requested: SRD/VOL/VOL01/1000/5
Use the Control File System program to retrieve information about a particular volume.
RTV/VOL/volume_name
The format of the information returned in the output buffer is identical to the output file structure for volume attributes (QAMODVA).
You can use the Control File System (QHFCTLFS) HFS API to read a block of data from a file directly into your output buffer. This function improves performance when reading an entire file sequentially or when reading large blocks of data. The optical file system will not copy or cache the data as it does through normal Open, Read, and Close Stream File HFS APIs. When doing random read operations to a file, the Open, Read, and Close Steam File option may still provide the best performance.
'GET' + '/' + entire path + '//' + bytes to read + '/' + file offset
The number of bytes read is returned in the Length of data returned parameter. In the above example if FILE.XXX is only 50 KB in size, 51200 will be returned in the field. Therefore, it is not necessary to know the file size prior to issuing this request. Likewise, if 15728640 is returned in the Length of data returned parameter, the file is at least 15 MB in size. More read operations may be necessary to retrieve all the data.
It is not required that the number of bytes to read be a multiple of 4096. However, if the number is not a multiple of 4096, data may be read into the output buffer beyond the number of bytes requested. This is because the device does I/O in blocks of 4096 bytes. Therefore, reading data in multiples of 4096 bytes is advised in order to avoid this problem.
The following table shows some common application errors that may occur using this API.
Message | Error |
---|---|
OPT1812 with 6030 as unexpected return code | File offset is beyond the end of file. |
OPT1812 with A950 as unexpected return code | Output buffer is not 512-byte aligned. |
OPT1860 | Bytes to read is greater than the buffer size. |
OPT1812 with C060 as unexpected return code | Attempted to read more than 16␠384␠000 bytes. |
OPT1812 with C061 as unexpected return code | File offset is not a 4096 multiple. |
CPF1F48 | Input buffer is not valid. Verify the syntax. |
Use the Control File System program to retrieve information about a particular volume or to update the internal list of available volumes on a LAN.
UPD/VOL/volume_name
Use the Control File System program to retrieve information about a particular volume.
RTV/VOL/volume_name
The format of the information returned in the output buffer is identical to the output file structure for volume attributes (QAMODVA).
The system uses format QAMODVA for volumes in all optical device types. While the format is the same, not all fields contain a value for LAN volumes.
Use the Control File System program to retrieve a list of files and subdirectories for a particular directory.
RTV/DIR/volume_name/directory_name
The output buffer must be at least 31 KB long.