A schematic diagram of Genero Report Writer for Cobol


A schematic diagram illustrating the distributed nature of Genero Report Writer for Cobol


Detailed feature overview

Customizing the presentation

  • Easy to use, WYSIWYG editor,
  • Schema based, type-safe editing
  • Avoids run-time errors caused by failing string conversions,
  • Compile-time impact analysis,
  • Lists issues in a report design caused by changes to the schema. This feature is of  particular importance for end users that have customized or created their own report designs. Upon receipt of a software update they can check their reports against the new schemas shipped with the update to detect and fix any issues before making the update operational,
  • Batch upgrades.  A command line tool is available to perform batch upgrades of report design files from one version of the software to another,
  • Batch updates and software-assisted issue resolution in the report designer. A command line tool is available to update the report design files in cases where the schemas may have changed (e.g. during an application update and the end user’s site). The update algorithm is optimal in the sense that it finds a minimal patch so that in the general case no manual intervention is required. In the rare case that parts of a schema have been removed or renamed users are assisted in resolving the issues in form of issue list that is persistently stored with the report design file until all issues have been resolved.

Data production and presentation separated

  • Data stream and document formatting are separate,
  • Multiple presentations per data source,
  • Defines a clear interface between application vendors who are responsible for providing the data sources and their associated schemas and users who customize or add presentations to them.

Structured data source

  • Process level interface as opposed to accessing the database directly,
  • Less sensitive to database changes. Process level messages shield users from details of the database and allow application vendors to change the database schema without breaking customized or self made reports,
  • Prevents replication of business rules in report designs. By accessing “cooked” data, users are shielded from the need to know details on how things are stored in the database. It avoids the replication of central business logic in the report designs (e.g. rules about which address is actually used as a billing address of an invoice when there are multiple choices in the database),
  • Support for structured data as opposed to flat record sets returned by SQL queries. The data behind sophisticated reports such as invoices or delivery can rarely be represented as a flat list of records. The natural representation is a structured message allowing for arbitrary nested lists of different records. Using “sub reports” as in many ad hoc reporting tools is not an adequate solution since it adds unnecessary complexity and typically reverses the network communication causing performance problems due to network latency,
  • Novel, serial, graphical matching and transformation language. Conceptually similar to XSL-T, the RTL transformation language is limited in the type of transformations it can do (e.g. no recursion), but can be represented graphically. It works for documents of arbitrary size.

Performance & scalability

  • Single pass, unidirectional processing pipe. Since network latency can be regarded as a resource that does not scale it is important to avoid reversing the communication direction during a job. The engine can be used in a distributed environment with very high roundtrip times and low bandwidth without noticeable decrease in performance,
  • Serial processing of arbitrarily sized documents.
    • Thousands of pages, low and constant memory,
    • Distributed processing and multiple server option. The multi tier option allows to offload the report rendering to one or more separate machines leaving only the data source message creation for the server.

Sophisticated layout engine

  • Pixel exact positioning,
  • Relative positioning vertical and horizontal,
  • Content propagation vertical and horizontal,
  • Multicolumn layout,
  • Tabular layout,
  • Pivot tables,
  •  Sub-reports,
  • Sophisticated headers and footers,
  • Sophisticated page breaking,
  • Label printing on varying media. The report design contains the description of a single label abstracting from the actual layout on the media removing the need to change the report design for different label printers or different label sheets,
  • Running totals in headers and footers,
  • Page n of m in headers and footers while retaining serial processing,
  • Self-layouting business graphs,
  • Large number of natively implemented bar codes,
  • Bitmap and SVG images. The lean scalable vector graphics (also those of other origin such as bar codes and business graphics) are preserved in all formats that support vector drawing such as PDF, browser or printer output. In all other formats they are rendered into bitmaps.


  • Design time API
    • API for schema introspection,
    • API for report design file introspection and generation,
    • API for template based report design generation,
    • API for pivot table configuration.
  • Run time API
    • Data level API,
      • Selection of source,
      • Configuration of localization,
      • Recommend JAXB for schema generation and marshalling,
    • Document level API,
      • Selection of design,
      • Configuration of page characteristics,
      • Configuration of label layout,
    • Device level API
      • Selection of device (e.g. PDF, server printer, client printer, ..),
      • Device specific configuration (e.g. Paper tray selection of printer).

Report viewers and devices

  • Browser based report viewer
    • Low band-width,
    • 100% pixel exact rendering,
    • Uses cacheable WOFF fonts and SVG vector graphics,
    • Streaming capable for immediate rendering of huge reports,
    • Fast, random navigation in huge documents,
    • Bookmarkable and shareable reports
  • Native report viewer
    • Very fast processing, low, nearly fixed memory consumption,
    • 100% pixel exact rendering using embedded fonts,
    • Streaming capable for immediate rendering of huge reports,
    • Fast, random navigation in huge documents,
    • Support for silent printing
      • Viewer not visible,
      • Selecting printer via server API,
      • Configuration of printer via server API (e.g. selecting paper source),
  • Server side printing
    • Serial processing if supported by the operating system,
    • Programmatic control via IPP properties
  • File generation
    • PDF,
    • RTF (MS-Word),
    • XLS/XLSX (MS-Excel),
    • Postscript,
    • SVG

Run time localization

  • Single design for multiple languages. Primitives are provided to translate strings and format data in locale specific manner individually per document at runtime. Layouts can be defined that handle the resulting differences in text size well.
  • Asian language and alternative writing modes support.
  • Efficient handling of Asian fonts.


  • Support for self written document templates,
  • Type-safe unrolling of field lists and placeholders,
  • Support for complexly structured data sources.


  • Human readable and version controllable file formats,
  • Type safe report design editing,
  • Compile time impact analysis after changed to data sources,
  • Sophisticated report design upgrade algorithm (Similar to diff/patch).
    • 100 % tolerant to addition of fields and structures,
    • Good tolerance to removal,
    • Reports conflicts and allows for manual correction.

Data source generation

  • Graphical data source generator,
  • Creation of code for XML generation,
  • Creation of schema,
  • Type-safe unrolling of field lists and placeholders,
  • Support for complexly structured data sources.

Database support

All of the industry’s leading databases are supported:

  • DB2
  • Informix
  • MS SQL Server
  • MySQL
  • Oracle
  • PostrgreSQL

Getting started

Configuring output

This code sample describes how to configure PDF output on a given networked Report Engine that listens on machine at port 6401.

90            01 configuration_handler   USAGE POINTER.
99            CALL selectDevice USING BY VALUE configuration_handler PDF.
100           CALL configureDistributedProcessing USING BY VALUE configuration_handler BY REFERENCE "" & x"00" BY VALUE 6401.

To configure different output options refer to the Output Options API in the documentation appendix.

Getting a content handler

The content handler (See is used to output data from the Cobol program in a serial manner to the Report Engine. Based on the options configured, output may be to a file, a pipe or a socket. The code sample below gets such a handler. Since in our example above, the distributed processing option was selected, the function will return an implementation for a socket connection.

101   CALL createContentHandler USING BY VALUE configuration_handler RETURNING content_handler.

Serializing, transferring data to an XML stream

Data is written to the content handler in the form of events (function calls). The following code sample produces the XML fragment: “4711”:

CALL startElement USING BY VALUE content_handler BY REFERENCE "CustomerId" & x"00".
CALL characters USING BY VALUE content_handler BY REFERENCE "4711" & x"00".
CALL andElement USING BY VALUE content_handler BY REFERENCE "CustomerId" & x"00".

Creating the schema

Graphical reports are designed based on a XML schema that matches the data to be shipped. A pre compiler can be used to generate the schema and the SAX calls from a Cobol record description but for simple reports it can be manually edited. The schema for the sample program reads as follows:

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <xs:schema version="1.0" xmlns:xs="">
    <xs:element name="Report" type="orderReportModel"></xs:element>
    <xs:complexType name="user">
        <xs:element name="Group" type="order" minOccurs="0" maxOccurs="unbounded"></xs:element>
    <xs:complexType name="order">
        <xs:element name="Group" type="line" minOccurs="0" maxOccurs="unbounded"></xs:element>
    <xs:complexType name="line">
        <xs:element name="OnEveryRow" type="row" minOccurs="0" maxOccurs="unbounded"></xs:element>
    <xs:complexType name="row">
        <xs:element name="orderline.orders.orderid" type="xs:int" nillable="true"></xs:element>
        <xs:element name="orderline.orders.userid" type="xs:string"  

60+ more fields not shown

        <xs:element name="usertotal" type="xs:double" nillable="true"></xs:element>
        <xs:element name="ordertotal" type="xs:double" nillable="true"></xs:element>
    <xs:complexType name="orderReportModel" abstract="true">
      <xs:element name="Group" type="user" minOccurs="0" maxOccurs="unbounded"></xs:element>

Creating a report

Design the report using Report Designer. Choose your report template, associate the triggers and populate the report with data picked from the data view.

Here is “OrderReport.4rp” created in the Report Designer:

Report Designer Order Supplies

Running the application (source code listing)

Find below the complete listing of the Cobol:

3 PROGRAM-ID. OrderReport.
4 AUTHOR. Alex
9 SELECT OrderReportFile ASSIGN TO "/tmp/COBOL/OrderReport.dat"
15 FD OrderReportFile.
16 01 OrderReportRecord.
18 02 orderline_orders_orderid PIC X(1).
19 02 orderline_orders_userid PIC X(6).
20 02 orderline_orders_orderdate PIC X(10).
21 02 orderline_orders_shipfirstname PIC X(5).
22 02 orderline_orders_shiplastname PIC X(6).
23 02 orderline_orders_shipaddr1 PIC X(23).
24 02 orderline_orders_shipaddr2 PIC X(1).
25 02 orderline_orders_shipcity PIC X(30).
26 02 orderline_orders_shipstate PIC X(2).
27 02 orderline_orders_shipzip PIC X(7).
28 02 orderline_orders_shipcountry PIC X(3).
29 02 orderline_orders_billfirstname PIC X(5).
30 02 orderline_orders_billlastname PIC X(6).
31 02 orderline_orders_billaddr1 PIC X(23).
32 02 orderline_orders_billaddr2 PIC X(1).
33 02 orderline_orders_billcity PIC X(30).
34 02 orderline_orders_billstate PIC X(2).
35 02 orderline_orders_billzip PIC X(7).
36 02 orderline_orders_billcountry PIC X(3).
37 02 orderline_orders_totalprice PIC X(7).
38 02 orderline_orders_creditcard PIC X(1).
39 02 orderline_orders_exprdate PIC X(1).
40 02 orderline_orders_cardtype PIC X(1).
41 02 orderline_orders_sourceapp PIC X(3).
42 02 orderline_account_userid PIC X(6).
43 02 orderline_account_email PIC X(17).
44 02 orderline_account_firstname PIC X(5).
45 02 orderline_account_lastname PIC X(6).
46 02 orderline_account_acstatus PIC X(2).
47 02 orderline_account_addr1 PIC X(23).
48 02 orderline_account_addr2 PIC X(1).
49 02 orderline_account_city PIC X(30).
50 02 orderline_account_state PIC X(2).
51 02 orderline_account_zip PIC X(7).
52 02 orderline_account_country PIC X(3).
53 02 orderline_account_phone PIC X(21).
54 02 orderline_account_langpref PIC X(7).
55 02 orderline_account_favcategory PIC X(8).
56 02 orderline_account_mylistopt PIC X(1).
57 02 orderline_account_banneropt PIC X(1).
58 02 orderline_account_sourceapp PIC X(3).
59 02 orderline_country_code PIC X(3).
60 02 orderline_country_codedesc PIC X(14).
61 02 orderline_lineitem_orderid PIC X(1).
62 02 orderline_lineitem_linenum PIC X(2).
63 02 orderline_lineitem_itemid PIC X(8).
64 02 orderline_lineitem_quantity PIC X(1).
65 02 orderline_lineitem_unitprice PIC X(6).
66 02 orderline_product_productid PIC X(6).
67 02 orderline_product_catid PIC X(10).
68 02 orderline_product_prodname PIC X(29).
69 02 orderline_product_proddesc PIC X(43).
70 02 orderline_product_prodpic PIC X(44).
71 02 orderline_category_catid PIC X(10).
72 02 orderline_category_catorder PIC X(1).
73 02 orderline_category_catname PIC X(13).
74 02 orderline_category_catdesc PIC X(1).
75 02 orderline_category_catpic PIC X(30).
76 02 orderline_item_itemid PIC X(8).
77 02 orderline_item_productid PIC X(6).
78 02 orderline_item_listprice PIC X(6).
79 02 orderline_item_unitcost PIC X(3).
80 02 orderline_item_supplier PIC X(1).
81 02 orderline_item_itstatus PIC X(1).
82 02 orderline_item_attr1 PIC X(18).
83 02 orderline_item_attr2 PIC X(1).
84 02 orderline_item_attr3 PIC X(1).
85 02 orderline_item_attr4 PIC X(1).
86 02 orderline_item_attr5 PIC X(1).
90 01 configuration_handler USAGE POINTER.
91 01 content_handler USAGE POINTER.
92 01 zero_terminated_string PIC X(100).
93 01 field_name PIC X(100).
94 01 field_value PIC X(100).
97 Begin.
98 CALL "createRuntimeConfiguration" USING "OrderReport.4rp" & x"00" RETURNING configuration_handler.
99 CALL "selectDevice" USING BY VALUE configuration_handler 0.
100 CALL "configureDistributedProcessing" USING BY VALUE configuration_handler BY REFERENCE "" & x"00" BY VALUE 6401.
101 CALL "createContentHandler" USING BY VALUE configuration_handler RETURNING content_handler.
102 CALL "destroyRuntimeConfiguration" USING BY VALUE configuration_handler.
104 CALL "startElement" USING BY VALUE content_handler BY REFERENCE "Report" & x"00".
105 CALL "startElement" USING BY VALUE content_handler BY REFERENCE "Group" & x"00".
106 CALL "startElement" USING BY VALUE content_handler BY REFERENCE "Group" & x"00".
107 CALL "startElement" USING BY VALUE content_handler BY REFERENCE "Group" & x"00".
108 OPEN INPUT OrderReportFile.
109 READ OrderReportFile
112 PERFORM ShipOrderReportRow
113 UNTIL EndOfFile.
114 CALL "endElement" USING BY VALUE content_handler BY REFERENCE "Group" & x"00".
115 CALL "endElement" USING BY VALUE content_handler BY REFERENCE "Group" & x"00".
116 CALL "endElement" USING BY VALUE content_handler BY REFERENCE "Group" & x"00".
117 CALL "endElement" USING BY VALUE content_handler BY REFERENCE "Report" & x"00".
118 CALL "destroy_content_handler" USING BY VALUE content_handler.
119 CLOSE OrderReportFile
123 ShipOrderReportRow.
124 CALL "startElement" USING BY VALUE content_handler BY REFERENCE "OnEveryRow" & x"00".
126 MOVE "orderline.orders.orderid" TO field_name.
127 MOVE orderline_orders_orderid TO field_value.
128 PERFORM ShipOrderReportField
129 MOVE "orderline.orders.userid" TO field_name.
130 MOVE orderline_orders_userid TO field_value.
131 PERFORM ShipOrderReportField
132 MOVE "orderline.orders.orderdate" TO field_name.
133 MOVE orderline_orders_orderdate TO field_value.
134 PERFORM ShipOrderReportField
135 MOVE "orderline.orders.shipfirstname" TO field_name.
136 MOVE orderline_orders_shipfirstname TO field_value.
137 PERFORM ShipOrderReportField
138 MOVE "orderline.orders.shiplastname" TO field_name.
139 MOVE orderline_orders_shiplastname TO field_value.
140 PERFORM ShipOrderReportField
141 MOVE "orderline.orders.shipaddr1" TO field_name.
142 MOVE orderline_orders_shipaddr1 TO field_value.
143 PERFORM ShipOrderReportField
144 MOVE "orderline.orders.shipaddr2" TO field_name.
145 MOVE orderline_orders_shipaddr2 TO field_value.
146 PERFORM ShipOrderReportField
147 MOVE "orderline.orders.shipcity" TO field_name.
148 MOVE orderline_orders_shipcity TO field_value.
149 PERFORM ShipOrderReportField
150 MOVE "orderline.orders.shipstate" TO field_name.
151 MOVE orderline_orders_shipstate TO field_value.
152 PERFORM ShipOrderReportField
153 MOVE "orderline.orders.shipzip" TO field_name.
154 MOVE orderline_orders_shipzip TO field_value.
155 PERFORM ShipOrderReportField
156 MOVE "orderline.orders.shipcountry" TO field_name.
157 MOVE orderline_orders_shipcountry TO field_value.
158 PERFORM ShipOrderReportField
159 MOVE "orderline.orders.billfirstname" TO field_name.
160 MOVE orderline_orders_billfirstname TO field_value.
161 PERFORM ShipOrderReportField
162 MOVE "orderline.orders.billlastname" TO field_name.
163 MOVE orderline_orders_billlastname TO field_value.
164 PERFORM ShipOrderReportField
165 MOVE "orderline.orders.billaddr1" TO field_name.
166 MOVE orderline_orders_billaddr1 TO field_value.
167 PERFORM ShipOrderReportField
168 MOVE "orderline.orders.billaddr2" TO field_name.
169 MOVE orderline_orders_billaddr2 TO field_value.
170 PERFORM ShipOrderReportField
171 MOVE "orderline.orders.billcity" TO field_name.
172 MOVE orderline_orders_billcity TO field_value.
173 PERFORM ShipOrderReportField
174 MOVE "orderline.orders.billstate" TO field_name.
175 MOVE orderline_orders_billstate TO field_value.
176 PERFORM ShipOrderReportField
177 MOVE "orderline.orders.billzip" TO field_name.
178 MOVE orderline_orders_billzip TO field_value.
179 PERFORM ShipOrderReportField
180 MOVE "orderline.orders.billcountry" TO field_name.
181 MOVE orderline_orders_billcountry TO field_value.
182 PERFORM ShipOrderReportField
183 MOVE "orderline.orders.totalprice" TO field_name.
184 MOVE orderline_orders_totalprice TO field_value.
185 PERFORM ShipOrderReportField
186 MOVE "" TO field_name.
187 MOVE orderline_orders_creditcard TO field_value.
188 PERFORM ShipOrderReportField
189 MOVE "orderline.orders.exprdate" TO field_name.
190 MOVE orderline_orders_exprdate TO field_value.
191 PERFORM ShipOrderReportField
192 MOVE "orderline.orders.cardtype" TO field_name.
193 MOVE orderline_orders_cardtype TO field_value.
194 PERFORM ShipOrderReportField
195 MOVE "orderline.orders.sourceapp" TO field_name.
196 MOVE orderline_orders_sourceapp TO field_value.
197 PERFORM ShipOrderReportField
198 MOVE "orderline.account.userid" TO field_name.
199 MOVE orderline_account_userid TO field_value.
200 PERFORM ShipOrderReportField
201 MOVE "" TO field_name.
202 MOVE orderline_account_email TO field_value.
203 PERFORM ShipOrderReportField
204 MOVE "orderline.account.firstname" TO field_name.
205 MOVE orderline_account_firstname TO field_value.
206 PERFORM ShipOrderReportField
207 MOVE "orderline.account.lastname" TO field_name.
208 MOVE orderline_account_lastname TO field_value.
209 PERFORM ShipOrderReportField
210 MOVE "orderline.account.acstatus" TO field_name.
211 MOVE orderline_account_acstatus TO field_value.
212 PERFORM ShipOrderReportField
213 MOVE "orderline.account.addr1" TO field_name.
214 MOVE orderline_account_addr1 TO field_value.
215 PERFORM ShipOrderReportField
216 MOVE "orderline.account.addr2" TO field_name.
217 MOVE orderline_account_addr2 TO field_value.
218 PERFORM ShipOrderReportField
219 MOVE "" TO field_name.
220 MOVE orderline_account_city TO field_value.
221 PERFORM ShipOrderReportField
222 MOVE "orderline.account.state" TO field_name.
223 MOVE orderline_account_state TO field_value.
224 PERFORM ShipOrderReportField
225 MOVE "" TO field_name.
226 MOVE orderline_account_zip TO field_value.
227 PERFORM ShipOrderReportField
228 MOVE "" TO field_name.
229 MOVE orderline_account_country TO field_value.
230 PERFORM ShipOrderReportField
231 MOVE "" TO field_name.
232 MOVE orderline_account_phone TO field_value.
233 PERFORM ShipOrderReportField
234 MOVE "orderline.account.langpref" TO field_name.
235 MOVE orderline_account_langpref TO field_value.
236 PERFORM ShipOrderReportField
237 MOVE "orderline.account.favcategory" TO field_name.
238 MOVE orderline_account_favcategory TO field_value.
239 PERFORM ShipOrderReportField
240 MOVE "orderline.account.mylistopt" TO field_name.
241 MOVE orderline_account_mylistopt TO field_value.
242 PERFORM ShipOrderReportField
243 MOVE "orderline.account.banneropt" TO field_name.
244 MOVE orderline_account_banneropt TO field_value.
245 PERFORM ShipOrderReportField
246 MOVE "orderline.account.sourceapp" TO field_name.
247 MOVE orderline_account_sourceapp TO field_value.
248 PERFORM ShipOrderReportField
249 MOVE "" TO field_name.
250 MOVE orderline_country_code TO field_value.
251 PERFORM ShipOrderReportField
252 MOVE "" TO field_name.
253 MOVE orderline_country_codedesc TO field_value.
254 PERFORM ShipOrderReportField
255 MOVE "orderline.lineitem.orderid" TO field_name.
256 MOVE orderline_lineitem_orderid TO field_value.
257 PERFORM ShipOrderReportField
258 MOVE "orderline.lineitem.linenum" TO field_name.
259 MOVE orderline_lineitem_linenum TO field_value.
260 PERFORM ShipOrderReportField
261 MOVE "orderline.lineitem.itemid" TO field_name.
262 MOVE orderline_lineitem_itemid TO field_value.
263 PERFORM ShipOrderReportField
264 MOVE "orderline.lineitem.quantity" TO field_name.
265 MOVE orderline_lineitem_quantity TO field_value.
266 PERFORM ShipOrderReportField
267 MOVE "orderline.lineitem.unitprice" TO field_name.
268 MOVE orderline_lineitem_unitprice TO field_value.
269 PERFORM ShipOrderReportField
270 MOVE "orderline.product.productid" TO field_name.
271 MOVE orderline_product_productid TO field_value.
272 PERFORM ShipOrderReportField
273 MOVE "orderline.product.catid" TO field_name.
274 MOVE orderline_product_catid TO field_value.
275 PERFORM ShipOrderReportField
276 MOVE "orderline.product.prodname" TO field_name.
277 MOVE orderline_product_prodname TO field_value.
278 PERFORM ShipOrderReportField
279 MOVE "orderline.product.proddesc" TO field_name.
280 MOVE orderline_product_proddesc TO field_value.
281 PERFORM ShipOrderReportField
282 MOVE "orderline.product.prodpic" TO field_name.
283 MOVE orderline_product_prodpic TO field_value.
284 PERFORM ShipOrderReportField
285 MOVE "orderline.category.catid" TO field_name.
286 MOVE orderline_category_catid TO field_value.
287 PERFORM ShipOrderReportField
288 MOVE "orderline.category.catorder" TO field_name.
289 MOVE orderline_category_catorder TO field_value.
290 PERFORM ShipOrderReportField
291 MOVE "orderline.category.catname" TO field_name.
292 MOVE orderline_category_catname TO field_value.
293 PERFORM ShipOrderReportField
294 MOVE "orderline.category.catdesc" TO field_name.
295 MOVE orderline_category_catdesc TO field_value.
296 PERFORM ShipOrderReportField
297 MOVE "orderline.category.catpic" TO field_name.
298 MOVE orderline_category_catpic TO field_value.
299 PERFORM ShipOrderReportField
300 MOVE "orderline.item.itemid" TO field_name.
301 MOVE orderline_item_itemid TO field_value.
302 PERFORM ShipOrderReportField
303 MOVE "orderline.item.productid" TO field_name.
304 MOVE orderline_item_productid TO field_value.
305 PERFORM ShipOrderReportField
306 MOVE "orderline.item.listprice" TO field_name.
307 MOVE orderline_item_listprice TO field_value.
308 PERFORM ShipOrderReportField
309 MOVE "orderline.item.unitcost" TO field_name.
310 MOVE orderline_item_unitcost TO field_value.
311 PERFORM ShipOrderReportField
312 MOVE "orderline.item.supplier" TO field_name.
313 MOVE orderline_item_supplier TO field_value.
314 PERFORM ShipOrderReportField
315 MOVE "orderline.item.itstatus" TO field_name.
316 MOVE orderline_item_itstatus TO field_value.
317 PERFORM ShipOrderReportField
318 MOVE "orderline.item.attr1" TO field_name.
319 MOVE orderline_item_attr1 TO field_value.
320 PERFORM ShipOrderReportField
321 MOVE "orderline.item.attr2" TO field_name.
322 MOVE orderline_item_attr2 TO field_value.
323 PERFORM ShipOrderReportField
324 MOVE "orderline.item.attr3" TO field_name.
325 MOVE orderline_item_attr3 TO field_value.
326 PERFORM ShipOrderReportField
327 MOVE "orderline.item.attr4" TO field_name.
328 MOVE orderline_item_attr4 TO field_value.
329 PERFORM ShipOrderReportField
330 MOVE "orderline.item.attr5" TO field_name.
331 MOVE orderline_item_attr5 TO field_value.
332 PERFORM ShipOrderReportField
333 MOVE "lineitemprice" TO field_name.
334 MOVE "0" TO field_value.
335 PERFORM ShipOrderReportField
336 MOVE "overalltotal" TO field_name.
337 MOVE "0" TO field_value.
338 PERFORM ShipOrderReportField
339 MOVE "usertotal" TO field_name.
340 MOVE "0" TO field_value.
341 PERFORM ShipOrderReportField
342 MOVE "ordertotal" TO field_name.
343 MOVE "0" TO field_value.
344 PERFORM ShipOrderReportField
346 CALL "endElement" USING BY VALUE content_handler BY REFERENCE "OnEveryRow" & x"00".
347 READ OrderReportFile
352 ShipOrderReportField SECTION.
353 STRING field_name
356 INTO zero_terminated_string
357 CALL "startElement" USING BY VALUE content_handler BY REFERENCE zero_terminated_string.
358 STRING field_value
361 INTO zero_terminated_string
362 CALL "characters" USING BY VALUE content_handler BY REFERENCE zero_terminated_string.
363 STRING field_name
366 INTO zero_terminated_string
367 CALL "endElement" USING BY VALUE content_handler BY REFERENCE zero_terminated_string.

Resulting report

Executing the above code sample produces the following PDF document:

Report Design Order Supplies Finished Report

The same code can be executed with another design by simply changing the design file name “OrderReport.4rp” to your new design file:

Report Designer Order Supplies Finished Report - Alt Template


Inspect the data shipped to the report engine

For debugging purposes it is possible to have the data written to a file. The report can also be re-run from this file. This is achieved by setting the environment variable GREDATAFILE (e.g. GREDATAFILE=./report.xml).

The file for the program above then looks as follows:

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <?PipeConfiguratorStyleSheet processArbitraryXMLInput="true" clientHost="localhost" clientPort="6400" reportFileName="OrderReport.4rp" outputDevice="PDF"?>
 <!-- 4000+ lines omitted -->

Code samples

A selection of sample reports written in the Cobol language