Powered by QM on a Linux server
Help and Support

KnowledgeBase 00043: Report Styles and Overlays

Last updated: 27 Dec 2018
Applies to: All versions
Top level index       Full Index Search Tips
Previous article     Next article

Multivalue database products have some very powerful report generation tools but are let down by the poor visual impact of single font tabular results.

There are some excellent tools available to work alongside multivalue databases to construct visually appealing reports but even a simple change of font or colour can significantly improve user perception.

Report Styles for Screen Reports

A query processor report can be considered as having lines that fall into seven classes:

  • Heading
  • Column heading
  • Detail
  • Subtotal
  • Total
  • Footing
  • Other

For a report directed to the user's screen, QM allows a colour to be assigned to each line class. For example, a report might show the headings in bright blue but the rest of the report in white. This feature requires that the terminal emulator colour handling is correctly configured.

A report style definition record assigns foreground and background colours to each line class. The record is an X-type VOC item where fields 2 onwards contain lines such as

   Heading=Bright blue,Black 
where the two comma separated names are the foreground and background colours. Only the first character of the line class name is needed. Thus the example above could also be written as
   H=Bright blue,Black 

The colour names are Black, Blue, Green, Cyan, Red, Magenta, Brown, White, Grey (or Gray), Bright Blue, Bright Green, Bright Cyan, Bright Red, Bright Magenta, Yellow, Bright White. These names are case insensitive and non-alphabetic characters are ignored. Thus "Bright Blue" can also be written as, for example, "BrightBlue", "bright-blue", etc.

Any item not specified in the report style definition takes its default value from the "Other" line class

which itself defaults to the above settings if omitted.

A style definition is applied to a report by use of the STYLE keyword
where RPT.FORMAT is the name of the style definition. A default report style can be set using the REPORT.STYLE command.

Report Styles for Printed Reports

Report styles can also be applied to reports directed to a PCL printer. In this case, a third comma separated element in each field of the style definition record holds a font weight. This can be given as a number in the range -7 to +7 or as a PCL font weight name (ULTRA-THIN, EXTRA-THIN, THIN, EXTRA-LIGHT, LIGHT, DEMI-LIGHT, SEMI-LIGHT, MEDIUM, SEMI-BOLD, DEMI-BOLD, BOLD, EXTRA-BOLD, BLACK, EXTRA-BLACK, ULTRA-BLACK). The default font weight is MEDIUM (numeric value 0).


To see styles in action, create a VOC style record that reads

   1: X 
   2: H=Yellow,Black,7 
   3: C=Yellow,,3 
   4: D=White 
   5: S=Bright White,,3 
   6: T=Bright Red,,7 
   7: F=Yellow,Black,3 
   8: O=White 
and then display a report that includes all the line types.


Overlays allow an application to place additional items, often graphics, onto a printed page. Although they are available for all printed output, they are of most use with the query processor.

An overlay is generated by a catalogued subroutine that is called automatically at the start of each page of output. The subroutine name is specified in the OVERLAY option of SETPTR or a query processor command.

The subroutine takes a single argument which is the print unit number and emits control strings using the PRINT statement. For PCL printers, QM includes some useful PCL control string functions.


   subroutine overlay(pu) 
   $catalog overlay 
   $include pcl.h 
      s = pcl.save.csr()               ;* Save cursor position 
      s := pcl.box(0,0,2320,3300,2,10) ;* Draw box 
      s := pcl.restore.csr()           ;* Restore cursor position 
      s := pcl.left.margin(1)          ;* Left margin column 1 
      print on pu s : 
The above subroutine draws a box around an A4 sized page on a PCL printer. Note how it saves the cursor position to ensure that subsequent application output appears at the correct place.

Because the subroutine is called before any other output to the page, it is possible for the subroutine to make other changes to the page settings. Note in the above example how the left margin is indented to bring the application output away from the left edge of the box.

This example is very similar to use of the BOXED option to the query processor commands.

Related Articles


Please tell us if this article was helpful
Very     Slightly     Not at all
Email (optional)