You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

&<img src="../resources/images/opentocr.png" title="Open Contents list" border="0"&>
You are here:

4.4.6 Using a Trailing DEF_BREAK Command

"Trailing" break lines are typically used to insert level or break totals.
As an example of this, consider the following modifications to the RDML program used in the 4.4.5 Using a Leading DEF_BREAK Command to demonstrate "leading" break lines:
GROUP_BY    NAME(#ACCOUNT) 
            FIELDS(#COMP #DIV #DEPT #EXPEND #REVNU)
DEF_HEAD    NAME(#HEADING) FIELDS(#COMP) 
            TRIGGER_BY(#COMP *OVERFLOW)
DEF_BREAK   NAME(#BREAK01) FIELDS(#DIV) 
            TRIGGER_BY(#COMP #DIV)
            TYPE(*LEADING)
DEF_BREAK   NAME(#BREAK02) FIELDS(#DIV #DIVEXP #DIVRNU)
            TRIGGER_BY(#COMP #DIV) TYPE(*TRAILING)
DEF_LINE    NAME(#DETAILS) FIELDS(#DEPT #EXPEND #REVNU)
 
DEFINE      FIELD(#DIVEXP) REFFLD(#EXPEND) LABEL('Expend')
DEFINE      FIELD(#DIVRNU) REFFLD(#REVNU)  LABEL('Revenue')
 
SELECT      FIELDS(#ACCOUNT) FROM_FILE(ACCOUNTS)
KEEP_TOTAL  OF_FIELD(#EXPEND) IN_FIELD(#DIVEXP) 
            BY_FIELD(#COMP #DIV)
KEEP_TOTAL  OF_FIELD(#REVNU)  IN_FIELD(#DIVRNU) 
            BY_FIELD(#COMP #DIV)
PRINT       LINE(#DETAILS)
ENDSELECT
ENDPRINT
 
Note how the DEF_BREAK command is "triggered" by change of #COMP or #DIV. Note also the KEEP_TOTAL commands into the SELECT loop. These are used to automatically keep the company/division subtotals. Refer to the KEEP_XXXXX command series for more details of these commands and their usage.
The resulting report, using default design attributes, would probably look something like this:
 
       Company 01                                                
                                                                 
           Department   Expenditure   Revenue                    
       Division 1                                                
              ADM              400       576                     
              MKT              678        56                     
              SAL              123      6784                     
       Division 1 Expend 1201 Revenue 7416                       
       Division 2                                                
              ADM               46        52                     
              SAL              978       456                     
       Division 2 Expend 1024 Revenue  508                       
       Division 3                                                
              ACC              456       678                     
              SAL              123       679                     
       Division 3 Expend  579 Revenue 1357                       
 
 
 
       Company 02                                                
                                                                 
           Department   Expenditure   Revenue                    
       Division 1                                                
              ACC              843       400                     
              MKT               23         0                     
              SAL              876        10                     
       Division 1 Expend 1742 Revenue  410                       
       Division 2                                                
              ACC                0        43                     
       Division 2 Expend    0 Revenue   43                       
 
 
 
However, by using the Report Design Facility in the LANSA for i User Guide, the entire report layout could be modified in a few minutes to look like the examples following.
 
       Company 01                                                
                                                                 
           Department   Expenditure   Revenue                    
           =========== Division 1 ===========                    
              ADM              400       576                     
              MKT              678        56                     
              SAL              123      6784                     
                              ---      ---                     
                              1201      7416                     
                              ---      ---                     
                                                                 
           =========== Division 2 ===========                    
              ADM               46        52                     
              SAL              978       456                     
                              ---      ---                     
                              1024       508                     
                              ---      ---                     
                                                                 
           =========== Division 3 ===========                    
              ACC              456       678                     
              SAL              123       679                     
                              ---      ---                     
                               579      1357                     
                              ---      ---                     
                                                                 
 
 
 
       Company 02                                                
                                                                 
           Department   Expenditure   Revenue                    
                                                                 
           =========== Division 1 ===========                    
              ACC              843       400                     
              MKT               23         0                     
              SAL              876        10                     
                              ---      ---                     
                              1742       410                     
                              ---      ---                     
           =========== Division 2 ===========                    
              ACC                0        43                     
                              ---      ---                     
                                 0        43                     
                              ---      ---                     
                                                                 
 
 
&<img src="../resources/images/opentoc-dark.png" title="Open Contents List" border="0"&>

  • No labels