Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example 1: The following RDML program asked the user to input an order number and then prints details of the order and its associated order lines.

...

          GROUP_BY  NAME(#ORDERDET) FIELDS(#ORDNUM #CUSTNUM #DATEDUE #ORDLIN #PRODUCT #QUANTITY #PRICE)
L1:  REQUEST   FIELDS(#ORDNUM)

...

          FETCH     FIELDS(#ORDERDET) FROM_FILE(ORDHDR) WITH_KEY(#ORDNUM) NOT_FOUND(L1) ISSUE_MSG(*YES)

...

          SELECT    FIELDS(#ORDERDET) FROM_FILE(ORDLIN) WITH_KEY(#ORDNUM)

...

          UPRINT    FIELDS(#ORDERDET)

...

         ENDSELECT

...

         ENDPRINT

Example 2: If a file called ACCOUNT contains the following fields and data:

...

and if the file is keyed by #COMP, #DIV and #DEPT, then the following RDML program will produce a paginated report with subtotals from this file:

     GROUP_BY  NAME(#ACCOUNTS)  FIELDS((#COMP *TOTLEVEL1 *NEWPAGE) (#DIV  *TOTLEVEL2) (#DEPT  *TOTLEVEL3) (#EXPEND *TOTAL) (#REVNU  *TOTAL))
SELECT    FIELDS(#ACCOUNTS) FROM_FILE(ACCOUNT)
UPRINT    FIELDS(#ACCOUNTS)
ENDSELECT
ENDPRINT

The following points about the field attributes should be noted:

...

Note this RDML program could also have been coded as:

     SELECT     FIELDS(#COMP #DIV #DEPT #EXPEND #REVNU) FROM_FILE(ACCOUNT)
UPRINT     FIELDS((#COMP *TOTLEVEL1 *NEWPAGE) (#DIV  *TOTLEVEL2) (#DEPT  *TOTLEVEL3) (#EXPEND *TOTAL) (#REVNU  *TOTAL))
ENDSELECT
ENDPRINT