Combining Field Processing and an Electronic Overlay
This example involves printing a monthly individual sales report for a specified distribution. The following items are needed to generate the sales report:
- A pre-designed electronic overlay for the sales report
- An unformatted print data file with periodic sales statistics
An example of these is shown in Figure Electronic Overlay and Data File for a Sales Report.
Electronic Overlay and Data File for a Sales Report
The code example that follows contains a form definition and a page definition. The page definition maps the file to the overlay.
In the previous figure, the 0,0 point is the upper-left corner of the overlay. This means that the logical page origin must coincide with the overlay origin in this example. POSITION subcommands are relative to the logical page origin. The overlay origin point that positions the overlay is specified in the Overlay Generation Language/370 that creates the overlay, but can be modified in the page definition. In mapping to an overlay, you should check the input to the overlay creation program so you can coordinate its origin with the logical page origin. You can reposition the overlay through the PRINTLINE command.
01 FORMDEF SLSRPT OFFSET 0 0 ; 02 OVERLAY SLSRPT ; 03 SUBGROUP OVERLAY SLSRPT ; 04 05 PAGEDEF SLSRPT ; 06 PRINTLINE POSITION 2 IN 1.3 IN ; /* RECORD 1 */ 07 FIELD START 1 LENGTH 23 ; 08 PRINTLINE POSITION 2 IN 1.70 IN ; /* RECORD 2 */ 09 FIELD START 1 LENGTH 9 ; /* DEFAULT POSITION */ 10 FIELD START 10 LENGTH 5 11 POSITION 4.3 IN * ; /* THE ASTERISK MEANS */ 12 /* CURRENT LINE */ 13 PRINTLINE POSITION 1.5 IN 6 IN ; /* RECORD 3 */ 14 FIELD START 1 LENGTH 4 ; 15 SETUNITS LINESP 4 LPI ; 16 PRINTLINE REPEAT 4 /* RECORDS 4-7 */ 17 POSITION 1.5 IN 3.6 IN ; 18 FIELD START 1 LENGTH 7 ; /* DEFAULT POSITION */ 19 FIELD START 10 LENGTH 3 20 POSITION 1.5 IN * ; 21 FIELD START 16 LENGTH 3 22 POSITION 2.5 IN * ; 23 FIELD START 21 LENGTH 3 24 POSITION 3.5 IN * ;
A time-saving device used in the above example is the REPEAT subcommand (line 16), which maps a single printline with its field subsets to records 4 through 7 with all model names and sales statistics. The length values in the repeated fields are 7, 3, 3, and 3: sufficient to accommodate the largest model name, unit value, $(000), and percentage fields mapped by this FIELD command.
The next figure shows the report formatted by the resources generated in the command stream of this example.