Sie sind auf Seite 1von 37

IMS / DB

What is a Database System?


A system that allows multiple independent users to have concurrent access
to a central repository of information Advantages Centralized files for all applications Elimination of duplicate space and effort Single information source provides complete accurate information processing Concurrency and easily manageable.

IMS Fundamentals

Types of DBMS
1. Hierarchical A hierarchical database is a kind of database management system that links records together in a tree data structure such that each record type has only one owner, e.g. an order is owned by only one customer. Hierarchical structures were widely used in the first mainframe database management systems. However, due to their restrictions, they often cannot be used to relate structures that exist in the real world.

IMS Fundamentals

Types of DBMS (Contd..)


2. Network

The network model is a database model conceived as a more flexible alternative to the hierarchical model. Where the hierarchical model structures data as a tree of records, with each record having one parent record and many children, the network model allows each record to have multiple parent and child records, forming a lattice structure.

IMS Fundamentals

Types of DBMS (Contd..)


3. Relational

A relational database is organized into tables, in which data is defined so that it can be reorganized and accessed in a number of different ways without having to reorganize the database tables.

IMS Fundamentals

Relational VS. Hierarchical


Because the data relationships in a hierarchical structure are pre-defined., its major advantage is speed of access. The major disadvantage is the reduced flexibility inherent in a pre-defined structure. The IBM hierarchical product is IMS/DB. Relational databases are much more flexible and are generally easy to use. However , The increased flexibility can result in slower access times .The IBM relational product is DB2

IMS Fundamentals

What is IMS?
IMS (Information Management System) is IBM's hierarchical database product
Hierarchical Data base management system that supports the application program while processing data bases in batch or on-line environments. IMS maintains an Inverted Tree Structure starting with the Root Segment by ensuring that no segment has more than one parent. The Hierarchy can go up to fifteen levels down. The Hierarchy can represent up to 255 segment types

IMS Fundamentals

Characteristics Of An IMS Database

An IMS database consists of some number of database records. The size of the database is limited only by the constraint of VSAM and DASD. A maximum of 15 levels are allowed; a level can be defined as all segments that have the same number of segments above them. The root segment is always level one. Each immediate child of the root is level two and so on .IMS allows up to 255 different segment types in a single database.

IMS Fundamentals

Why IMS?
Advantages:
Large Volumes of Data can be handled Faster Access of Data Can be combined with DB2 for making data retrieval efficient (DB2 for querying and IMS for processing) Checkpoint restart feature available. Limitations: Not many tools for IMS compared to DB2 (File aid ~ file structure on pc) Rigid design of IMS doesnt make it programmer friendly

IMS Fundamentals

Access Types
HSAM/SHSAM (Simple /Hierarchic sequential Access Method) : The segments that make up the database record are related to one another by their physical locations (SHSAM has only root occurrences) HISAM/SHISAM (Simple / Hierarchic Indexed Sequential Access Method) :The data is stored with hierarchic sequential organization along with an index for random processing (SHISAM has only index of root occurrences) HDAM (Hierarchic Direct Access Method) :The segment occurrences include prefixes that contain the direct address pointers to related segment - stores root segment occurrences HIDAM (Hierarchic Indexed Direct Access Method) : Similar to HDAM but stores an index of the root segment occurrences

IMS Fundamentals

10

IMS Components
Five components of IMS Environment 1. Database Management System Is the heart of IMS subsystem. Shared by many concurrent tasks. Data is stored in DASD. Application programs access data by making DL/I calls. 2. DL/I (Data Language Interpreter) Is a set of program modules interfacing database and application program. The modules use standard operating system access methods and a set of specialized access methods to handle data transfers to and from the database. Is an interface language used by the application program.

IMS Fundamentals

11

IMS Components (Contd..)


3. DL/I Control Blocks - There are two main DL/I control blocks namely, Database Descriptor (DBD) which describes the database structure and Program Communication Block (PCB) which identifies how the database may be accessed by the program. 4. Application Program Are designed and coded by the programmers. Programs use a standard DL/I interface to other IMS components. DL/I application programs use standard CALL statements with a parameter list to communicate with IMS. Programs may be written in COBOL, PL/I and ASM. Eg: first stmt in IMS program DLITCBL, all subsequent calls are CBLTDLI.

IMS Fundamentals

12

IMS Components (Contd..) & Features


5. Data Communication Is a set of program modules that allow the program to communicate with remote terminals. Programs communicate with terminals through a Standard Interface Language using CALL statements with a parameter list. Primary Products IMS/ESA Transaction Manager IMS/TM IMS/ESA Database Manager IMS/DB

Product Implementations
DC is used to implement the transaction manager DB is used to implement the database manager

IMS Fundamentals

13

Traversal in IMS database


IMS database traversal generally follows: Top to bottom Left to right Front to back

Illustration follows:

IMS Fundamentals

14

Explanation of diagram
The diagram shows how the data elements are arranged in IMS. Data elements are stored in the hierarchical structure or in other way we can say that some data elements are dependent on other. Each grouping of data is called as segments. A segment is the unit of data that DL/I transfers to and from your program. In previous diagram DEALER, MODEL, ORDER, STOCK and SALES are the names of segments.

IMS Fundamentals

15

Definitions
Segment
- Unit of Information handled in IMS - Unit of data transferred from DL/I in an IO operation - Consists of fields, key fields & Search fields

Occurrence
- Specific segment of a particular type of segment - Contains actual user data

Root Segment
- Top of the hierarchy - All other segments are derived from the root

Parent Segment
- Segment that has dependent segments
IMS Fundamentals 16

Definitions (contd)
Child Segment
- A dependent segment

Segment Level
- Depth of an IMS structure - Root is at Level 0, max 15 levels, max 255 segments

Path
- Series of segments from Root to the child

Database record
- Each occurrence of the Segment Plus all occurrence of the subordinate segments

Twins
IMS Fundamentals

- Segment occurrences of same type with same parent segment occurrence

17

Concept of Segments
In IMS, segments are defined by the order in which they occur and by their relationship with other segments.

The segment type at the top level of Hierarchy represents the Root segment. Like in the above case the DEALER represents the root segment.
An occurrence of the root segment plus all the segment occurrences subordinate to it makes one database record. All of the segments except the root segment are called dependent segments. Each dependent segment is also called the child segment.

IMS Fundamentals

18

Terms in an IMS Database


SEGMENT or SEGMENT TYPE - A segment is the smallest structure of the database in the sense that IMS cannot retrieve data in an amount less than a segment - Within each segment there can be one or more data fields - A database record can contain a maximum of 255 types of segments and one hierarchical path can have up to 15 segment types

FIELDS
- Segments can be broken down into smaller increments called fields, which can be addressed individually by application programs
IMS Fundamentals 19

Terms in an IMS Database (Contd..)


SEGMENT OCCURANCE - Segment Occurrence identifies the data that belongs to a particular Segment Type PARENT - A segment that has one or more dependant segments beneath it in the hierarchy. CHILD - A segment that is a dependent on another segment above it in the hierarchy.

IMS Fundamentals

20

Terms in an IMS Database (Contd..)


TWINS - All occurrences of a particular segment type under a single parent segment occurrence are called TWINS DATABASE (IMS) - A database consists of all root segment occurrences along with their dependents. - Is normally shared by multiple applications. DATABASE RECORD - A database record has one root segment occurrence along with all the occurrences of its child segments in hierarchic sequence

IMS Fundamentals

21

Organization and Access Methods


Organization The way data is organized. e.g. KSDS,ESDS,RRDS,LDS Access Method The process followed to access the data. E.g. VSAM IMS Access Methods are Hierarchic sequentially accessed databases HSAM, SHSAM, HISAM, SHISAM, GSAM Hierarchic direct databases HDAM, HIDAM Fast Path databases provide fast access with limited functionality DEDB, MSDB
IMS Fundamentals 22

Control Blocks
IMS uses two kinds of control blocks to enable application programs The database descriptor/definition (DBD) and Program communication block (PCB). Database Description (DBD)

A database descriptor (DBD) is a control block that describes the physical structure of the database. The DBD also defines the appearance and contents, or fields, that make up each of the segment types in the database. It describes the way in which it is stored on the DASD and the way it is accessed.

IMS Fundamentals

23

Control Blocks (Contd..)


Program Communication Block (PCB) A program communication block (PCB) defines an application program's view of the database. It describes the logical structure of a database as a particular program views it. It identifies which pieces of a data a program is allowed to access and the kinds of functions (operations) it can perform on each collection of data. This is useful when an application program needs to process only some of the segments in a database which is a very common need.

IMS Fundamentals

24

What is DL/I ?

DL/I is Data Language Interpreter is a data management facility that

serves as an interface between an application program and a database.

IMS Fundamentals

25

DBD - Data base definition


DBD A database description/definition (DBD) is a series of macro statements that define the type of database, all segments and fields, and any logical relationships or indexing. DBD macro statements are submitted to the DBDGEN utility, which generates a DBD control block and stores it in the IMS.DBDLIB library for use when an application program accesses the database. Apart from describing the physical structure and interdependency of segments in database, it also names the DBD and the access method that will be used by DL/I for data manipulation.

IMS Fundamentals

26

Defining DBD
Suppose the ACCENTURE hierarchical structure has been designed. The name of the segments has been chosen. Now we must tell IMS about this database. IMS needs to know about all the keys, search fields, and relationships that are designed as part of the organization database.

The DBD is usually coded by a DBA (Data Base Administrator). It is then submitted to the system with JCL that invokes a procedure called DBDGEN. This procedure produces an object module which is in turn passed to the linkage editor which produces a load module. The load module is stored in a library named something like IMSVS.DBDLIB.

IMS Fundamentals

27

DBD Functions
Defines the physical storage information. Defines the hierarchical structure. Define the relationship between the segments. Defines the segment layouts. Defines the key field with in the segment. Describe the information necessary to create the database. Defines any logical relationship. Defines the secondary index.

IMS Fundamentals

28

DBD - Data base definition Macros


DBD DATASET Names the database being described and specifies its organization. Specifies the names of files used to store the data. Defines each file which comprises the data base. It defines the DD names and the dataset information. Defines the name of the segment type, its position in the data base and how it is related to other segments. Defines a relationship between two different segment types. This could be an index relationship, a logical relationship or a secondary index. Defines a field within a segment. It identifies the field name, its length in bytes, its starting position, and the type of data in the field.

SEGM LCHILD FIELD

IMS Fundamentals

29

DBD-Data base definition Macros


(Contd..)
XDFLD DBDGEN Defines the source fields for a secondary index. This statement ends the SEGM and FIELD definitions for the DBD. Marks the end of statements defining the DBD. This statement marks the end-of-data to the assembler process.

END

IMS Fundamentals

30

Some common status codes


SPACES successful retrieval. GB End of database. GE Not found. II Duplicate segment while insertion. DA Key field changed. DJ No get hold call before DLET or REPL. GK Segment of diff type but at the same hierarchical level. GA Higher level segment was retrieved during sequential call.

IMS Fundamentals

31

Command Codes
The 10 Command Codes available in IMS are :
C D F L N Q
IMS Fundamentals

Concatenated key in the SSA. Retrieve this segment data into the I-O Area (Path call). Locate the first segment occurrence that satisfies the SSA. Locate the last segment occurrence that satisfies the SSA. Do not replace this segment. Locks a segment for your program's exclusive use.
32

Command Codes
U

(Contd..)

Specify the current database positions at that level is not allowed to be changed by the call

P
V

Establish Parentage at this level


Specify the current database position at that & all levels above are not allowed to be changed by the call

'NULL Used as the place holder in SSA's so that command codes can be removed/inserted from SSA's without having to define separate SSA's in working storage.

IMS Fundamentals

33

Some more DL/I Status codes


AB AC AH AJ AI The call did not specify a segment IO area SSA with a hierarchical error Call requires at least one SSA Call specifies an Invalid SSA Error encountered when trying to open the database dataset. An error in the JCL DD statement The field named in a qualified SSA is not correct The IO area specified in the call is too large but the programs PSB may be incorrect Call caused an operation resulting in a physical IO error

AK AT AO

IMS Fundamentals

34

System Service DL/I Calls


The four important DL/I calls that perform various system service functions are : 1) CHKP 2)XRST 3)ROLL 4)ROLB

CHECKPOINT (CHKP) Call


A point in the execution of program when the changes made to the database are considered complete and accurate. Checkpoint (CHKP) call is used for recovery purposes, in the IMS programming environment it is the method used to ensure data integrity. Once check pointed, the changes made are not reversible. CHKP call causes all the database changes made since the last checkpoint to be permanently committed to the physical database thereby making Backout impossible. A CHKP call causes the database position for a PCB to be reset, apart from releasing all the locks held by the program.

IMS Fundamentals

35

System Service DL/I Calls (Contd..)


In addition, the CHKP call Enables you to save as many as seven data areas in your program, which are restored when your program is restarted In case of ABENDs, IMS will control the process of backing out database updates up to the last checkpoint. Works with the Extended Restart (XRST) call to restart your program if it terminates abnormally

IMS Fundamentals

36

Checkpoint Restart
Why checkpointing? If there are other jobs updating or reading the tables, there should be a checkpoint at an interval < the DB2 timeout interval (typically 30 seconds will suffice). When A large amount of locking activity is taking place. Locks are a finite resources in a DB2 Subsystem. When we do not want to lose work already accomplished. If a job runs a long time, recovery is not just re-running the job, but also waiting for DB2 to roll back changes. Checkpoint intervals are based on the situation. For example, if online activity is present, or we are running parallel processes, checkpoints should be taken at 10 second intervals. If we are running stand alone batch, and have exclusive access to our tables, we might go as high as 60 seconds.
37

IMS Fundamentals

Das könnte Ihnen auch gefallen