Accessing Database Records
- Set the
DB-
key fields as you would for any database inquiry routine. - Express the ending value for the range key:
MOVE identifier TO DBRNG-fieldname.
- Identify the range key by moving the symbolic constant:
MOVE <IndexName>-<IndexFieldName> TO WS-DB-SUB-RNG.
- Initialize the aggregation request. This initializes the Boolean request fields and the return values:
PERFORM 880-INIT-DBAG-<Index>.
- Set Booleans describing which fields to aggregate and what function to apply. Remember that you may apply only one function for each call.
SET DBAVG-<Index>-<FieldName> TO TRUE.
SET DBMAX-<Index>-<FieldName> TO TRUE.
SET DBMIN-<Index>-<FieldName> TO TRUE.
SET DBSUM-<Index>-<FieldName> TO TRUE.
- Submit the request:
PERFORM 880-FIND-DBAG-<Index>.
- Test for function validity by referencing the file FOUND switch:
IF (filename-FOUND) ...
- Un-reference the return values in the fields named
DBAG-<Index>-<FieldName>
:MOVE DBAG-<Index>-<FieldName> TO WS-RESULT.