Previous Topic: IDMSCALCNext Topic: IDMSIN01


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 (bytes)

COBOL Picture

Field Description

1 (Output)

Binary

4

PIC S9(9) COMP

Specifies the target page number for storage of the record.

2 (Input)

Binary

4

PIC S9(9) COMP

Specifies the number of the highest page on which the record can be stored.

3 (Input)

Binary

4

PIC S9(9) COMP

Specifies the number of the lowest page on which the record can be stored.

4 (Input)

Binary

2

PIC S9(4) COMP

Specifies the length, in bytes, of the CALC key value.

5 (Input)

Character

1-256

PIC X(nnn)

Specifies the 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.

More Information:

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