ILE COBOL Programmer's Guide

Naming a Subfile Transaction File

To use a subfile TRANSACTION file in your ILE COBOL program, you must name the file through a file control entry in the FILE-CONTROL paragraph. See the WebSphere Development Studio: ILE COBOL Reference for a full description of the FILE-CONTROL paragraph.

You name the TRANSACTION file in the FILE-CONTROL paragraph as follows:

FILE-CONTROL.
    SELECT transaction-file-name
        ASSIGN TO WORKSTATION-display_file_name
        ORGANIZATION IS TRANSACTION
        ACCESS MODE IS DYNAMIC
               RELATIVE KEY IS relative-key-data-item
        CONTROL AREA IS control-area-data-item.

You use the SELECT clause to choose a file. This file must be identified by a FD entry in the Data Division.

You use the ASSIGN clause to associate the TRANSACTION file with a display file. You must specify a device type of WORKSTATION in the ASSIGN clause to use TRANSACTION files. If you want to use a separate indicator area for this TRANSACTION file, you need to include the -SI attribute with the ASSIGN clause. See Using Indicators with Transaction Files for further details of how to use the separate indicator area.

You must specify ORGANIZATION IS TRANSACTION in the file control entry in order to use a TRANSACTION file. This clause tells your ILE COBOL program that it will be interacting with a workstation user or another system.

You access a subfile TRANSACTION file dynamically. Dynamic access allows you to read or write records to the file sequentially or randomly, depending on the form of the specific input-output request. Subfiles are the only TRANSACTION files that can be accessed randomly. You use the ACCESS MODE clause in the file control entry to tell your ILE COBOL program how to access the TRANSACTION file. You must specify ACCESS MODE IS DYNAMIC to read or write to the subfile TRANSACTION file.

When using subfiles, you must provide a relative key. Use the RELATIVE KEY clause to identify the relative key data item. The relative key data item specifies the relative record number for a specific record in a subfile.

If you want feedback on the status of an input/output request that refers to a TRANSACTION file, you define a status key data item in the file control entry using the FILE STATUS clause. When you specify the FILE STATUS clause, the system moves a value into the status key data item after each input-output request that explicitly or implicitly refers to the TRANSACTION file. The value indicates the status of the execution of the I-O statement.

You can obtain specific device-dependent and system dependent information that is used to control input-output operations for TRANSACTION files by identifying a control area data item using the CONTROL-AREA clause. You can define the data item specified by the CONTROL-AREA clause in the LINKAGE SECTION or WORKING-STORAGE SECTION with the following format:

01  control-area-data-item.
    05  function-key          PIC X(2).
    05  device-name           PIC X(10).
    05  record-format         PIC X(10).

The control area can be 2, 12, or 22 bytes long. Thus, you can specify only the first 05-level element, the first two 05-level elements, or all three 05-level elements, depending of the type of information you are looking for.

The control area data item will allow you to identify:


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