7.100.2 PRINT Examples

Example 1: Write an RDML program to read a regional sales file and print details of each record read.

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

SELECT     FIELDS(#DETAIL) FROM_FILE(SALEHIST)

PRINT      LINE(#DETAIL)

ENDSELECT

ENDPRINT

Example 2: 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

Example 3: Write an RDML program to read a regional sales file and print the regional subtotals only (ie: a summary report).

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

SELECT     FIELDS(#REGION #VALUE) FROM_FILE(SALEHIST)

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

PRINT      LINE(*BREAKS)

ENDSELECT

ENDPRINT