The PAGEBREAK command enables page ejection whenever the value for one or more specified columns changes.
where the following is true:
- A list of left to right ordered column numbers that indicates at which columns a page break is to occur. Multiple numbers must be separated with either a comma (preferably) or a space character.
The value of n can range from 1 to 2048.
If more than one column is specified, BTEQ ejects a page when the value of any specified column changes. If a column is not sorted and the column appears in the list of pagebreak column numbers, each line can appear on a separate page.
When using the FOLDLINE command with the PAGEBREAK command, set the pagebreak column number to break on the first folded line (as set with the FOLDLINE command), as in the following example:
.SET PAGEBREAK ON 1; .SET FOLDLINE ON 1, 2, 3;
If the pagebreak column on the PAGEBREAK command does not occur on the first folded line, BTEQ splits the rest of the row onto the next page.
If the PAGEBREAK command is not specified, the values are OFF and ALL by default. If the PAGEBREAK command is used and ON or OFF is not specified, BTEQ sets PAGEBREAK to ON ALL.
The PAGEBREAK setting only affects the output for Field Mode, not Record Mode, Indicator Mode, or Multipart Indicator Mode.
The PAGEBREAK command can be used in a Teradata SQL macro.
When using Mainframe BTEQ interactively on an intelligent terminal, each generated page break may also cause the screen to be cleared.
Example 1 – PAGEBREAK
The following example uses the PAGEGREAK command to begin a new page when the value of column 2 changes:
database workforce; .set defaults .set format on .set pagebreak on 2 .heading "Pagebreak on 2" select Name ,Sex from employee order by sex ; .defaults .format off .logoff .exit
BTEQ returns the following two-page response:
*** Query completed. 21 rows found. 2 columns returned. Pagebreak on 2 Name Sex ----------- --- Newman P F Smith T F Chin M F Moffit H F Regan R F Leidner P F Brangle B F Marston A F Phan A F
Pagebreak on 2 Name Sex ---------- --- Peterson J M Kemper R M Inglis C M Carter J M Aguilar J M Greene W M Watson L M Clements D M Omura H M Smith T M Russell S M Reed C M
Example 2 – PAGEBREAK instigated by a macro
The Example 1 PAGEBREAK command in a Teradata SQL macro appears as:
ECHO '.SET PAGEBREAK ON 2';