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:

If you need to overload any routines in ReportWriter, see Overloading a user‑overloadable routine in ReportWriter.

Tip

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

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