ILE COBOL Programmer's Guide

Naming Printer Files

To use a printer file in an ILE COBOL program, you must name the printer file through a file control entry in the FILE-CONTROL paragraph of the Environment Division. See the WebSphere Development Studio: ILE COBOL Reference for a full description of the FILE-CONTROL paragraph. You can use more than one printer file in an ILE COBOL program but each printer file must have a unique name.

Printer files can be program-described files or externally-described files.

You name a program-described printer file in the FILE-CONTROL paragraph as follows:

FILE-CONTROL.
    SELECT printer-file-name
        ASSIGN TO PRINTER-printer_device_name
        ORGANIZATION IS SEQUENTIAL.

You name an externally described printer file in the FILE-CONTROL paragraph as follows:

FILE-CONTROL.
    SELECT printer-file-name
        ASSIGN TO FORMATFILE-printer_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 printer file with a printer device. You must specify a device type of PRINTER in the ASSIGN clause to use a program-described printer file. To use an externally-described printer file, you must specify a device type of FORMATFILE in the ASSIGN clause.

Use ORGANIZATION IS SEQUENTIAL in the file control entry when you name a printer file.


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