12. Report-Writer Statements : Column and Block Statements : .Tformat Statement—Change Format of Column Output Temporarily : Examples
 
Share this page                  
Examples
1. Print out the value of a break column only when it changes. The acct num column is a delimited identifier.
/*
** In the detail section, blank out the
** account number. When the account number
** changes, print it.
*/
.header report
        .format "acct num"(b10),
         transact('$$$,$$$,$$$.nn')
.heading "acct num"
        .tformat "acct num"(c10)
.detail
        .print "acct num"
        .tab +2
        .print transact
        .newline
This is the sample report output for the above specification:
01-34567-8       $345.21
                  $14.10
               $1,143.23
04-35999-2         $1.99
                 $177.00
2. Print dollar sign at top of page only. The variable thous_dollar evaluates to '$$$,$$n' and thous evaluates to 'ZZZ,ZZn':
.declare thous_dollar = c8 with value '\'$$$,$$n\'',
            thous_dollar = c8 with value '\'zzz,zzn\''
.header page
            .print 'Top of page' .nl 2,
            .tformat salary($thous_dollar)
.detail
            .print name(c14), salary($thous)
             ...
This is the sample report output for the above specification:
Top of page
Jones, A.   $23,145
Jones, B.    16,145
Jost, C.     32,143