Version 6.3.13 for UNIX
 —  Statements  —

NEWPAGE

 

EVEN [IF] TOP [OF] [PAGE]

NEWPAGE [(rep)]

IF

LESS [THAN] operand1 [LINES] [LEFT]
  WHEN
  [[WITH] TITLE title-definition]     

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 | CLOSE PRINTER | DEFINE PRINTER | DISPLAY | EJECT | FORMAT | PRINT | SKIP | SUSPEND IDENTICAL SUPPRESS | WRITE | WRITE TITLE | WRITE TRAILER

Belongs to Function Group: Creation of Output Reports


Function

The NEWPAGE statement is used to cause an advance to a new page. NEWPAGE also causes any AT END OF PAGE and WRITE TRAILER statements to be executed. A default title containing the date, time of day, and page number will appear on each new page unless a WRITE TITLE, WRITE NOTITLE, or DISPLAY NOTITLE statement is specified to define specific title processing.

Notes:

  1. The advance to a new page is not performed at the time when the NEWPAGE statement is executed. It is performed only when a subsequent statement which produces output is executed.
  2. If the NEWPAGE statement is not used, page advance is controlled automatically based on the Natural profile/session parameter PS (Page Size for Natural Reports).

Top of page

Syntax Description

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 NEWPAGE 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 NEWPAGE 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).

EVEN IF TOP OF PAGE
EVEN IF TOP OF PAGE Option:

This option is used to cause a new page (with corresponding AT TOP OF PAGE and page title processing) to be generated, even if a new page was initiated immediately before the NEWPAGE statement was encountered.

WHEN LESS THAN operand1 LINES LEFT
WHEN LESS THAN ... LINES LEFT Option:

This option is used to cause a new page to be generated when there are less than operand1 lines left on the current page (current line count compared with value for the Natural profile/session parameter PS).

WITH TITLE title-definition
WITH TITLE Option:

This option can be used to specify a title which is to be written to the new page generated.

The title-definition is specified using the same syntax as described for the WRITE TITLE statement, except that the SKIP clause is not allowed in a NEWPAGE WITH TITLE title-definition statement.

Top of page

Example

** Example 'NWPEX1': NEWPAGE                                            
************************************************************************
DEFINE DATA LOCAL                                                       
1 EMPLOY-VIEW VIEW OF EMPLOYEES                                         
  2 CITY                                                                
  2 NAME                                                                
  2 SALARY    (1)                                                       
  2 CURR-CODE (1)                                                       
END-DEFINE                                                              
*                                                                       
LIMIT 15                                                                
READ EMPLOY-VIEW BY CITY FROM 'DENVER'                                  
  DISPLAY CITY (IS=ON) NAME SALARY (1) CURR-CODE (1)                    
  AT BREAK OF CITY                                                      
    SKIP 1                                                              
    /*                                                                  
    NEWPAGE WHEN LESS THAN 10 LINES LEFT                        
    WRITE '****************************************'                    
      /   'SUMMARY FOR ' OLD(CITY)                                      
      /   '****************************************'
      /   '****************************************'
      /   'SUM OF SALARIES:' SUM(SALARY(1))         
      /   'AVG OF SALARIES:' AVER(SALARY(1))        
      /   '****************************************'
    NEWPAGE                                
    /*                                              
  END-BREAK                                         
END-READ                                            
END                                                

Output of Program NWPEX1 - Page 1:

Page      1                                                  05-01-18  10:01:45
                                                                               
        CITY                 NAME           ANNUAL   CURRENCY                  
                                            SALARY     CODE                    
-------------------- -------------------- ---------- --------                  
                                                                               
DENVER               TANIMOTO                  33000 USD                       
                     MEYER                     50000 USD                       
                                                                               
****************************************                                       
SUMMARY FOR  DENVER                                                            
****************************************                                       
****************************************                                       
SUM OF SALARIES:      83000                                                    
AVG OF SALARIES:      41500                                                    
****************************************                                       

Output of Program NWPEX1 - Page 2:

Page      2                                                  05-01-18  10:01:45
                                                                               
        CITY                 NAME           ANNUAL   CURRENCY                  
                                            SALARY     CODE                    
-------------------- -------------------- ---------- --------                  
                                                                               
DERBY                DEAKIN                     8750 UKL                       
                     GARFIELD                   6750 UKL                       
                     MUNN                       8800 UKL                       
                     MUNN                       5650 UKL                       
                     GREBBY                     9550 UKL                       
                     WHITT                      8650 UKL                       
                     PONSONBY                   5500 UKL                       
                     MAGUIRE                    4150 UKL                       
                     HEYWOOD                    3900 UKL                       
                     BRYDEN                     6750 UKL                       
                     SMITH                     39000 UKL                       
                     CONQUEST                  45000 UKL                       
                     ACHIESON                  11300 UKL                       
                                                                               
****************************************                                       
SUMMARY FOR  DERBY                                                             
****************************************                                      

Output of Program NWPEX1 - Page 3:

-------------------- -------------------- ---------- --------                 
                                                                              
DERBY                DEAKIN                     8750 UKL                       
                     GARFIELD                   6750 UKL                      
                     MUNN                       8800 UKL                      
                     MUNN                       5650 UKL                      
                     GREBBY                     9550 UKL                      
                     WHITT                      8650 UKL                      
                     PONSONBY                   5500 UKL                      
                     MAGUIRE                    4150 UKL                      
                     HEYWOOD                    3900 UKL                      
                     BRYDEN                     6750 UKL                      
                     SMITH                     39000 UKL                      
                     CONQUEST                  45000 UKL                      
                     ACHIESON                  11300 UKL                      
                                                                              
****************************************                                      
SUMMARY FOR  DERBY                                                            
****************************************                                      
****************************************                                      
SUM OF SALARIES:     163750                                                   
AVG OF SALARIES:      12596                                                   
**************************************** 

Top of page