LANSA allows up to 8 reports to be produced at any one time. All report definition commands have a FOR_REPORT parameter associated with them. This parameter defaults to 1 and is used to indicate which report the line definition is associated with. Any number in the range 1 -> 8 can be specified for this parameter.

In addition, each of the 8 allowable reports has a "special" field associated with it called REPnPAGE which can be used to print the page number on the report. The "n" indicates the report number with which the page number field is associated.

So, to expand the previous example to include a page number, all that is required is the following:

     GROUP_BY    NAME(#ACCOUNT) FIELDS(#COMP #DIV #DEPT 
            #EXPEND #REVNU)
DEF_HEAD    NAME(#HEADING) FIELDS(#COMP #REP1PAGE)
            TRIGGER_BY(#COMP *OVERFLOW)
DEF_LINE    NAME(#DETAILS) FIELDS(#DIV #DEPT
            #EXPEND #REVNU)
 
SELECT      FIELDS(#ACCOUNT) FROM_FILE(ACCOUNTS)
PRINT       LINE(#DETAILS)
ENDSELECT
ENDPRINT

This would now produce a two  page report that looked something like the examples following.
 
       Company 01    Page    1                                   
       Division    Department   Expenditure   Revenue            
            1               ADM               400               576             
            1               MKT                678                 56             
            1               SAL                 123             6784             
            2               ADM                 46                 52             
            2               SAL                 978               456             
            3               ACC                456               678             
            3               SAL                 123               679             
  
       Company 02    Page    2                                                   
       Division    Department   Expenditure   Revenue            
            1               ACC                 843             400             
            1               MKT                  23                 0             
            1               SAL                 876               10             
            2               ACC                    0               43            

Note that REP1PAGE was used because, by default, report number 1 was used.

  • No labels