ILE COBOL Programmer's Guide


Using Subfile Transaction Files

A subfile is a group of records that are read from or written to a display device. The program processes one record at a time, but the operating system and the workstation send and receive blocks of records. If more records are transmitted than can be shown on the display at one time, the workstation operator can page through the block of records without returning control to the program.

Subfiles offer a convenient way of reading and writing large numbers of similar records to and from displays. Subfiles are display files whose records can be accessed sequentially or randomly by relative key value.

For example, suppose you want to display all customers who have spent more than $5000 with your company over the last year. You can do a query of your database and get the names of all these customers, and place them in a special file (the subfile), by performing WRITE SUBFILE operations on the subfile. When you have done this, you can write the entire contents of the subfile to the display by performing a WRITE operation on the subfile control record. Then you can read the customer list as modified by the user using a READ operation on the subfile control record, and subsequently retrieve the individual records from the subfile using READ SUBFILE operations.

Subfiles can be specified in the DDS for a display file to allow you to handle multiple records of the same type on a display. See Figure 140 for an example of a subfile display.

Records formats to be included in a subfile are specified in the DDS for the file. The number of records that can be contained in a subfile must also be specified in the DDS. One file can contain more than one subfile; however, only twelve subfiles can be active concurrently for a device.


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