Thu Jan 28 1999

ARMRCALC

Subject: ARMRCALC12

Function: max(y,z)


x=max(y,z)

Purpose

Use the maximum function when you want to select the larger of two values.

Example

Let's do another propagation exercise. This time consider book view of an accounts receivable data base. Each page of the book represents a unique invoice number. Invoice dates appear in the columnar portion. We want to collapse the data base as part of an archive exercise. In particular, we need to propagate the earliest date over all records on the page. The calc program to do this is as follows:

      ;
      ;  replace invoice dates by the earliest date
      ;
      header= Inv_Num
      columns= Date calc

      calc_start=
         calc=prev(calc)+1
         delta=max(0,1-prev(calc))
         Date=prev(Date)+delta*Date
      calc_end=

              input            intermediate     output
            ---------          ------------  --------------
              Date                delta      calc    Date
            --------             --------    ----  --------
            06/29/93 max(0, 1)=     1         1    06/29/93
            08/23/93 max(0,-1)=     0         2    06/29/93
            10/31/93 max(0,-2)=     0         3    06/29/93