Was this helpful?
.Newline Statement--Advance to a New Line
The .newline statement writes out the current line and optionally advances a number of lines on the output page.
This statement has the following format:
.newline | .nl [nlines | expression]
The parameters for the .newline statement are as follows:
nlines
The number of lines to advance. If you are advancing to the next line, you can specify the .newline statement without the nlines parameter.
expression
A numeric expression which evaluates to the number of lines to advance from the current line. Precede all variables that are part of the expression with a dollar sign ($).
Description
The .newline statement must be specified to advance to a new line on the output page. Unlike some programming languages (for example, Fortran), a .print statement does not imply a new line at its completion. However, you can use the .println statement for this purpose. If you do not specify nlines or a numeric expression that evaluates to nlines, the default value of nlines is one (advance to the next line).
After Report-Writer executes .newline, it begins the next text output at the left margin, unless another text positioning statement overrides the default.
Report-Writer evaluates any expressions that are used as parameters to the .newline statement during runtime.
If the output of a new line reaches the end of the current page, or if there are fewer than nlines left on the current page, Report-Writer prints the page footer and page header, if they have been specified.
If the current line includes multi-line format strings, (Cn.w), the .newline statement advances to the bottom of the longest column printed during the formation of the line. For the Dictionary Example in the appendix “Report-Writer Report Examples,” the .newline statement in the footer for “word” causes an advance to the line following the end of the definition.
When you invoke column formatting mode, .newline causes an advance to the next line at the left margin, as determined by the .within statement. For more information on column formatting mode, see the .within/.endwithin statements.
Examples
1. Print out one line of text:
.print 'This is a line'
.newline
2. Print out a variable number of newlines:
.println name
.println address
.println city, state, zip
.nl $label_size - 3
Last modified date: 08/14/2024