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

Compare with Current View Page History

« Previous Version 2 Current »

The original example RDML program that printed the ACCOUNTS file with the company number in the page heading looked like this:
GROUP_BY    NAME(#ACCOUNT) 
            FIELDS(#COMP #DIV #DEPT #EXPEND #REVNU)
DEF_HEAD    NAME(#HEADING) 
            FIELDS(#COMP) TRIGGER_BY(#COMP *OVERFLOW)
DEF_LINE    NAME(#DETAILS) 
            FIELDS(#DIV #DEPT #EXPEND #REVNU)
 
SELECT      FIELDS(#ACCOUNT) FROM_FILE(ACCOUNTS)
PRINT       LINE(#DETAILS)
ENDSELECT
ENDPRINT
 
which produced a 2 page report like this:
 
       Company 01                                                
                                                                 
       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                                                
                                                                 
       Division    Department   Expenditure   Revenue            
          1           ACC              843       400             
          1           MKT               23         0             
          1           SAL              876        10             
          2           ACC                0        43             
 
 
 
The layout of this report can be easily improved by using a "leading" break line to "cluster" the divisions together. This could be done like this:
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_LINE    NAME(#DETAILS) FIELDS(#DEPT #EXPEND #REVNU)
 
SELECT      FIELDS(#ACCOUNT) FROM_FILE(ACCOUNTS)
PRINT       LINE(#DETAILS)
ENDSELECT
ENDPRINT
 
Note how the DEF_BREAK command indicates the field #DIV is to be printed and it is to be "triggered" by change of #COMP or change of #DIV.
The resulting report would probably look something like this:
 
       Company 01                                                
                                                                 
           Department   Expenditure   Revenue                    
       Division 1                                                
              ADM              400       576                     
              MKT              678        56                     
              SAL              123      6784                     
       Division 2                                                
              ADM               46        52                     
              SAL              978       456                     
       Division 3                                                
              ACC              456       678                     
              SAL              123       679                     
 
 
 
 
       Company 02                                                
                                                                 
           Department   Expenditure   Revenue                    
       Division 1                                                
              ACC              843       400                     
              MKT               23         0                     
              SAL              876        10                     
       Division 2                                                
              ACC                0        43                     
 
 
 

  • No labels