Download Latest Version tpc-c-ifmx.tar.gz (392.7 kB)
Email in envelope

Get an email when there's a new version of IIUG Software Repository

Name Modified Size InfoDownloads / Week
Parent folder
append.c 2020-05-11 1.1 kB
README.1st 2020-05-11 1.9 kB
sample.4gl 2020-05-11 3.5 kB
sample.dat 2020-05-11 765 Bytes
sample.sql 2020-05-11 177 Bytes
Totals: 5 Items   7.6 kB 0
		Multiple Report Interleaved Output Processing

This presents a sample of 4GL code which writes interleaved sections of
multiple reports to a single output stream.  In the case of the sample it is a
detail report and a summary report which would be difficult to implement as a
single 4GL report module.  The user requirement is that the summary page for a
client appear immediately following the detail page.  The solution presented is
to write both reports to a pipe and have the pipe filter handle interleaving
the reports properly using UNIX file locking functions.  The indicator to the
sample filter, append.c, that a logical report page is complete is the FormFeed
(^L or \f) character at the end of each physical page accomplished using the
4GL END OF PAGE option in the OUTPUT section or the page length passed on the
command line.

The method requires that a separate report be started and finished for each
grouping that causes an alternation in the output from one report type to the
other (ie from summary to detail).  The order in which the reports are FINISHed
is the order in which their pages will be flushed as 4GL itself buffers the
report lines in a temp table until the report is FINISHed.

To allow for logical report pages or sections that span physical pages a
semaphore character or string can be printed from the REPORT HEADER section as
appropriate and the filter modified to recognize that semaphore string as the
point at which to flush buffered output, optionally not printing the semaphore.

The current version uses a fixed array of 100 strings 1024 characters each to
buffer the report.  Modifiing this to use a dynamically growing array is
trivial and left to the user as an exercise.

Files included:

README.1st	- This file.
append.c	- The sample output filter program.
sample.4gl	- The sample 4GL module.
sample.sql	- Table structure for the sample program.
sample.dat	- Sample data for the sample program.

Source: README.1st, updated 2020-05-11