Subject: ARMRCALC08
Function: next(y)
Not nearly as import as the prev function, the "next" function addresses the line immediately following the current line. By definition the next of the final line on a page is always 0.
The next function is typically used when dealing with a view consisting of headers and columnar fields. Such and example was shown earlier when we described the VIEW Operation.
The next function comes primarily into play when we need to propagate one or more values in order to make them an attribute of a given set of fields; e.g. in a given data base we compute CumDebit and CumCredit as a function of Year and Month. The general structure of the summarized value pairs is as follows:
Year Month CumDebit CumCredit ---- ----- -------- --------- i j 0 r s 0 k 0 t u 0 . . etc.
We want to propagate the credit values such that the following structure is realized:
Year Month CumDebit CumCredit ---- ----- -------- --------- i j s r k u t . . etc.
The following calc code uses the "next" function so that CumDebit and CumCredit will appear on the same line.
header= Year Month columns= CumDebit CumCredit calc_start= CumDebit=max(CumDebit,next(CumDebit)) CumCredit=max(CumCredit,next(CumCredit)) calc_end=
Each Year/Month combination will fall on a distinct page. Each input page has at most two columnar lines.