The FIND/OBTAIN DBKEY statement locates a record occurrence directly by using a database key that has been stored previously by the program. The DML ACCEPT statement, discussed earlier in this chapter, or the PL/I assignment statement can be used to save a db-key. Any record in the program's subschema can be accessed directly in this manner, regardless of its location mode.
Native VSAM users: This statement is not valid for accessing data records in a native VSAM key-sequenced data set (KSDS).
Currency
After successful execution of a FIND/OBTAIN DBKEY statement, the accessed record becomes the current record of run unit, its record type, its area, and all sets in which it currently participates as member or owner. In addition, the RECORD_NAME field of the IDMS DB communications block is updated with the name of the accessed record.
Note that currency is not used to determine the specified record of the FIND/OBTAIN DBKEY statement; the record is identified by its db-key and, optionally, by its record type.
►►─┬─ FIND ───┬─┬────────────────────────┬───────────────────────────────────► └─ OBTAIN ─┘ └─ KEEP ─┬─────────────┬─┘ └─ EXCLUSIVE ─┘ ►─┬─ DBKEY (db-key-v) ─┬───────────────────────────┬─┬──────────────────────►◄ │ └─ PAGE_INFO (page-info-v) ─┘ │ └─┬────────────────────────┬─ DBKEY (db-key-v) ────┘ └─ RECORD (record-name) ─┘
Locates a record directly by using a db-key value contained in program variable storage. (db-key-v) is a FIXED BINARY(31) fullword field that identifies the location in program variable storage that contains a db-key previously saved by the program.
If a record name has been specified, (db-key-v) must contain the db-key of an occurrence of the named record type.
If a record name has not been specified and the subschema includes areas with different page information values, then:
If a record name has not been specified and all areas in the subschema have the same page information value, (db-key-v) can contain the db-key of an occurrence of any record type in the subschema.
Places a shared (KEEP) or exclusive (KEEP EXCLUSIVE) lock on the accessed record.
Specifies page information that is used to determine the area with which the db-key is associated. If neither record name nor PAGE_INFO is specified and the subschema includes areas with different page information values, the page information associated with the record that is current of rununit is used.
Note: Page information is only used if the subschema includes areas with different page information values; otherwise, it is ignored.
page-info-v is a field that identifies the location within program variable storage containing the page information associated with the specified db-key. It may be defined either as a fullword field or as a group field consisting of two halfwords.
Optionally identifies the record type of the requested record. If specified, record-name must name a record that is included in the subschema.
The following statement locates the occurrence of the HOSPITAL_CLAIM record whose db-key matches the value of a field in program variable storage called SAVED_KEY:
FIND RECORD (HOSPITAL_CLAIM) DBKEY (SAVED_KEY);
The located record becomes current of run unit, current of the HOSPITAL_CLAIM record type, current of the INS_DEMO_REGION area, and current of the COVERAGE_CLAIMS set.
Upon completion of the FIND/OBTAIN DBKEY function, the ERROR_STATUS field in the IDMS DB communications block indicates the outcome of the operation:
The request has been serviced successfully.
The area in which the named record participates has not been readied.
The db-key is inconsistent with the area in which the record is stored. Either the db-key has not been initialized properly or the record name is incorrect.
The named record is not in the subschema. The program has probably invoked the wrong subschema.
The subschema specifies an access restriction that prohibits retrieval of the named record.
The record cannot be found; record occurrence not correct type
A database file will not open properly.
The requested page cannot be found in the DMCL.
If the KEEP parameter is specified in a FIND/OBTAIN statement, and an error occurs during KEEP processing, the major code 06 is returned. For more information, see KEEP CURRENT, later in this chapter. The major code 03 is returned if an error occurs during FIND/OBTAIN processing.
|
Copyright © 2014 CA.
All rights reserved.
|
|