7.21.3 DEF_BREAK Example

This example applies to the DEF_BREAK command.

Write an RDML program to read a regional sales file, print details of each record read and produce regional subtotals.

DEF_LINE   NAME(#DETAIL) FIELDS(#REGION #PRODES #VALUE)

DEF_BREAK  NAME(#REGTOT) FIELDS(#REGVAL) TRIGGER_BY(#REGION)

SELECT     FIELDS(#DETAIL) FROM_FILE(SALEHIST)

KEEP_TOTAL OF_FIELD(#VALUE) IN_FIELD(#REGVAL) BY_FIELD(#REGION)

PRINT      LINE(#DETAIL)

ENDSELECT

ENDPRINT

Refer also to Producing Reports Using LANSA.