Using Special Functions with A and F Codes

When the special counter operands NB (number breaks), ND (number detail lines), or NI (number items) are used, or when the LPV (load previous value) operator is used with the A or the F codes, they can sometimes be used as conversions and placed in line 7. The LPV operator loads the value obtained from a previous correlative operation.

The table below shows the five counter operands that can be used with both the A and the F codes.

Operand

Description

NB

Break-level counter. Used only as a conversion in line 7.

ND

Detail line counter. Used only as a conversion in line 7.

NI

Item counter. Can be used either as a correlative in line 8 or as a conversion in line 7.

NV

Value counter. Used only as a correlative in line 8.

NS

Subvalue counter. Used only as a correlative in line 8.

The NB operand works only with INFO/ACCESS statements that contain the BREAK-ON modifier. NB returns the current break level. The lowest break level has a value of 1, a grand-total line has a value of 255.

The ND operand returns the number of detail lines since the last control break. On a detail line it has a value of 1, on a grand-total line it has the value of the item counter. ND can be used to calculate averages in conjunction with control breaks.

The NI operand returns the number of items selected or listed.

NV and NS return the number of values or subvalues (respectively) contained in the item being processed. NV and NS are for columnar listing only.

The LPV (Load Previous Value) operator takes the result of a previous correlative operation and uses it for further processing. The code with the LPV operator is specified in line 7, and the correlative that generates the previous value is specified in line 8. The previous value becomes an operand in an A code and an element in an F code; it must be the first element specified in an F code, otherwise strange results may be obtained.

In example below, the F code in line 8 first multiplies the contents of Attribute 2 by the contents of Attribute 3. Then the F code in line 7 divides the result by 100.

007 F ; LPV ; "100" ; /

008 F ; 2 ; 3 ; *

See Also

Advanced Topics

Using Correlatives as Conversions and Vice Versa

Applying Conversion Operations Before Correlative Operations

Using Conversion Codes Within a Correlative

Combining Correlatives and Conversions

Adjusting Division Operations