Accessing ReportWriter by external subroutine interface
The subroutines and functions in the ReportWriter external subroutine interface (sometimes referred to as the XCALL interface) enable you to call one report or the entire ReportWriter application from your UI Toolkit application. This method is the most seamless way to integrate ReportWriter with your application.
The routines in the XCALL interface are contained in RPTLIB:synrpt.elb (SYNRPT.EXE on OpenVMS). To use the ReportWriter subroutine library, you must do the following:
- Include the file RPTLIB:reports.def in your calling program using the .INCLUDE statement.
- Call U_START with one header line defined. If you’re using %RW_REPORTS, one footer line must be defined as well; the footer is used to display information during schema loading and generating. (The callable ReportWriter uses the default message library. You can override the default by passing the text_lib argument when you call U_START.)
- Call %RW_INIT to initialize ReportWriter.
- On Windows and UNIX, link RPSLIB:ddlib.elb and RPTLIB:synrpt.elb with your program. (or open them using OPENELB). Or, on OpenVMS, link SYNRPT.EXE with your program.

For OpenVMS, if you make calls from the ReportWriter external subroutine interface routines to user-defined routines in a shared image, you must open the shared image for the user-defined routines with OPENELB before calling %RW_INIT.
If you need to overload any routines in ReportWriter, see Overloading a user-overloadable routine in ReportWriter.
|
|
If the application calling ReportWriter uses a proportional font as the global font, this proportional font will remain in effect. We recommend that you change the global font to a fixed font with %U_WNDFONT before calling ReportWriter. |
Limitations of the external subroutine interface
- Your screen size must be 80 x 24.
- The RW_ routines can be called only from within a UI Toolkit program, and both Synergy DBL and Toolkit must be version 6.1 or higher.
- If the RPTDATE environment variable is set, it will affect the UI Toolkit global variable g_date_order, thereby affecting your Toolkit application.
Examples
The following program calls up a session in ReportWriter and enables the user to edit reports, generate reports, and so forth.
main
record
.include "WND:tools.def" ;Include the Toolkit definitions
.include "RPTLIB:reports.def" ;Include the ReportWriter definitions
proc
xcall u_start(,1,1) ;Start Toolkit with 1 header & 1 footer
; Initialize the reports file and the Repository files
if (.not.%rw_init(,, "CUST1:reports.rpt", "CUST1:rpsmain.ism",
& "CUST1:rpstext.ism")) then
begin
if (%rw_reports) ;Run ReportWriter interactively
xcall rw_errmsg ;Generate error message
xcall rw_close ;Close the ReportWriter files
end
else
xcall rw_errmsg ;Generate error message
xcall u_finish
endmain
The following program generates one report to a file and another to the printer.
main
record
.include "WND:tools.def" ;Include the Toolkit definitions
.include "RPTLIB:reports.def" ;Include the ReportWriter definitions
proc
xcall u_start(,1) ;Start Toolkit with one header
; Initialize the reports file and the Repository files
if (%rw_init(,, "CUST1:reports.rpt", "CUST1:rpsmain.ism",
& "CUST1:rpstext.ism"))
begin
xcall rw_errmsg
xcall u_finish
stop
end
; Generate the report "FIRST" to the file "HOME:first.ddf"
if (%rw_genrpt("FIRST", RO_FILE, "HOME:first.ddf"))
xcall rw_errmsg
; Generate the report "SECOND" to the printer
if (%rw_genrpt("SECOND", RO_PRINT))
xcall rw_errmsg
xcall rw_close ;Close the ReportWriter files
xcall u_finish
endmain
