Previous Topic: ACCEPT BIND RECORDNext Topic: ACCEPT DBKEY RELATIVE TO CURRENCY


ACCEPT DBKEY FROM CURRENCY

The ACCEPT DBKEY FROM CURRENCY statement moves the db-key and optionally the page information of the current record of run unit, record type, set, or area to a specified location in program variable storage. By using a FIND/OBTAIN DBKEY statement, you can directly access records whose db-keys you save using the ACCEPT DBKEY FROM CURRENCY statement.

Currency

ACCEPT DBKEY FROM CURRENCY does not update currencies.

Syntax
►►─── ACCEPT CURRENCY ─┬────────────────────────┬───────────────────►
                       ├─ RECORD (record-name) ─┤
                       ├─ SET (set name) ───────┤
                       └─ AREA (area-name) ─────┘

 ►─ INTO (db-key-field)─┬─────────────────────────────────────┬─ ; ─►◄
                        └ PAGE INFO INTO (page-info-location ─┘
Parameters
RECORD (record-name)

Saves the db-key of the record current of the specified record type into the location specified by db-key-field.

SET (set-name)

Saves the db-key of the record current of the specified set into the location specified by db-key-field.

AREA (area-name)

Saves the db-key of the record current of the specified area into the location specified by db-key-field.

INTO (db-key-field)

Identifies the location in variable storage that will contain the db-key of the specified record. Db-key-field must be a FIXED BINARY(31) field.

Note: If you omit the RECORD, SET, or AREA qualifiers, the DBMS saves the db-key of the record current of run unit.

INTO (page-info-location)

Specifies the name of the four-byte field that can be defined either as a group field or as a fullword field (PIC S9(8) COMP). Identifies the location in variable storage that contains page information for the specified record type. Upon successful completion of this statement, the first two bytes of the field contain the page group number and the last two bytes contain a db-key radix that can be used for interpreting dbkeys.

Example

The following example:

  1. Establishes a record, named EMPLOYEE, as current of run unit
  2. Saves the record's db-key in a location named SAVED_DBKEY and saves the page information of the record in a location named SAVED_PGINFO, using the ACCEPT DBKEY FROM CURRENCY statement
  3. Accesses the EMPLOYEE record occurrence using the saved db-key
    EMP_ID_0415 = EMP_ID_IN;
    FIND CALC RECORD (EMPLOYEE);
    ACCEPT CURRENCY INTO (SAVED_DBKEY) PAGE_INFO INTO (SAVED_PGINFO);
     .
     .
     .
    OBTAIN DBKEY (SAVED_DBKEY);
    
Status Codes

Upon completion of the ACCEPT DBKEY FROM CURRENCY function, the ERROR_STATUS field in the IDMS DB communications block indicates the outcome of the operation:

0000

The request was serviced successfully.

1506

Currency was not established for the named record or set.

1508

The subschema does not contain the named record or set. Your program probably invoked the wrong subschema.

1523

The subschema does not contain the named area.