CLOSE PRINTER

#### Search Results

Search

# CLOSE PRINTER

`CLOSE PRINTER` |  | (logical-printer-name) |
(printer-number)

This document covers the following topics:

- CLOSE PRINTER Usage

- CLOSE PRINTER Syntax Description

- CLOSE PRINTER Example

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.

Related Statements: `AT END OF PAGE` | `AT TOP OF PAGE` |`DEFINE PRINTER` | `DISPLAY` | `EJECT` | `FORMAT` | `NEWPAGE` | `PRINT` | `SKIP` | `SUSPEND IDENTICAL SUPPRESS` | `WRITE` | `WRITE TITLE` | `WRITE TRAILER`

Belongs to Function Group: Creation of Output Reports

## CLOSE PRINTER Usage

The `CLOSE PRINTER` statement is used to close a specific printer. With this statement, you explicitly specify in a program that a printer is to be closed.

A printer is also closed automatically in one of the following cases:

- when a `DEFINE PRINTER` statement in which the same printer is defined again is executed;

- when command mode is reached.

## CLOSE PRINTER Syntax Description

Syntax Element | Description
--- | ---
`logical-printer-name` | Logical Printer Name: With the `logical-printer-name` you specify which printer is to be closed. The name is the same as in the corresponding `DEFINE PRINTER` statement in which you defined the printer. Naming conventions for the `logical-printer-name` are the same as for user-defined variables, see Naming Conventions for User-Defined Variables in Using Natural Studio.
`printer-number` | Printer Number: Alternatively to the `logical-printer-name`, you may define the `printer-number` to specify which printer is to be closed. The `printer-number` may be a number in the range from `0 - 31`. This is the number also to be used in a `DISPLAY` / `WRITE` or `DEFINE PRINTER` statement. Printer number 0 indicates the hardcopy printer.

## CLOSE PRINTER Example

    ** Example 'CLPEX1': CLOSE PRINTER
    ************************************************************************
    DEFINE DATA LOCAL
    1 EMP-VIEW VIEW OF EMPLOYEES
      2 PERSONNEL-ID
      2 NAME
      2 FIRST-NAME
      2 BIRTH
    *
    1 #I-NAME (A20)
    END-DEFINE
    *
    DEFINE PRINTER (PRT01=1)
    *
    REPEAT
      INPUT 'SELECT PERSON' #I-NAME
      IF #I-NAME = ' '
        STOP
      END-IF
      FIND EMP-VIEW WITH NAME = #I-NAME
        WRITE (PRT01) 'NAME         :' NAME ',' FIRST-NAME
               /      'PERSONNEL-ID :' PERSONNEL-ID
               /      'BIRTH        :' BIRTH (EM=YYYY-MM-DD)
      END-FIND
      /*
      CLOSE PRINTER (PRT01)
      /*
    END-REPEAT
    END

### On this page

- CLOSE PRINTER Usage
- CLOSE PRINTER Syntax Description
- CLOSE PRINTER Example