IMS Database Processing
-
Upload
shinoy-sansilavose -
Category
Documents
-
view
235 -
download
0
Transcript of IMS Database Processing
-
8/22/2019 IMS Database Processing
1/34
IMS-DB
Information Management System
DB Concepts & Programming
HOME
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
2/34
HOME
Files Vs Databases
Networked,Hierarchical & Relational structure
Access types - HSAM, HISAM,HDAM,HIDAM,VSAM
IMS DB - an Hierarchical Structure
Database Definitions - DBD
Program Specification Block ,Program Control Block
DL/I Calls - Data Retrieval and Manipulation
DL/I Functions
Qualified/ Unqualified Calls, SSAs, Command Codes
DL/I Status codes
Basic Topics
HOME
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinchttp://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
3/34
HOME
Advanced Topics
Data Sensitivity - Segment Level & Field level
Checkpoint & Restart
IMS DB in CICS Environment Secondary Indexing
Difference between MPP, BMP, DLI
Using HFCTDLI
HOME
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinchttp://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
4/34
HOME
File Vs Databases
Data more redundant Redundancy avoided
Duplicate data Minimise Duplicates
Data insecure Security provided
No control over data Field level sensitivity
Threat to Integrity Consistency of data
Lack of inbuilt Data Logging,
recovery features Commits & Rollbacks Lack of data Locks Automatic locks
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
5/34
HOME
Database Structures
Network Structures (e.g IDMS)
Many to Many relationships
Complex structure using Pointers
Best for Keeping storage
Hierarchical Structures (e.g IMS DB)
One to Many Relationships
Inverted Tree like Structure
Best for storing parent and child type entities
Relational Structures (e.g DB2)
One to Many, Many to One
Best for ease of data retrieval
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
6/34
HOME
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
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
7/34
HOME
IMS DB Hierarchical Structure
SRCSInformationDatabase
Stratergic BusinessUnits info
Project Info
Client Info Employee data
Employee SalaryDetails
Projects
Clients
Salary
Employ
SRCSunits
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
8/34
HOMEBasic IMS Terminologies
SRCS Units
21
3
Clients Employ
Projects Salary
Segment
Occurrence
Root Segment
Parent SegmentChild Segment
Segment Level
Path
Database Record
TwinsSequential Processing
Random Processing
SRCS
Information
Database
Client Info
Project Info
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
9/34
HOME
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
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
10/34
HOMEDefinitions (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 alloccurrence of the subordinate segments
Twins
- Segment occurrences of same type with same parent
segment occurrence
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
11/34
HOMEIMS Control Blocks
IMS
PGM1IMS
PGM2
DL/I
CONTROL
UNIT
DBD1 DBD2 DBD3
PCB for DB1PCB for DB2
PCB for DB3
PSB
DBDs
IMS DBsDB1 DB2 DB3
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
12/34
HOME
DBD : Names the database and identifies the access method
DBD Name = SRCS, ACCESS=(HIDAM,VSAM)
DATASET : Specifies DD Name used in the JCL and other parameters
DATASET DD1=DDSAT,DEVICE=3380,SIZE=(4096),FRSPC=(0,15)
SEGM : Names the segment. Identifies the parent and establishes the length
SEGM Name =SRU,PARENT=0,BYTES=40
LCHILD : Names the logical segment used in secondary Indexing and Logical
database
LCHILD NAME=(SRUNAME,SRCS1),PTR=INDX
FIELD : Defines fields. And identifies search &key fields by SEQ parameter
FIELD NAME=(SRUCODE,SEQ,U)BYTES=3,START=1,TYPE=C
DBDGEN: Indicates the end of the DBDGEN process
DBDGEN
COMMENT: * IN 3rd COLUMN for writing user comments
DBD : Database Description, describes physical Database
DBDGEN : DBDGEN Utility, Describes the physical structure of
the Database and creates DBD
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
13/34
HOME
Sample DBD Listing for SRCS Info Database
DBD NAME=SRCS,ACCESS=(HIDAM,VSAM)
DSG1 DATASET DD1=DDSAT,DEVICE=3380,SIZE=4096,FRSPC=0,15)
SEGM NAME=SRU,PARENT=0,BYTES=40
FIELD NAME=(SRUCODE,SEQ,U),BYTES=3,START=1,TYPE=P
FIELD NAME=SRUNAME,BYTES=5,START=4,TYPE=CFIELD NAME=SRULOC,BYTES=12,START=9,TYPE=C
FIELD NAME=SRUHEAD,BYTES=20,START=21,TYPE=C
SEGM NAME=CLIENT,PARENT=SRU,BYTES=45
FIELD NAME=(CLTID,SEQ,U),BYTES=4,START=1,TYPE=P
FIELD NAME=CLTNAME,BYTES=10,START=5,TYPE=C
FIELD NAME=CLTLOC,BYTES=11,START=15,TYPE=C
FIELD NAME=CLTHEAD,BYTES=20,START=26,TYPE=C
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
14/34
HOMESEGM NAME=PROJECT,PARENT=CLIENT,BYTES=35
FIELD NAME=(PRJID,SEQ,U),BYTES=4,START=1,TYPE=P
FIELD NAME=PRJNAME,BYTES=5,START=5,TYPE=C
FIELD NAME=PRJTMSIZE,BYTES=4,START=10,TYPE=CFIELD NAME=PRJHEAD,BYTES=22,START=14,TYPE=C
SEGM NAME=EMPLY,PARENT=SRU,BYTES=40
FIELD NAME=(EMPID,SEQ,U),BYTES=5,START=1,TYPE=P
FIELD NAME=EMPNAME,BYTES=10,START=6,TYPE=C
FIELD NAME=EMPPROJ,BYTES=5,START=16,TYPE=CFIELD NAME=EMPADDR,BYTES=20,START=21,TYPE=C
SEGM NAME=SALARY,PARENT=EMPLY,BYTES=35
FIELD NAME=(SALEMPID,SEQ,U),BYTES=5,START=1,TYPE=P
FIELD NAME=SALBASIC,BYTES=10,START=6,TYPE=C
FIELD NAME=SALHRA,BYTES=5,START=16,TYPE=CFIELD NAME=SALDA,BYTES=5,START=21,TYPE=C
DBDGEN
FINISH
END
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
15/34
HOMEPSBProgram Specification Block,describes Logical structure of the Database that a
program will use.It contains one or more PCBs (Program Communication Block).
PCB describes one Database.
PSBGEN
PSBGEN Produces a load module stored in the PSBLIB library and creates PSB
Major Macros UsedPCB : Describes type (DB or DC), name of the DBD, Key length(length of
the longest concatenated key the program can process) andprocessing Option (Defines how the segment may be accessed)
PCB TYPE=DB,DBDNAME=SRCS,KEYLEN=20,PROCOPT=LS
SENSEG : Define the name of the segments in the Database your program
needs access to
SENSEG NAME=CLIENT,PARENT=SRUSENFLD : Subordinate to the SENSEG macro, only fields that are defined by
the SENFLD macro can be accessed from the I/O Area.
SENFLD NAME=PROJECT,PARENT=CLIENT
PSBGEN PSBNAME=MYPSB,LANG=COBOL
END
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
16/34
HOMESAMPLE PSB FOR SRCS INFO DB PROJECT REFERENCE PROGRAM
PCB TYPE=DB,DBDNAME=SRCS,KEYLEN=10,PROCOPT=LS
SENSEG NAME=SRU,PARENT=0
SENSEG NAME=CLIENT,PARENT=SRUSENSEG NAME=PROJECT,PARENT=CLIENT
PSBGEN PSBNAME=MYPSB,LANG=COBOL
END
SAMPLE PSB FOR SRCS INFO DB PROJECT REFERENCE PROGRAM
PCB TYPE=DB,DBDNAME=SRCS,KEYLEN=10,PROCOPT=LS
SENSEG NAME=SRU,PARENT=0
SENSEG NAME=CLIENT,PARENT=SRU
SENSEG NAME=PROJECT,PARENT=CLIENT
SENSEG NAME=EMPLY,PARENT=SRU
SENSEG NAME=SALARY,PARENT=EMPLY
PSBGEN PSBNAME=MYPSB,LANG=COBOL
END
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
17/34
HOMEDL/I INTERFACE
DL/I passes control to your program
Uses ENRTY and CALL statement to code DL/I call in the Procedure Division
ENTRY DLITCBL USING PCB-name1
PCB-name2
This DL/I tells entry of the program for Batch program & MPP program
CALL CBLTDLI USING DLI-FUNCTION
PCB-mask
Segment-io-area
[segment search arguments (s)]
This call is the name of the interface module that link edited with your
programs object module.
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
18/34
HOMECALL PARAMETERS
CALL CBLDTLI USING DLI-FUNCTION
PCB-maskSegment-io-area
[segment search argument (s) ]
If we use PL/I language then CBLTDLI will be PLITDLI
Parameter Function
DL/I -Function A four byte code that tells DL/I what kind of call to make
PCB-mask Arguments tells DL/I which PCB to use for the call
IO-Area Tells DL/I where to put the segment
SSA Gives DL/I additional criteria to use in finding a particularSegment, Can be upto 15 SSAs
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
19/34
HOMEDL/I FUNCTIONS
GU - Get UniqueGN - Get Next
GNP - Get Next within Parent
GHU - Get Hold Unique
GHN - Get Hold Next
GHNP - Get Hold Next within ParentISRT - To Insert
REPL - To replace
DLET - To Delete
CHKP - To take a Checkpoint at a particular point
XRST - To Restart from Particular point previous Checkpoint
INIT - To Initialize
SYNC - To commit
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
20/34
HOMEPCB MASK
Define in linkage Section and establishes correspondence between linkage Section
PSB-mask and PSBs with in your program.
SAMPLE PCB-MASK LAYOUT
VARIABLE DESCRIPTION
01 SRCS-PCB-MASK.03 SR-DBD-NAME PIC X(8).Name of the Database being processed
03 SR-SEG-LEVEL PIC XX. Specifies current segment level in the DB
03 SR-STATUS-CODE PIC XX. Contains data yr program will evaluate after call
03 SR-PROC-OPT PIC X(4). Type of processing the program authorized to do
03 SR-SEG-NAME PIC X(8). Stores name of the segment just proceeded03 SR-KEY-LENGTH PIC S9(5). Length of the concatenated key
03 SR-NUM-SENSEGS PIC S9(5).No of SENSEG macros subordinate to the PCB
03 SR-KEY-VALUE PIC X(20). Key value retrieved
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
21/34
HOMEI-O AREA LAYOUT FOR SEGMENTS
SRUCODE SRUNAMESRULOC SRUHEAD
01 SRU-AREA.
03 SRU-CODE PIC X(3).
03 SRU-NAME PIC X(5).
03 SRU-LOC PIC X(12)
03 SRU-HEAD PIC X(20).
CLTID CLTNAME CLTLOC CLT-HEAD01 CLIENT-AREA.
03 CLT-CLTID PIC X(4).
03 CLT-CLTNAME PIC X(10).
03 CLT-CLTLOC PIC X(11)
03 CLT-CLTHEAD PIC X(20).
PROJID PRJNAME TMSIZE PRJADDR
01 PRJ-AREA.
03 PRJ-PROJID PIC X(4).
03 PRJ-PRJNAME PIC X(5).
03 PRJ-TMSIZE PIC X(4)03 PRJ-HEAD PIC X(20).
EMPID EMPNAME EMPPROJ EMPADR
01 EMP-AREA.
03 EMP-ID PIC X(5).
03 EMP-NAME PIC X(10).
03 EMP-PROJ PIC X(5)
03 EMP-ADR PIC X(20).
01 SAL-AREA.
03 SAL-EMPID PIC X(5).
03 SAL-BASIC PIC X(10).
03 SAL-HRA PIC X(5).
03 SAL-DA PIC X(5).
EMPID BASIC HRA DA
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
22/34
HOMESEGMENT SEARCH ARGUMENT
Identifies Segment Occurrence You want to access
You may have to code several SSAs in a single DL/I CALL
There are two types of SSAs Unqualified SSA & Qualified SSA
UNQUALIFIED QUALIFIED
Search for a Specific Segment type Searches for a specific occurrence of a
specific segment type
Access the database Sequentially Access the database Randomly
Identify by segment name and space Identify by segment name and Seg-key
Example01 UNSRU-SSA. 01 QUALKBU-SSA.
03 SRU-UNSSA-NM PIC X(8) Value SRU . 03 SEG-NAME PIC X(8)VALUE SRU .
03 FILLER PIC X Value Space. 03 COM-CODE PIC X(2) VALUE *
-.
03 BEGIN-QUAL PIC X VALUE (.
03 KEY-NAME PIC X(8) VALUE SRUKEY.
03 REL-OPR PIC X(2) VALUE = .
03 KEY-VALUE PIC X(20).
03 END-QUAL PIC X VALUE ).
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
23/34
HOMECOMMAND CODES
Command Code Description
D Retrieve Path
F Access First Segment occurrence
L Access Last Segment occurrence
U Maintain current position at this level
V Maintain current position at this level and higher levels
Q Enqueue Segment
N Do Not replace this Segment
C Use a Concatenated Key
P Establish Percentage at this level
- Null command code / ignore
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
24/34
HOMEData Sensitivity
DBAAt a PSB level for SEGMENTS PROCOPT
PCB TYPE=DB,DBDNAME-SRCS,,KEYLEN=11,PROCOPTSENSEG NAME =SRU,PARENT=0
SENSEG NAME =CLIENT,PARENT=SRU
Processing Options : G, I, R, D, A, P, O, N, T, E, L, GS, LS, H
At a PSB level for fields
Done by DBA by use of SENFLD macro , specifying those fields
that can be changed.
ProgrammerAt PROGRAM Level- Qualified SSA call with Command code N (No Replacement)
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
25/34
HOMECheckpointing & Restart
A point in the program where the database changes the program made are
Considered complete and accurate -written to a DL/I log
Used for Recovery Process
Are of two types - Basic Checkpointing and Symbolic Checkpointing Basic Checkpointing
CALL CBLTDLI USING DLI-CHKP,
I-O-PCB-MASK,
CHECKPOINT-ID.
Symbolic Checkpointing
Stores program data along with checkpoint records and retrieves that data
when program restarts after failure.
For extended Restart , an XRST call to be issued with the same fields as in
CHKP call. It allows DL/I to retrieve the value in checkpoint record and
restores the specified fields.
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
26/34
HOMEExplosive Mix - IMS DB with CICS
Scheduling Call
CICS Region / Partition
User Task
User Interface Block
(UIB)
Program Communication
Block
(PCB)
A DL/I task must establish addressability to UIB and one or more PCB
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
27/34
HOMEIMS & CICS Continued
CALL CBLTDLI USING FUNC-INIT
PSB-NAME
ADDRESS OF DLIUIB
SET ADDRESS OF PCB-ADDR-LIST TO UIBPCBAL
SET ADDRESS OF PCB-1 TO PCB-1-ADR
SET ADDRESS OF PCB-2 TO PCB-2-ADR
...
User Interface Block
Address of PCB List
Address of PCB 1
Address of PCB 2PCB Address list
PCB1
PCB2
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
28/34
HOMESecondary Indexing
Employee Index Database
EMP..SegAddr
Employee ID
Index Pointer SegmentSRU
CLIENTS EMPLOYEE
PROJECTS
Index Source Segment
Index Target
Segment
Same index Source segment and index target segment
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
29/34
HOMESecondary Indexing Continued
Employee Index Database
SRU..SegAddr
Employee ID
Index Pointer SegmentSRU
EMPLOYEE
Index Source Segment
Index Target
Segment
Different index Source segment and index target segment
CLIENTS
PROJECTS
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
30/34
HOMESecondary Indexing Continued
Alternate sequencing is provided by storing pointers to Segments of the indexed
Database in a separate secondary index data base
Secondary index data base has only one segment type - the Index pointer segment
which in turn contains a prefix element and a data element
Prefix element points to the index target segment
Secondary indexing is useful for accessing segments were both
Index source segment and index target segment are same
Index source segment and index target segment are different
Two DBDGENS are required as a secondary database involves two database: one
for indexed database , the other for the secondary index database
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
31/34
HOMESecondary Indexing Continued
DBDGEN - The Secondary Index code for SRCS DB
DBD NAME=SRCS,ACCESS=(HIDAM,VSAM)
DSG1 DATASET DD1=DDSAT,DEVICE=3380,SIZE=4096,FRSPC=0,15)
SEGM NAME=SRU,PARENT=0,BYTES=40
FIELD NAME=(SRUCD,SEQ,U),BYTES=2,START=1,TYPE=P
SEGM NAME=EMPLY,PARENT=SRU,BYTES=80
LCHILD NAME= (MYPNTR,MYDBD),POINTER=INDX
FIELD NAME=(EMPID,SEQ,U),BYTES=5,START=1,TYPE=P
XDFLD NAME=MYINDX,SRCH=EMPID
FIELD NAME=EMPNAME,BYTES=25,START=6,TYPE=C
FIELD NAME=EMPPROJ,BYTES=15,START=31,TYPE=C
FIELD NAME=EMPADDR,BYTES=35,START=46,TYPE=C
.
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
32/34
HOMESecondary Indexing Continued
DBDGEN - The Secondary Index code for Secondary Index DB
DBD NAME=MYIDBD,ACCESS=(INDEX)DSG1 DATASET DD1=DDKAY,DEVICE=3380,SIZE=4096,FRSPC=0,15)
SEGM NAME=MYPNTR,PARENT=0,BYTES=6
LCHI LD NAME= (EMPID,SRCS), INDX=MYINDX
FIELD NAME=(MYEMPID,SEQ,U),BYTES=6,START=1,TYPE=C
DBDGEN
FINISH
END
PSB Requirements for Secondary Indexing.
PCB TYPE=DB,DBDNAME=SRCS,KEYLEN=10,PROCOPT=LS,
PROCSEQ=MYIDBDSENSEG NAME=EMPLY
SENSEG NAME=SRU,PARENT=EMPLY
PSBGEN PSBNAME=MYSBX,LANG=COBOL
END
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
33/34
HOMEDifference Between MPP , BMP & DLI
MPP (Message Processing Program)
For Online programs( IMSDC) only.
PSB used by a MPP program cannot be used by another programs simultaneously.Cannot run on Individual partitions.
BMP (Batch message processing)
For batch programs only
PSB used by a BMP program cannot be used by another programs simultaneously.All partitions specified in PSB will be allocated whether used by program or not.
Cannot run on Individual partitions.
DL/I
It can be used as Interface between MPP and Database OR BMP and Database
For batch DL/I job it can access database directly
PSB of DL/I job can be used by another jobs simultaneously
It can run on Individual partitions.
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc -
8/22/2019 IMS Database Processing
34/34
HOME
http://www.geocities.com/srcsinchttp://www.geocities.com/srcsinc