ubreport – report generator and data processor
ubreport -[0 A B* D H* M L N# P* Q S T W* X Y* a* b d f* i l* m* n o ps p* s t* w*] <report>
Ubreport is the UNIBASE report generator and data processor. It works by reading a report format file which specifies a table to report from and a layout to use.
Layouts can be very complex and include text and table attributes from the current table and any other table in the database. Other tables can be access by reference to attributes in the other tables or by explicitly including records from a table using a set of format specifications for the other table.
Normally ubreport accesses data from a stored UNIBASE table, however it can also be used as a UN*X filter accepting records from stdin in a variety of formats and optionally integrating them with a stored database before putting the requested report on stdout. The command line argument -S tells ubreport to read table records from stdin.
Although ubreport can produce complex commercial data processing style reports, it is not well suited to the arbitrary formats required for word processing or more complex document formats such as catalogs. To do these more complex tasks ubreport allows the user these facilities:
Display attributes. This is a format specification based on the UNIPL*X word processor. In this format each line ends with ‘@@’ and the following line has an attribute character for each character. A SPACE means no special attributes. Any other character can be used to mean a single or combination attribute or a character translation to another character set. Ubreport doesn’t count attribute lines when working out how many lines have been printed on a page.
To interpret the attributes, the ubreport output has to be passed to another filter that understands this encoding. Ubprint (1) is one such filter and comes with UNIBASE.
troff/groff users will be familiar with this format. Dot commands are lines that start with a period (‘.’). Ubreport has a limited facility to deal with these. It ignores lines starting with a period when counting lines for page lengths.
Except for simple functions such as changing fonts, or centreing lines this will not be sufficient to get the expected formats. In this case it is better to set the page length to 1 or 0 (turn pagination off) and assume that an external filter such as groff will do the remaining formatting correctly.
For all other formats pagination should be turned off and format commands embedded in the output by putting them in the report format. This is the method used for producing HTML format reports. Ubreport assumes an eternal filter will be used for the final display.
Ubreport format file names end in ‘.rep’, but this is not given when calling the program.
|-A||Use attribute/value format for records read from stdin. This flag is only valid when used in conjunction with -S.|
|-D||This option allows for the alternative date format YYMMDD. Normally, all dates are expected to be in the format DD.MM.YY (or DD/MM/YY). Using this option reads dates in the alternate format. Useful only with the -S option.|
|-L||Suppress display of the status line when using full screen user input for report variables.|
|-M||Read match values for report from stdin.|
Contrast with -m (one value) and -m start -l end for a range of values.Example: echo 1234567890 | ubreport -M stock
|-N||value||number||Report is run with a different nice(2) value. Normally reports are run with the lowest possible priority. This means that screen programs are not slowed down as much as they would be if the reports ran at the same priority.|
Valid values for “value” are 0 to 20. 20 is the lowest priority (and the default) while 0 is the highest priority.This option can be used to make short reports run quickly (i.e. at the same priority as the screen programs). Typically this is needed when a screen program needs a report for a value.Example: ubreport -N 0 discount
|-P||pipe||text||ubreport will read its input from the named pipe pipe. To do this ubreport becomes a daemon and continuously reads pipe. It must be manually killed to terminate it. The named pipe must exist before ubreport is called, it will not create it if it doesn’t exist. When used in conjuction with -p output, output will be restarted every time pipe is re-opened. eg.|
ubreport -P invoice -p “lp -s -dinvoice” invoicewill spool an invoice every time an invoice number is written to the named pipe invoice.
|-Q||Turn off QUIT signal processing. This flag makes it impossible for the user to stop a report with the keyboard QUIT key. The QUIT key is determined by stty(1).|
|-S||ubreport reads records from standard input rather than the main file in the report format (report file). Records are assumed to be in the same format as the report file. Note that the report file does not have to actually exist. Effectively this means ubreport can be used as a Unix filter. Input records will have any calculations and associations carried out as if a real UNIBASE file were being used. For example: ubreport newstock | sort | report -S newlist|
|-T||Trace all calculations for all fields|
|-Y||dictionary||text||Use a different data dictionary|
|-a||character||text||This changes the default alignment character. The alignment character (default ‘#’) is used to split a line in left, centre, and right sections. This option changes the alignment character to another character.|
For example: ubreport -a! stock
|-b||This option allows ubreport to read UDF (Universal Dump Format) See ubbatch(1) for details. Useful only with the -S option.|
|-d||This gives a debug output. As ubreport reads the Data Dictionary and report format each line is echoed to the screen. In this way the exact point at which an error occurs can be observed and corrected.|
|-f||separator||text||Used in conjunction with the ‘-S’ option this tells ubreport to use ‘separator’ as the field separator for input records. Instead of fixed length input records, each field is separated by a field separator.|
For example, to use ubreport to read records where fields are separated by commas(,):ubreport -S -f, newstockUse only with the -S option.
|-i||Indicates that ubreport is not interactive, ie. it is in batch mode, probably as part of a shell script or command file. In this mode the input screen (for the ‘I’ section) is ignored (although it must be present) and report variables are read, one per line, from the standard input in ‘attribute’ format. i.e. attribute>,value> pairs.|
e.g. ubreport -i customers <
|-l||value||text||Last value to use in a matched value report. Normally the -m flag only reports records whose index matches value. When the -l flag is used the -m flag becomes the beginning of a range and the -l flag is the end of the range.|
Example: ubreport -m A -l B nameswould run the report names starting with names beginning with ‘A’ and finishing at the end of the ‘B’s.
|-m||value||text||This restricts the report to those key values that are the same (match) as value. If a report is required of only a section of a large file this option can be considerably reduce the report time.|
|-n||Print table network used for this report. This shows the paths used by ubreport to reach each table from the master table.|
|-o||Only print subtotals. This is used to allow a single report format to be used to print reports with and without full record details. Any ‘R’ sections are ignored.|
|-p||output||text||ubreport sends its output via a pipe to ‘output’ which whould be a unix command. The command is executed by sh(1) so it can be a pipeline or contain ‘;’ separated commands on anything else that the shell understands. This is done asynchronously so ubreport will work in the background. ubreport doesn’t work until after any operator input has been collected.|
Example: ubreport -p ‘lp -s’ stock
|-s||Redirects the output to ‘pg’ for screen output. The default program (pg) may be changed with the environment variable ‘UBPG’.|
|-t||field||text||Trace all calculations for ‘field’.|
|-w||Tells ubreport that this format contains html tags. Html tags begin with ‘<‘ which conflicts with the include table directive. When ubreport encounters a ‘<‘ it first looks for a table to include (normal operation). If that fails it assumes an html tag and looks for the terminating ‘>’. An error is still reported if the terminating ‘>’ is not found or a ‘<‘ is found in the html tag.|