.Pagewidth Statement--Set Page Width
The .pagewidth statement sets a new default page width in number of characters or positions per line.
This statement has the following format:
.pagewidth | .pw width
The parameters for the .pagewidth statement are listed below:
width
The number of characters per line (n characters). The default is 132 characters per line if the report is written to a file, and the width of your screen if the report is written to the screen.
The width can be expressed as a variable.
$widthvariable
Variable whose value is the report page width (n characters). Precede the variable with a dollar sign ($).
Description
The .pagewidth statement controls where line breaks occur. With the .pagewidth statement, you specify total number of characters specified per line through a constant or variable.
If you specify a variable for width, Report-Writer evaluates the variable during the loading of the report specification, before retrieving any data.
The value used in the .pagewidth statement must be greater than or equal to the width determined from the .leftmargin and .rightmargin values. The .rightmargin value must be greater than the .leftmargin value. If you are using a .position statement in your specification, its value must be less than the value of .pagewidth.
While running the report, Report-Writer checks to see if the total count of characters goes beyond the .pagewidth value. If so, an error message appears on the screen, or if possible, the report executes within the assigned width.
You can override this statement at runtime by specifying the ‑l flag on the report command line. Otherwise, the report reflects the .pagewidth setting. If there is no .pagewidth statement and the ‑l flag is not specified, Report-Writer uses 132 as the default width, and tries to execute the report within that width. If this is not possible, an error message appears on the screen.
All reports created and saved through RBF automatically generate a page width comment that RBF uses to set the page width when you run the report. Delete the page width comment from an archived RBF report specification and add an explicit .pagewidth statement instead. If you fail to delete the page width comment when specifying the page width explicitly, Report-Writer can truncate the text.
Examples
1. Set a new page width for a printer.
.pw 132
2. Set page width for a screen where the width is the value of variable term_width.
.pw $term_width
Last modified date: 01/30/2023