Macro Examples

Heading

To simplify the statement to be entered at the TCL prompt, you could define macros to perform specific clauses such as those listed below:

AMOUNT.DUE.HEAD specifies a heading;

SORT.BILLING specifies a sort;

BILLING.FORMAT has output and format specifications.

In addition, you could define a macro to call these individual macros: OUTPUT.BILLING is an example of such a macro.

AMOUNT.DUE.HEAD
001  M
002  HEADING "AMOUNT DUE 'C80' 'D' 'L'"
SORT.BILLING
001  M
002  BY BILL-CODE
BILLING.FORMAT
001  M
002  * OUTPUT AND FORMAT SPECIFICATION
003  BILL-CODE BILL-AMOUNT BILL-DESC
004  BREAK-ON ROOM
005  TOTAL BILL-TOTAL "'L'"
006  GRAND-TOTAL "Amounts Outstanding:"
007  HDR-SUPP
OUTPUT.BILLING
001  M
002  * STANDARD FORMAT FOR BILLINGS
003  BILLING.FORMAT
004  SORT.BILLING
005  AMOUNT.DUE.HEAD

Sample Sentences

An English sentence using the first three macro examples can be constructed as follows:

:SORT GUESTS WITH BILL-TOTAL > "245.00" SORT.BILLING AMOUNT.DUE.HEAD BILLING.FORMAT

If the macro that contains calls to the other macros is used, the sentence entered at the TCL prompt, is as follows:

:SORT GUESTS WITH BILL-TOTAL > "245.00" OUTPUT.BILLING 

Sample Report

Whether the sentence invokes individual macros, as shown above, or the macro calls other macros, the resulting report is the same.

:SORT GUESTS WITH BILL-TOTAL > "245.00" OUTPUT.BILLING

                      AMOUNT DUE 12/02/94
GUESTS   Bill   Amount..   Description..   Room..   Bill Total
         Code
                          *
411        2       $93.00  Room            411      $249.76
          10       $45.00  Rest. (Bar)
           2       $93.00  Room
           4       $18.00  Breakfast
                                           ***      $249.76
535        2       $98.00  Room            535      $281.42
          13       $45.00  Bar (2)
          15       $33.77  Telephone
           2       $98.00  Room
           5       $6.65   Lunch
                                           ***      $281.42
Amounts Outstanding                                 $531.18