Run Unit Currencies

During the execution of your application program, the DBMS uses currency to keep track of the database location (db-key) of the most recently accessed record occurrences for the run unit, record type, set, and area. By keeping track of the most recently accessed records, currency enables you to navigate the database with a minimum of effort. Currency values determine which record occurrences are affected by DML functions requested by an application program. Upon successful execution of a DML statement, the DBMS automatically updates currency values, as appropriate.
idmscu19
During the execution of your application program, the DBMS uses
currency
to keep track of the database location (db-key) of the most recently accessed record occurrences for the run unit, record type, set, and area. By keeping track of the most recently accessed records, currency enables you to navigate the database with a minimum of effort. Currency values determine which record occurrences are affected by DML functions requested by an application program. Upon successful execution of a DML statement, the DBMS automatically updates currency values, as appropriate.
A record occurrence can be:
  • Current of run unit
  • Current of record type
  • Current of set
  • Current of area
Current of Run Unit
The record occurrence that was the object of the most recent successful FIND, OBTAIN, CONNECT, STORE, MODIFY, DISCONNECT, or ERASE function is current of run unit. Only one current record of run unit exists at any given time during program execution. That record's db-key, record type and qualifying page information are placed in the DBKEY, RECORD-NAME and PAGE-INFO fields of the IDMS communications block.
Current of Record Type
The most recently accessed occurrence of each record type is current of that record type. At any given time during program execution, one current record can exist for each record type defined in the program's subschema. For example, when your program successfully retrieves JOB 2215, that record becomes current of the JOB record type. If you then successfully obtain EMPLOYEE 466, that record becomes current of the EMPLOYEE record type; currency for the JOB record type remains unchanged.
Current of Set
The most recently accessed record occurrence in each set is current of set for that set. At any given time during program execution, one current record can exist for each set defined in the program's subschema.
Because a successfully accessed record becomes the current record of all sets in which it participates as either owner or member, a given record occurrence can be the current record of any number of sets.
Current of Area
The most recently accessed record occurrence in each area is current of area for that area. At any given time during program execution, one current record can exist for each area defined to the program's subschema.
When Currency is Established
At the beginning of a program, all currencies are null. Currency is established by the DML FIND, OBTAIN, RETURN, or STORE function. Currency is updated following each successful execution of a FIND, OBTAIN, CONNECT, DISCONNECT, ERASE, RETURN, MODIFY, or STORE statement.
How the DBMS Uses Currency
The DBMS uses currency to:
  • Establish a starting point for the execution of a DML retrieval statement by using the current position in the database with respect to run unit, record, set, or area
  • Establish proper set occurrences for STORE, CONNECT, and DISCONNECT functions
  • Determine the target record for a MODIFY or ERASE statement
  • Determine the physical placement in the database of records stored with a location mode of VIA
  • Provide the basis for saving the db-keys of related records for subsequent use by the program
  • Prevent a record that is current of record, set, or area from being updated by another application
Use and Updating of Currency by DML Verbs
The table below outlines the currency required to execute each DML verb and the changes to currency following the successful execution of that verb. The bullet symbol (&bul.) indicates currency used in command execution.
BIND and READY do not use or update currency, but both verbs must be issued before any database access is attempted.
DML verb
Run unit
Record
Set
Area
Currency updated by successful execution
ACCEPT*
&bul.
&bul.
&bul.
&bul.
None
IF*
&bul.
 
&bul.
 
None
FIND/OBTAIN DB-KEY
 
 
 
 
All
FIND/OBTAIN CURRENT*
&bul.
&bul.
&bul.
&bul.
All
FIND/OBTAIN WITHIN SET1
 
 
&bul.
 
All
FIND/OBTAIN WITHIN AREA
 
 
 
**
All
FIND/OBTAIN OWNER
 
 
&bul.
 
All
FIND/OBTAIN CALC
 
 
 
 
All
FIND/OBTAIN DUPLICATE
 
&bul.
 
 
All
FIND/OBTAIN USING SORT KEY2
 
 
&bul.
 
All
GET
&bul.
 
 
 
None
RETURN3
 
 
&bul.
 
Set
STORE
 
 
***
 
All
MODIFY
&bul.
 
 
 
None4
ERASE
&bul.
 
 
 
Nullifies currencies of all record types and sets involved
CONNECT
 
&bul.
&bul.
 
Run unit, set
DISCONNECT
 
&bul.
 
 
Nullifies currency of object set; updates current of run unit and area
KEEP*
&bul.
&bul.
&bul.
&bul.
None
COMMIT
 
 
 
 
None
COMMIT ALL
 
 
 
 
Nullifies all currencies
ROLLBACK
 
 
 
 
Nullifies all currencies
ROLLBACK CONTINUE
 
 
 
 
Nullifies all currencies
FINISH
 
 
 
 
Nullifies all currencies
*   Uses only one currency as determined by command format. **  Required for NEXT and PRIOR formats only. *** All in which record type participates as an automatic member. 1 Currency is not required if the statement specifies FIRST, LAST      or 
sequence-number
 for a system-owned indexed set. 2 Currency is not required for a system-owned indexed set. 3 Currency is not required if the statement specifies FIRST, LAST,      or USING 
index-key
. 4 Except in the case of a sorted set.