Version 6.3.13 for Windows
 —  Statements  —

EJECT

This document covers the following topics:

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

Belongs to Function Group: Creation of Output Reports


Function

The EJECT statement may be used to control page advance/page ejection.

Top of page

Syntax Description

Two different structures are possible for this statement.

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

EJECT - Syntax 1

EJECT

ON

[(rep)]
OFF

Syntax Element Description:

Syntax Element Description
EJECT ON/OFF (rep)
With Report Specification - Online and Batch Modes:
EJECT OFF (rep) Causes no page advance (except as specified with Syntax 2 of the EJECT statement) for the specified report to be executed.
EJECT ON (rep) Causes page advances for the specified report to be executed.
EJECT ON/OFF
Without Report Specification - Batch Mode only:

Without report notation (rep), EJECT ON/OFF may be used in batch mode to control page ejection between the output listings created during the execution of a program.

EJECT ON Causes Natural to generate a page eject between the source program listing, the output report and the message
EXECUTION COMPLETED
. This is the default setting.
EJECT OFF Causes Natural to suppress page breaks between the above output. EJECT OFF remains in effect until revoked with a subsequent EJECT ON statement.
(rep)
Report Specification:

The notation (rep) may be used to specify the identification of the report for which the EJECT statement is applicable.

A value in the range 0 - 31 or a logical name which has been assigned using the DEFINE PRINTER statement may be specified.

If (rep) is not specified, the EJECT statement will be applicable to the first report (Report 0).

For information on how to control the format of an output report created with Natural, see Controlling Data Output in the Programming Guide.

EJECT - Syntax 2

This form of the EJECT statement may be used to cause a page advance without a title or heading line being generated on the next page and without TOP/END PAGE processing.

EJECT [( rep )]

IF

LESS [THANoperand1  [LINES] [LEFT]

WHEN

Operand Definition Table:

Operand Possible Structure Possible Formats Referencing Permitted Dynamic Definition
operand1 C S         N P I                 yes no

Syntax Element Description:

Syntax Element Description
(rep)
Report Specification:

The notation (rep) may be used to specify the identification of the report for which the EJECT statement is applicable.

A value in the range 0 - 31 or a logical name which has been assigned using the DEFINE PRINTER statement may be specified.

If (rep) is not specified, the EJECT statement will be applicable to the first report (Report 0).

For information on how to control the format of an output report created with Natural, see Controlling Data Output in the Programming Guide.

IF LESS THAN operand1 LINES LEFT
IF LESS THAN ... LINES LEFT Clause:

A page advance will be performed only when the current line for the page is greater than the page size minus operand1. The value for operand1 may be specified as a numeric constant or as a variable.

Top of page

Processing

The execution of an EJECT statement does not cause any statements used with an AT TOP OF PAGE, AT END OF PAGE, WRITE TITLE or WRITE TRAILER statement to be executed. It does not affect system functions evaluated by DISPLAY GIVE SYSTEM FUNCTIONS.

EJECT causes a new physical page only. It causes the Natural system variable *LINE-COUNT to be set to 1 but has no effect on the setting of the Natural system variable *PAGE-NUMBER.

Top of page

Example

** Example 'EJTEX1': EJECT                                              
************************************************************************
DEFINE DATA LOCAL                                                       
1 EMPLOY-VIEW VIEW OF EMPLOYEES                                         
  2 CITY                                                                
  2 NAME                                                                
  2 JOB-TITLE                                                           
END-DEFINE                                                              
*                                                                       
FORMAT PS=15                                                            
LIMIT 9                                                                 
READ EMPLOY-VIEW BY CITY                                                
  /*                                                                    
  AT START OF DATA                                                      
    EJECT                                                               
    WRITE /// 20T '%' (29) /                                            
              20T '%%'                          47T '%%' /              
              20T '%%' 3X 'REPORT OF EMPLOYEES' 47T '%%' /              
              20T '%%' 3X '  SORTED BY CITY   ' 47T '%%' / 
              20T '%%'                          47T '%%' /
              20T '%' (29) /                              
    EJECT                                                 
  END-START                                               
  EJECT WHEN LESS THAN 3 LINES LEFT                       
  /*                                                      
  WRITE '*' (64)                                          
  DISPLAY NOTITLE NOHDR CITY NAME JOB-TITLE 5X *LINE-COUNT
  WRITE '*' (64)                                          
END-READ                                                  
END

Output of Program EJTEX1:

  
  
                     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%                    
                     %%                         %%
                     %%   REPORT OF EMPLOYEES   %%
                     %%     SORTED BY CITY      %%
                     %%                         %%
                     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  

 

After pressing ENTER:

****************************************************************              
AIKEN                SENKO                PROGRAMMER                         2
****************************************************************              
****************************************************************              
AIX EN OTHE          GODEFROY             COMPTABLE                          5
****************************************************************              
****************************************************************              
AJACCIO              CANALE               CONSULTANT                         8
****************************************************************              
****************************************************************              
ALBERTSLUND          PLOUG                KONTORASSISTENT                   11
****************************************************************              
****************************************************************              
ALBUQUERQUE          HAMMOND              SECRETARY                         14
****************************************************************             

After pressing ENTER:

****************************************************************              
ALBUQUERQUE          ROLLING              MANAGER                            2
****************************************************************              
****************************************************************              
ALBUQUERQUE          FREEMAN              MANAGER                            5
****************************************************************              
****************************************************************              
ALBUQUERQUE          LINCOLN              ANALYST                            8
****************************************************************              
****************************************************************              
ALFRETON             GOLDBERG             JUNIOR                            11
****************************************************************

Top of page