10. Using Report-Writer : Report Setup and Format : Data Positioning, Formatting, and Printing : The Print Format
Share this page                  
The Print Format
The appearance of the text or data in your report is controlled by the format specification. For instance, the c format indicates a character string format and the e format causes a value to be printed in scientific notation. You can also specify the format with a template such as $zz,zzz.nn, containing characters with special meanings, which define the way a value is to be printed.
The print format can be specified in the .print statement, or can be used in a .format statement to set a default print format for a column, as in the code fragment:
.format emp (c12), sal ('$zz,zzz,zzn.nn')
.print emp,sal
The results might look like this:
Jones      $  109,224.00
Smith      $  32,575.00
You can temporarily override a default column format with the .tformat statement to print the next value only in a different format. After the value is printed, the format returns to the original default type. This is useful for printing a dollar sign only once at the start of a page, for instance.
You can also override a default format by specifying the format as a parameter in the .print statement, as in this example:
.print salary ('zz,zzz,zzn.nn')
This code fragment causes Report-Writer to print salary values in the specified format, without the dollar sign, until it encounters another format or print statement for this column. For more information on print formats, see Format Specifications in the chapter "Report-Writer Expressions and Formats."
To indicate underlining of text or values, use the .underline and .nounderline statements. Any .print statements located between the .underline and .nounderline statements can produce underlined text. By default, the underline character is the underscore (_) for reports written to a file (reports written to the screen do not display underlining). You can change the default to any other character, using the .ulcharacter statement. All underline characters are printed on the line below the text, except for the underscore (_) character, which appears on the same line as the text. For more information on underlining, see Print Statements in the chapter "Report-Writer Statements