Modifying ReportWriter initialization
The RW_INITBLD_METHOD subroutine was designed to be used in conjunction with one or more of the other user-overloadable subroutines. You can use it to initialize data structures that will subsequently be used by other routines, such as RPS_FILNAM_METHOD or RW_ENV_METHOD.
RW_INITBLD_METHOD
subroutine RW_INITBLD_METHOD a_rep_name ,a ;Current report name (a40) a_files ,n ;Number of files used in report (d2) a_filenames ,a ;Array of file definition names (a30) a_structs ,a ;Array of corresponding structure names (a30) a_quit ,n ;Returned with true if report building phase and ; subsequent report generation should be aborted (d1)
Discussion
The report name, number of files, filenames, and structure names are passed to RW_INITBLD_METHOD so you can do any initialization required for specific reports or for specific files or structures used in a report. For example, if structure A contains aged amounts, RW_INITBLD_METHOD can check to see if that structure is used in the current report, and if so, you can update aging, if necessary. Another example is if an intermediate file is required; use of that file definition in a report can trigger RW_INITBLD_METHOD to build the file.
If the processing time required for your version of this routine is significant, you may want to check for user keyboard input and return the a_quit argument set to true if the user wants to interrupt processing. The version of this routine linked with your original ReportWriter distribution is a “dummy” routine; it simply returns.
Example
Here’s a sample RW_INITBLD_METHOD subroutine. Without this routine, RPS_FILNAM_METHOD would only ask for the information on the first call that required it, for as long as you stayed in ReportWriter. This subroutine makes it ask for the information whenever a report is run.
subroutine rw_initbld_method ; ;Description: Initialize user-supplied data structures before report ; generation. ;Arguments: ; a_report ,a ;Report name a_nmfils ,n ;Number of files used a_filnam ,a ;Array of filenames a_strnam ,a ;Array of structure names a_quit ,n ;Returned true to abort report gen. .include "UTS:ddusr.def" ;(See sample RPS_FILNAM_METHOD routine.) proc usrdd_needinfo = 1 ;This will cause the first call to ; RPS_FILNAM_METHOD, which requires data ; location and client number, to ask ; for that information, while subsequent ; calls will inherit the information. xreturn endsubroutine