Controlling Display of Sort Field Values

How to:

By default, a sort field value displays only on the first row or column of the set of detail rows or columns generated for that sort field value. You can control this behavior using the BYDISPLAY parameter. BYDISPLAY is supported for all output formats and can control display of ACROSS values as well as BY values.

This feature enables you to avoid specifying the sort field twice, once as a display field and once for sorting (with the NOPRINT option). For example:

PRINT FIRST_NAME LAST_NAME
BY FIRST_NAME NOPRINT

Syntax: How to Control Display of Sort Field Values

SET BYDISPLAY = {OFF|ON|BY|ACROSS|ALL}
ON TABLE SET BYDISPLAY {OFF|ON|BY|ACROSS|ALL}

where:

OFF

Displays a sort field value only on the first line or column of the report output for the sort group and on the first line or column of a page. OFF is the default value.

ON or BY

Displays the relevant BY field value on every line of report output produced. BY is a synonym for ON.

ACROSS

Displays the relevant ACROSS field value on every column of report output produced.

ALL

Displays the relevant BY field value on every line of report output and the relevant ACROSS field value on every column of report output.

Example: Controlling Display of Sort Field Values on Report Output

The following request generates a report on which sort field values only display when they change (BYDISPLAY OFF).

-SET &BYDISP = OFF;
SET BYDISPLAY = &BYDISP
TABLE FILE WF_RETAIL_LITE
HEADING CENTER
" BYDISPLAY = &BYDISP"
" "
SUM QUANTITY_SOLD DAYSDELAYED
BY PRODUCT_CATEGORY 
BY PRODUCT_SUBCATEG
ACROSS BUSINESS_REGION 
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image.

Changing BYDISPLAY to ON or BY displays BY field values on every row, as shown in the following image.

Changing BYDISPLAY to ACROSS displays ACROSS field values over every column, as shown in the following image.

Changing BYDISPLAY to ALL displays BY field values on every row and ACROSS field values over every column, as shown in the following image.