TOTALS: Printing Customer Orders for Several Regions

TOTALS lists customer order details by region. It demonstrates invaluable techniques, such as:

Table Details and Type

It is possible to produce the report more quickly by specifying the REGION table as the sequencing table, otherwise the report would require sorting on the CUSTOMER.REGION_CODE field. Furthermore, there are fewer records to test the start and stop range against if the REGION table is used as the fast pass table.

Program Type:

Report

Page Width:

80

Lowest table:

ORDER_HEADER

Fast pass table:

REGION

Sequencing table:

REGION

Report Heading

"Prints customer order details with statistics for all regions".

Field Processing

The main features of the field processing are:

Fields processed by program:

Nr Name             Type Occurs Sort Tot List L/Brk P/Brk Rpt Page Break Fold

1 REGION_CODE U3 Yes No No No Yes No No
2 RUNNING_COUNT N3 No Yes No No No No No No
3 NAME C30 Yes No No No No No No
in CUSTOMER
4 ORDER_NUMBER L5 No Yes No No No No No No
5 ORDER_VALUE N8.2 Yes Yes No No Yes No No Yes
6 NAME C30 No No No No No No No
in REGION
7 LABEL_STATISTICS C45 No Yes No No No No Yes
8 LABEL_COUNT C25 No Yes No No No No No
9 ORDER_COUNT N5 Yes No Yes No No No No Yes
10 LABEL_AVERAGE C25 No Yes No No No No No
11 ORDER_AVERAGE N7.2 No No Yes No No No No Yes
12 LABEL_TOTAL C25 No Yes No No No No No
13 ORDER_TOTAL N10.2 No No Yes No No No No No

Record Selection Condition

Records are selected from the fast pass table REGION, depending on the start and stop values entered at runtime.

Output Options

Notice that the report asks the user for start/stop values, that Pause after each page ? is 'Yes', and that the grand totals are suppressed.

Running the Report

REPPRINT -DB SALESORD -PROG TOTALS

Enter the start value, for example "CAM", press <Tab> and enter the stop value "SEE".

The start value must appear earlier in the record sequence than the stop value. For example, entering "SEE" followed by "CAM", produces an empty report.

Alternatively, the start and stop values can be preloaded with command tails like this:

REPPRINT -DB SALESORD -PROG TOTALS -START_1 CAM -STOP_1 SEE