Accessing Database Records

  1. Set the DB- key fields as you would for any database inquiry routine.
  2. Express the ending value for the range key:

    MOVE identifier TO DBRNG-fieldname.

  3. Identify the range key by moving the symbolic constant:

    MOVE <IndexName>-<IndexFieldName> TO WS-DB-SUB-RNG.

  4. Initialize the aggregation request. This initializes the Boolean request fields and the return values:

    PERFORM 880-INIT-DBAG-<Index>.

  5. 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.

  6. Submit the request:

    PERFORM 880-FIND-DBAG-<Index>.

  7. Test for function validity by referencing the file FOUND switch:

    IF (filename-FOUND) ...

  8. Un-reference the return values in the fields named DBAG-<Index>-<FieldName> :

    MOVE DBAG-<Index>-<FieldName> TO WS-RESULT.