Naming Files Stored on Tape Devices

To use a sequential file that is stored on a tape device, in your ILE COBOL program, you must name the file through a file control entry in the FILE-CONTROL paragraph of the Environment Division. See the ILE COBOL for AS/400 Reference for a full description of the FILE-CONTROL paragraph.

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

FILE-CONTROL.
    SELECT sequential-file-name
        ASSIGN TO TAPEFILE-tape_device_name
        ORGANIZATION IS SEQUENTIAL.

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 file with a tape device. You must specify a device type of TAPEFILE in the ASSIGN clause to use a tape file.

Use ORGANIZATION IS SEQUENTIAL in the file control entry when you name a file that you will access through a tape file.