QSAM enhancement in COBOL for AIX, V4.1.1
Dan_Z 27000582KQ Visits (4132)
In IBM mainframes, the queued sequential access method (QSAM) is widely used as an access method for files, or more properly data sets. But it has not been implemented in AIX systems. In COBOL for AIX, V4.1.1, a new file system, QSAM file system, is introduced to improve the file input-output performance.
You can transfer QSAM files from the mainframe to AIX without the need to compile with -qhost. Simply use the FTP commands binary and quote site rdw.
An exception here: If the file contains EBCDIC character data, compile the AIX COBOL program with -qhost to read or write the character data as EBCDIC.
If the QSAM file already exists, you can upload the same file to the mainframe. If the file does not exist, you must create it using the correct data set attributes.
You can directly access and process QSAM files in AIX, pretty much the same as you do with them in mainframe systems. In QSAM files, records are placed one after another, according to entry order, thus, your program can process these files only sequentially, retrieving records using the READ statement in the same order as they are in the file. Each record is placed after the preceding record.
To process QSAM files in your program, use COBOL language statements that identify and describe the QSAM files in the ENVIRONMENT DIVISION and the DATA DIVISION. Then, process the records in these files in the PROCEDURE DIVISION.
After you create a record, you cannot change its length or its position in the file, and you cannot delete it.
Basically speaking, the QSAM file system is safe for use with threads. However, you must ensure that multiple threads do not access the level-01 records of the file at the same time. Multiple threads can perform operations on the same QSAM file, but you must add the pthread_cont_wait call or its equivalent to force all but one of the threads to wait for the file access to complete on the active thread.
The QSAM file system supports fixed, variable, and spanned records. Regarding the input-output limitations for QSAM files, please see below:
To sum up, the QSAM file system enables you to easily port files among AIX-based systems, Windows-based systems, and the mainframe. It enhances file input-output functionality and productivity.
For other enhancement in COBOL for AIX, V4.1.1, please visit our information center, and you will find a lot more ther
Special thanks to Kathleen Dowling for her advice and review of this article.