Idms Simplified

18
IDMS at a Glance Page 1 of 18 IDMS - A Network Database 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. 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 Database is subdivided into number of pages. Smallest unit of data transfer between auxiliary and main memory Page size is typically 2k or 4k bytes Record occurrences are stored in pages Each page has a unique page number Each record within the page has a unique line number AREAS

Transcript of Idms Simplified

Page 1: Idms Simplified

IDMS at a Glance Page 1 of 14

IDMS - A Network Database

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.

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

Database is subdivided into number of pages. Smallest unit of data transfer between auxiliary and main memory Page size is typically 2k or 4k bytes Record occurrences are stored in pages Each page has a unique page number Each record within the page has a unique line number

AREAS

Pages in the database are grouped into areas Pages in an area are sequentially numbered Gaps in page numbers can occur between areas A page can belong to one and only one area All pages of an area are of the same size All record occurrences of one type reside in one area

FILES

All areas of the database are stored in one or more files Entire database is mapped onto one file Each area is mapped onto a different file Many areas are mapped onto one file One area mapped onto many filesPAGES, AREAS, FILES, RECORDS TYPE & OCCURRENCE

Page 2: Idms Simplified

IDMS at a Glance Page 2 of 14

Application programs use Record types and Record occurrences to handle data in IDMS.

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 & RECORD OCCURRENCE

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.

DBKEY of a record occurrence does not change as long as the occurrence exists in the database.

Each record occurrence has two components: Prefix and Data:

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

record stored on or near a page calculated by IDMS page calculation is based on symbolic key value retrieval of record based on symbolic key value hashing algorithm employed for retrieval IDMS converts symbolic key into record address can have duplicates clause as DF/DL/DN

VIA

Page 3: Idms Simplified

IDMS at a Glance Page 3 of 14

cluster member records with their respective owners minimize disk accesses needed to retrieve members groups records that are likely to be retrieved at the same time records on the same page or close to owner record

DIRECT

record placed in user specified page used when storing records in physical sequential order

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.

RUN UNIT

most recently accessed record by the program

RECORD TYPE

most recent record occurrence accessed for each record type

SET

most recent record occurrence accessed in each set, either the owner or the member

AREA

most recent record occurrence accessed in each area accessed by the program

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.

Page 4: Idms Simplified

IDMS at a Glance Page 4 of 14

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

A Set type consists of the following.

Set Name

unique name of the set

Set Mode

type of linkage between the owner and member mode is either CHAIN or INDEX CHAIN implies embedded pointers to navigate INDEX implies using index to navigate

Set Linkage

type of pointers used in member records NEXT: each member record points to the next in the set PRIOR: each member record points to the previous in the set OWNER: each member record points to it’s owner

Set Order

specifies where a new record is to be placed during insertion FIRST: new record placed first in the set LAST: new record placed last in the set NEXT: new record placed next to the current record PRIOR: new record placed previous to the current record SORTED: new record placed based sort key value

SETS

Set Membership

Removal Options

These are also known as Disconnect or Erase options Removal options are MANDATORY or OPTIONAL MANDATORY: member is disconnected only when erased OPTIONAL: member can be disconnected and can remain in the database

Storage Options

These are also known as Connect options Storage options are MANUAL or AUTOMATIC

Page 5: Idms Simplified

IDMS at a Glance Page 5 of 14

AUTOMATIC: member automatically connected when created MANUAL: member not connected when created

SETS

Membership Options

MA - Mandatory Automatic

this is default members automatically connected while insertion members disconnected while deletion MM - Mandatory Manual

owner not identified at the time of insertion of member hence member created but left isolated member connected when owner is identified

OA - Optional Automatic

members automatically connected while creation need to disconnect and keep isolated from owner to be possibly connected to some other owner

OM - Optional Manual

owner not identified at the time of insertion members connected when owner is identified members need to be disconnected and left isolated from owner to be connected to other owner

How to access a record based on symbolic key

Syntax: Obtain calc <record name>

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT.If DB-REC-NOT-FOUND

....

Notes: Accesses record based on calc key value Calc key should be populated before statement is executed

How to access records with duplicate symbolic key values

Syntax: Obtain duplicate <record name>

Page 6: Idms Simplified

IDMS at a Glance Page 6 of 14

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT...Obtain duplicate DEPT.

Notes: Accesses next record with duplicate calc key value Obtain calc should be done prior to Obtain duplicate cannot be executed for Duplicates Not

Allowed option

How to access a record based on Database key (DBKEY)

Syntax: Obtain <record name> db-key is <database key>

Example:

Obtain DEPT db-key is WS-DBKEY.

Notes: Accesses record based on database key value Database key comprises of page no., line no. Database key format is S9(8) COMP in Cobol Database key can be accessed by ACCEPT

Having accessed a member record, how to access it’s owner record on a specific set

Syntax: Obtain owner within <set name>

Example:

Move ‘0001’ to EMP-CODE.Obtain calc EMP....Obtain owner within DEPT-EMP.

Notes: Accesses owner record of a member record, on a specific setHaving accessed an owner record, how to access it’s member records in various ways

Syntax: Obtain [next/prior/first/last/<seq.no>] <record name> within <set name>

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT....Obtain first EMP within DEPT-EMP.If DB-END-OF-SET

Page 7: Idms Simplified

IDMS at a Glance Page 7 of 14

...Notes: Accesses member records of an owner record Access is on a specific set Seq.no can be a literal or a variable Seq.no is an integer assigned to records in a set at a given time Seq.no of a record/s can change when records are added/deleted in a set Obtain first/last/next/prior can fail, it results in END-OF-SET condition

How to access all records of a record type in the area or in the database

Syntax: Obtain [next/prior/first/last/<seq.no>] <record name> within <area name>

Example:

Obtain first EMP within DEPT-AREA.If DB-END-OF-SET

...

Notes:

Accesses records occurrences of a record type Possible to retrieve all record occurrences Undetermined order when records are retrieved

How to access records based on currencies that IDMS maintains

Syntax: Obtain current <record name>Obtain current within <set name>Obtain current within <area name>

Example:

Obtain current DEPT.Obtain current within DEPT-EMP.Obtain current within DEPT-AREA.

Notes: Accesses records based on record type, set and area currency

Having accessed an owner record, how to access a member record based on sort key value

Syntax: Obtain <record name> within <set name> using <sort field>

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT.

Page 8: Idms Simplified

IDMS at a Glance Page 8 of 14

Move ‘John’ to EMP-NAME.Obtain EMP within DEPT-EMP using EMP-NAME.If DB-REC-NOT-FOUND

...

Notes: Sort field should be populated before Obtain 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

Navigation & Refresh

For any Obtain instruction, IDMS does the following

Navigates the database to locate appropriate record Updates currencies Transfers record occurrence from database to record structure

Thus Obtain is broken up into two distinct operations, Database operations and refreshing 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 through Find/Obtain.

The syntax for Get is

Get <record type>

Thus Obtain is equivalent to Find followed by Get operation Having accessed a record, how to modify it

Syntax: Modify <record name>

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT.......Find current DEPT.Move 20 to DEPT-COUNTModify DEPT

Notes: Record should be accessed by Obtain before Modify

Page 9: Idms Simplified

IDMS at a Glance Page 9 of 14

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

How to create a record in the database

Syntax: Store <record name>

Example:

Move ‘0001’ to DEPT-CODE.Move ‘Finance’ to DEPT-NAME.Move 120 to DEPT-COUNT.Store DEPT.

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

Having accessed a record, how to delete it

Syntax: Erase <record name>

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT.......Find current DEPT.Erase DEPT

Notes: Record should be made current of run-unit If record has any members in any set occurrence then it is not deleted Deletion is of the form RESTRICTED

Delete a record, delete mandatory, disconnect optional

Syntax: Erase <record name> Permanent

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT.......

Page 10: Idms Simplified

IDMS at a Glance Page 10 of 14

Find current DEPT.Erase DEPT Permanent

Notes: Record should be made current of run-unit Record is deleted Member records on Mandatory sets are deleted Member records on Optional sets are disconnected Deletes are Cascaded Deletion is of the form NULLIFY/CASCADE

Delete a record, delete mandatory, delete/disconnect optional

Syntax: Erase <record name> Selective

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT....Find current DEPT.Erase DEPT Selective.

Notes: Record should be made current of run-unit Record is deleted Member records on Mandatory sets are 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 Deletion is of the form Selective NULLIFY/CASCADEDelete a reord, all members, cascade deletes

Syntax: Erase <record name> All

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT....Find current DEPT.Erase DEPT All

Notes: Record should be made current of run-unit Record is deleted All Member records on all sets are deleted Deletes are Cascaded Deletion is of the form CASCADE

Having accessed an owner record, how to detect an empty set occurrence of a specific set

Page 11: Idms Simplified

IDMS at a Glance Page 11 of 14

Syntax: If <set name> is emptyIf <set name> is not empty

Example:

Move ‘0001’ to DEPT-CODE.Obtain calc DEPT....If DEPT-EMP is empty Move ....

Notes: Checks the existence of member records in a set If is a DML statement, different from COBOL If Equivalent to Obtain/Find First failure or success

Having accessed a member record, how to detect whether it is a part of set occurrence on a specific set

Syntax: If <set name> memberIf not <set name> member

Example:

Move ‘0001’ to EMP-CODE.Obtain calc EMP....If DEPT-EMP member Move ....

Notes: Checks if a member records is connected to an owner record on a specific set Member record should be current of run-unit Relevant on Optional sets, where records can be disconnected

Having accessed a member record, how to connect it to a set occurrence

Syntax: Connect <record name> to <set name>

Example:

Move ‘TRG’ to DEPT-CODE.Obtain calc DEPT.Move ‘0001’ to EMP-CODE.Obtain calc EMP....Connect EMP to DEPT-EMP.

Notes: Connects a record occurrence to a set occurrence Record occurrence should be an isolated occurrence

Page 12: Idms Simplified

IDMS at a Glance Page 12 of 14

Owner record needs to be made current Needs membership option for Storage to be Manual Also relevant for Optional-Automatic membership

Having accessed a member record, how to disconnect it from a set occurrence

Syntax: Disconnect <record name> from <set name>

Example:

Move ‘0001’ to EMP-CODE.Obtain calc EMP....Disconnect EMP from DEPT-EMP.

Notes: Disconnects a record occurrence from a set occurrence Record occurrence would then be an isolated occurrence Needs membership option for Removal to be Optional

How to access database keys (DBKEYS) of record occurrences

Syntax:Accept <database key> from <record name> currency

Accept <database key> from <set name> currency

Accept <database key> from <area name> currency

Accept <database key> from <set name>[next/prior/owner] currency

Example:

Move ‘0001’ to EMP-CODE.Obtain calc EMP.Accept WS-EMP-DBKEY from EMP currency.

Notes: Accesses database key for a record Storage format for database key is S9(8) COMP.

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

Page 13: Idms Simplified

IDMS at a Glance Page 13 of 14

tells DBMS the address of record in variable storage

Ready <area name> Usage ModeSHARED/PROTECTED/EXCLUSIVERETRIEVAL/UPDATE

requests access to database areas, and in turn records specifies modes of access of areas

RETRIEVAL: read only operationsUPDATE: read and create/modify/delete

SHARED: other run units can concurrently accessPROTECTED: other run units cannot ready in UPDATEEXCLUSIVE: other run units cannot ready in ANY

Finish

terminates run-unit releases all resources associated with run-unit writes checkpoint to journal

AREA USAGE MODE (1) (2) (3) (4) (5) (6)

SU SR PU PR EU ER

(1) Shared Update Y Y N N N N

(2) Shared Retrieval Y Y Y Y N N

(3) Protected Update N Y N N N N

(4) Protected Retrieval N Y N Y N N

(5) Exclusive Update N N N N N N

(6) Exclusive Retrieval N N N N N N

Commit

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

releases all locks except implicit shared locks writes a checkpoint

Page 14: Idms Simplified

IDMS at a Glance Page 14 of 14

does not affect currencies

Commit All

releases all locks writes a checkpoint nullifies currencies

RollbackRollback 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.

The first two character of error code is the major code and the next two character the minor code, the following is a list of some of the major & minor codes.

Major Code DML Function 01 Finish02 Erase03 Find/Obtain05 Get/Keep/Connect08 Modify09 Ready

Minor code Interpretation 06 No currency established for record/set/area07 End of set/area/index09 Area readied in incorrect usage mode26 record or index entry not found