ILE COBOL Programmer's Guide

Naming a Transaction File

To use a TRANSACTION file in an 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 SEQUENTIAL
        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 or ICF 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 TRANSACTION file sequentially. You use the ACCESS MODE clause in the file control entry to tell your ILE COBOL program how to access the TRANSACTION file. You specify ACCESS MODE IS SEQUENTIAL to read or write to the TRANSACTION file in sequential order. If you do not specify the ACCESS MODE clause, sequential access is assumed.

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 your are looking for.

The control area data item will allow you to identify:


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