Previous Topic: UsageNext Topic: IDMSDBAN


Calling the IDMSCALC Routine

The following example shows how to call the IDMSCALC routine from a user-written program.

       01  CALC-PARMS.
           05  CALC-PAGE-TARGET     PIC S9(9) COMP.
           05  CALC-PAGE-RANGE-HIGH PIC S9(9) COMP.
           05  CALC-PAGE-RANGE-LOW  PIC S9(9) COMP.
           05  CALC-KEY-LENGTH      PIC S9(4) COMP.
           05  CALC-KEY             PIC X(16).


           MOVE 75001   TO CALC-PAGE-RANGE-LOW.
           MOVE 75101   TO CALC-PAGE-RANGE-HIGH.
           MOVE 16      TO CALC-KEY-LENGTH.
           MOVE 'SMITH' TO CALC-KEY.
           CALL 'IDMSCALC' USING CALC-PARMS.
           DISPLAY 'TARGET PAGE IS ' CALC-PAGE-TARGET.

The IDMSCALC argument

The following table outlines the five-field argument that a calling program must pass to IDMSCALC.

Field

Usage

Size

COBOL Picture

Description of Field

1 (Output)

Binary

4 bytes

PIC 9(9) COMP

Target page number for storage of the record.

2 (Input)

Binary

4 bytes

PIC 9(9) COMP

Number of the highest page on which the record can be stored.

3 (Input)

Binary

4 bytes

PIC 9(9) COMP

Number of the lowest page on which the record can be stored.

4 (Input)

Binary

2 bytes

PIC 9(4) COMP

Length, in bytes, of the CALC key value.

5 (Input)

Character

1-256 bytes

PIC X(nnn)

Value of the CALC key.

Note: The information in fields 2 and 3 of IDMSCALC must match the database definition for the record type as specified in the schema.

Input

Input to the IDMSCALC utility consists of the IDMSCALC argument with fields 2-5 initialized by the calling program.

Output

The IDMSCALC utility returns a target page number for storage of a CALC record.

Note: For more information about how the CALC location mode works, see the CA IDMS Database Administration Guide.