IDMS DML Statements:

Access records based on Symbolic key ( CALC key) :

Obtain calc

CALC key must be populated before executing the statement.

To access the records with duplicate symbolic key:

Obtain duplicate

Obtain calc should be done prior to Obtain duplicate. This statement can not be executed for Duplicates Not Allowed option.

To access records based on Database key:

Obtain db-key is
DB key must be populated before executing the statement. Database key format is S9(8) COMP in Cobol.

To access Owner record of the member:

Obtain owner within

To access the member records from Owner record:

Obtain [next/prior/first/last/] within

Seq.no is an integer assigned to records in a set at a given time. Seq.no can be a literal or a variable. Obtain first/last/next/prior can result in END-OF-SET condition.

To access all records of a record type in the area or in the database:

Obtain [next/prior/first/last/] within

To access records based on currencies:

Obtain current
Obtain current within
Obtain current within

To access a member record based on sort key value from the owner record:

Obtain within using

Sort field should be populated before Obtain statement. First record satisfying the value is accessed. If record not found, next/prior currencies get updated as if the record was present at that position in the set.

The Obtain statement can be broken up into two distinct operations, Database operations and refreshing record structure. When an Obtain statement is given the IDMS does the following:
Navigates the database to locate appropriate record. Update the currencies. And copies record occurrence from database to record structure.

Find is a DML statement that does only database operations. The syntax for Find is the same as Obtain.

Get is a DML statement that refreshes record structure based on currencies of record type, or the most recent record occurrence accessed thru Find/Obtain.

Get

Thus Obtain is equivalent to Find followed by Get operation.

To modify a record:

Modify

Record should be accessed by Obtain before Modify statement is executed. The new record value should be populated before Modify. Record should be current of run-unit before Modify. Calc key should not be modified.

To insert a record in database:

Store

The above statement creates record in the database and connects stored record to owner in Automatic sets. Owner records of those sets need to be made current before executing the statement. Also set currency needs to be established. Calc key and sort field also should be populated.

Delete the record:

Erase

Record should be made current of run-unit before executing the statement. If record has any members in any set occurrence then it is not deleted. Delete is the form of RESTRICTED.

To Delete a record, delete mandatory, disconnect optional:

Erase Permanent

Record should be made current of run-unit before statement execution. Record will be deleted. Member records on Mandatory sets are also deleted. Member records on Optional sets are disconnected. Deletes are cascaded. Deletion is of the form NULLIFY/CASCADE

To Delete a record, delete mandatory, delete/disconnect optional:

Erase Selective
Record should be made current of run-unit before statement execution. Record will be deleted. Member records on Mandatory sets are also deleted. If Members of Optional sets are also members on some other sets, then they are disconnected. If Members of Optional set are not members of any other sets, then they are deleted. Deletes are cascaded. Delete is of the form Selective NULLIFY/CASCADE.

To delete a record and all members, cascade deletes

Erase All

Record should be made current of run-unit before statement execution. Record will be deleted. All Member records on all sets are deleted. Deletes are cascaded. Delete is of the form CASCADE.

To detect an empty set occurrence of a specific set:

If is empty
If is not empty

The above statements check the existence of member records in a set. The DML IF statement is different from COBOL IF. It is equivalent to Obtain/Find First failure or success.

To detect whether a member is a part of set occurrence on a specific set:

If member
If not member

The above statements check if a member records is connected to an owner record on a specific set or not. To execute the above statements member record should be current of run-unit.

To connect a member record to a set occurrence:

Connect to

The above statement connects a record occurrence to a set occurrence. Record occurrence should be an isolated occurrence. Owner record needs to be made current before statement execution. It needs membership option for Storage to be Manual. It is also relevant for Optional-Automatic membership.

To disconnect a member record from a set occurrence:

Disconnect from

The above statement disconnects a record occurrence from a set occurrence. Record occurrence would then be an isolated occurrence. The membership option is needed for Removal to be Optional.

To access database keys (DBKEYS) of record occurrences:

Accept from currency
Accept from currency
Accept from currency
Accept from [next/prior/owner] currency

Bind RUN-UNIT: It identifies IDMS communication block of program to DBMS. It determines the subschema to be loaded for run-unit. It enables program to sign on to database.

Bind
Bind statement establishes addressability of record structure with DBMS. It tells DBMS the address of record.

Ready Usage Mode
SHARED/PROTECTED/EXCLUSIVE
RETRIEVAL/UPDATE
Ready statement requests access to database areas, and in turn records. It also specifies modes of access of areas.
Access modes in Ready statement and their functionality:

RETRIEVAL: Read only operations.
UPDATE: Read and create/modify/delete.
SHARED: Other run units can concurrently access.
PROTECTED: Other run units cannot ready in UPDATE mode.
EXCLUSIVE: Other run units cannot ready in ANY mode.

Finish.

Finish statement terminates run-unit, releases all resources associated with run-unit and writes checkpoint to journal.

Commit.
Commit statement requests IDMS to write checkpoint and makes permanent changes to
database for the unit of work. Commit statement can be used in two different ways Commit and Commit All

COMMIT
Commit statement releases all locks except implicit shared locks. It also writes the checkpoint. Commit does not affect currencies.

COMMIT ALL
COMMIT ALL statement releases all locks and writes a checkpoint. Commit All nullifies currencies.

Rollback.

Rollback statement requests IDMS recovery of unit of work and undoes the
changes to database. Rollback statement can be used in two different ways
Rollback and Rollback Continue.

ROLLBACK.
ROLLBACK statement requests recovery of unit of work and terminates run unit.

ROLLBACK CONTINUE.

ROLLBACK CONTINUE requests recovery of unit of work and does not terminate run unit.