Professional Documents
Culture Documents
TITLE
IDMS/
R
Overview
IDMS is a network database.
A network data model is regarded as an extension of hierarchical model. The
principle difference between the two is that in a hierarchic model, a child is
associated with only one type of parent record, whereas in a network model it can
be associated with many types.
A network database consists of records, which actually hold information as a set of
links between records, which form relationships.
Overview
IDMS (Integrated Data Management System) was developed by Cullinet Software
Inc. It was enhanced and is currently supported by Computer Associates (CA).
Initially IDMS was developed to run on IBM mainframes, however of late, versions
for other environments have also been developed.
IDMS centralizes the data used by an organization but does not prevent data from
being arranged in different ways to suit different applications. All data records are
treated as members of one cohesive storage facility, i.e. the database.
The database contains a single definition for each data record. Records are
connected in different logical groups called Sets, expressing various arrangements
between records as required by applications
Page
Areas
Record type
A Record type is the structural component that conveys the format in which records are stored.
Record type is a generic group of similar record occurrences that would exist in the database.
Record Occurrence
A Record occurrence is the actual content of data that is stored; it can be thought as the substance of information stored in
the database.
Record occurrence is the basic addressable unit of data under IDMS database.
Record occurrences are always related to a specific Record type, and reside in pages.
Each record occurrence can be fixed or variable in length.
A record occurrence is further subdivided into fields or data elements based on its structure.
DBKEY
Database key or DBKEY is a unique identifier for each record occurrence
within the database. DBKEY comprises of two components Page number and
Line number within a page.
The Prefix consists of pointers such as those pointing to the NEXT, PRIOR
and OWNER record. Each pointer is in form of a DBKEY. The pointer refers to
physical location of another record occurrence that is related to the one
containing the pointer.
The Data is the set of bytes that represents the record value; it may have
some internal structure that is defined by the application developer
Location Mode
The assignment of record to a particular page in its area is determined by the location mode.
CALC
Location Mode
VIA
DB-Key
Each record occurrence is assigned a unique numeric identifier, called its database key (dbkey). Format of db-key is shown below.
A record occurrences db-key consists of a 32-bit field that typically contains a 23-bit page
number and an 8-bit line number. The page number identifies the page in which the record
occurrence is stored and the line number identifies the location of the record occurrence
within that page.
IDMS/R uses database keys to keep track of where in the database record occurrences are
physically stored.
Sign Bit (Not used)
31
Sets
A Set expresses relationships or association between two record types, where one is the super
ordinate and other is the sub ordinate.
The super ordinate record type is called the OWNER record and the subordinate record type is called
the MEMBER record.
A set associates one owner record occurrence with one or more member record occurrences; it
establishes a one-to-many relationship.
A Set Type defines the structural components of a set, or the attributes of a set.
A Set Occurrence comprises of an owner record occurrence along with its associated member record
occurrences.
There exists one set occurrence for each owner record occurrence.
In case of a NULL set, an owner record may be the only one in the set occurrence if it does not have
any associated member records.
Sets Type
SetName
Sets Type
Set Order
Removal Options
STORAGE OPTION
this is default
members automatically connected while insertion
members disconnected while deletion
MM - Mandatory Manual
OA - Optional Automatic
OM - Optional Manual
D1
Joshi
Patil(2)
Verm
a
Patil(1)
With the DF duplicates option, a record with a duplicate sort-key value is stored
immediately before the existing duplicate record in the set. The first duplicate
record encountered in the next direction is always the most recently stored
duplicate record.
D1
Joshi
Patil(1)
Verm
a
Patil(2)
With the DL duplicates option, a record with a duplicate sort-key value is stored
immediately after the existing duplicate record in the set. The last duplicate record
encountered in the next direction is always the most recently stored duplicate record.
D1
Try to insert Patil(2).
Joshi
Verma
It is rejected.
IDMS/R returns an error code.
Patil(1)
With the DN duplicates option, a record with a duplicate sort-key value cannot
be stored in the set. When a program attempts to store a record with a duplicate
sort-key value, the DBMS returns an error code.
Error Handling
ERRORSTATUS
Field Values
0000
Condition
Name
Explanation
DB-STATUS-OK
Successful
0307
DB-END-OF-SET
0326
DB-REC-NOTFOUND
0001 To
9999
ANY-ERRORSTATUS
First
Last
Next
Prior
Nth
<Record-Name>
within
<Set-Name>
RETRIEVE-REC.
OBTAIN NEXT EMPLOYEE WITHIN DEPT-EMPLOYEE.
IF DB-STATUS-OK
DISPLAY EMP-NAME-0415
ELSE
IF DB-END-OF-SET
MOVE Y TO WS-END-SET
ELSE
PERFORM IDMS-STATUS.
Indexed Set
To implement an index, IDMS/R builds an index file that contains the database key values of
member record occurrences.
IDMS/R uses an array of database pointers to quickly access member records. DBMS locates the
data by searching the index rather than the actual member record.
E.g. Employee record has an index built on last-name and first-name fields, apart from CALC
key.
The use of indexes can simplify processing in the following situations:
Random retrieval by key value. Partial or generic key value can be used.
Sorted retrieval by key value.
Multiple-key access. Sometimes we need to access records based on more than one key.
Each entry in the index contains an index-key data element value and the db-key value of its
corresponding record occurrence.
Random Retrieval
OBTAIN SKILL WITHIN SKILL-NAME-NDX
USING SKILL-NAME-0455.
Expected return-codes are DB-STATUS-OK, DB-REC-NOT-FOUND.
Sequential Retrieval
OBTAIN NEXT EMPLOYEE WITHIN EMP-NAME-NDX.
Expected return codes are DB-STATUS-OK, DB-END-OF-SET.
Generic-Key Retrieval
Same as Sorted Set.
First
Last
Next
Prior
Nth
<Record-Name>
within
<Area-Name>
Pointers are not used in performing an area sweep, so prior pointers are not necessary for
executing OBTAIN PRIOR WITHIN AREA statements.
Expected return-codes are DB-STATUS-OK, DB-END-OF-SET.
<record-name>
ACCEPT <ws-db-key-v> FROM <set-name>
CURRENCY
<area-name>
MOVE DBKEY TO ws-db-key-v.
The field ws-db-key-v should be defined in working-storage as follows.
01
ws-db-key-v
Currencies
Currencies are maintained in form of DBKEYS of most recently accessed records by application programs. The
currencies enable application programs to position itself and move about record occurrences within the
database.
Types of Currencies:1)Run Unit 2)Record Type 3)Set 4)Area
Currencies
RUNUNIT
most recent record occurrence accessed in each area accessed by the program
Currencies
BIND RUN-UNIT statement sets all the currencies to NULL.
Successful DML statement changes the currencies involved. The other
currencies remain null until some future database access sets them.
Using the currencies and the NPO pointers stored in record occurrences, IDMS/R DBMS accesses
records in the database.
FINISH statement nullifies all the currencies.
Currency Loss
Re-establishing Currency
IF EMPTY statement
Example:
IF Member statement
STORE
STORE <rec-name>
It is used to add a new record occurrence to the database. Adding a new record occurrence to the database is a simple
threestep process:
Construct the new record occurrence in the working-storage section.
Establish currency of the set types in which the new record participates as an automatic member. We can use FIND for this
purpose.
Execute the STORE function specifying the record type name.
Example:
Notes:
Creates record in the database
Connects stored record to owner in Automatic sets
Owner records of those sets need to be made current
Set currency needs to be established
Calc key and sort field should be populated
MODIFY
Example:
Notes:
Record should be accessed by Obtain before Modify
Record should be populated before Modify
Record should be current of run-unit before Modify
Calc key should not be modified
Modification of record in sorted set may be expensive
ERASE
MEMBERS
ERASE
ERASE
CONNECT
DISCONNECT
Syntax:
Accept <database key> from <record name> currency
Notes:
Accesses database key for a record
Storage format for database key is S9(8) COMP.
BIND STATEMENTS
BIND RUN-UNIT
identifies IDMS communication block of program to DBMS
identifies subschema to be loaded for run-unit
enables program to sign on to database
Bind <record name>
establishes addressability of record structure with DBMS
tells DBMS the address of record in variable storage
READY STATEMENTS
FINISH STATEMENTS
terminates run-unit
releases all resources associated with run-unit
writes checkpoint to journal
COMMIT STATEMENTS
Commit requests IDMS to write checkpoint, makes changes to database permanent for the
unit of work. Commit has two variations, i.e Commit and Commit All
Commit
Commit All
ROLLBACK STATEMENTS
Rollback
Rollback requests IDMS recovery of unit of work, undoes the changes to database.
Rollback has two variations, i.e. Rollback and Rollback Continue
Rollback
request recovery of unit of work
terminates run unit
Rollback Continue
requests recovery of unit of work does not terminate run unit IDMS returns a 4 character
error code after executing every DML statement. When DML statements are embedded in
COBOL programs, IDMS returns error code in a variable called ERROR-STATUS, error code
0000 indicates that the DML statement has executed successfully.