RUNTIME: Printing Customer Orders for one Region

RUNTIME prints the same information as the TOTALS report, but shows you how to make use of a runtime field to create a report for the region specified by the user at runtime.

Table Details and Type

Program Type:

Report

Page Width:

80

Lowest table:

ORDER_HEADER

Fast pass table:

REGION

Sequencing table:

REGION

Report Heading

"Summary report printing sub-totals for one category asked for at runtime".

Field Processing

LOOK_AT_REGION is a runtime field that holds the region code supplied by the user at runtime.

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

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

Record Selection Condition

The condition to select records from the fast pass table, REGION, is:

REGION_CODE=LOOK_AT_REGION

LOOK_AT_REGION is entered by the user when the report is run.

Output Options

Screen ? Yes Blank character
Printer ? No Remove trailing blanks ?
File ? Yes
Print device DEFAULT_PRINTER Ask for start/stop values ? No
File Name TOTALS Pause after each page ? Yes
Repeat fold headers ? No Subtotal only program ? No
Print date/time/pagenr ? Yes Suppress 1 item totals ? No
Spacing after last fold 1 Suppress grand totals ? Yes
Spacing at end of page 4

Printing the Report

REPPRINT -DB SALESORD -PROG RUNTIME

Enter the REGION_CODE, for example "IRL".

Alternatively, the runtime value can be preloaded with a command tail like this:

REPPRINT -DB SALESORD -PROG RUNTIME -1 IRL

where -1 is the field number of the runtime field, LOOK_AT_REGION.