Natural for Mainframes Version 8.2.5 for Mainframes
 —  Statements  —

CLOSE PRINTER

CLOSE PRINTER

(logical-printer-name)

(printer-number)

This document covers the following topics:

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


Function

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 printer is closed, the profile associated with the printer (see PROFILE clause of the DEFINE PRINTER statement) is deleted, that is, any further writes to the printer are affected.

Top of page

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.

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.

Top of page

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

Top of page