imsdb data
TRANSCRIPT
![Page 1: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/1.jpg)
Information Management System
IMS
![Page 2: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/2.jpg)
DatabasesWhat is a database?
A way of organizing data
Why database ?
• Increase data independence
• Increase data security
• Reduce data redundancy
• Maintain data integrity
![Page 3: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/3.jpg)
TYPES OF DATABASES
• Hierarchical databases
• Network databases
• Relational databases
![Page 4: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/4.jpg)
NETWORK MODEL
COMPANY CLUB
BUILDING VEHICLE PERSON
![Page 5: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/5.jpg)
RELATIONAL MODELEMP TABLE
DEPT TABLE
EMPNO ADDR
LOCATION NO_OF_EMPL
DEPTNO NAME
DEPTNO
![Page 6: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/6.jpg)
Hierarchical Model - Layout
I. Hospital general Info
A. Wards and Rooms in each Hospital
1. Patients in each Ward
a.Symptoms
b.Treatments
c.Doctors
B. Special Facilities in each Hospital
![Page 7: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/7.jpg)
HIERARCHICAL MODELSegment Representation
S ym p tom Trea tm en t D oc to r
P a tien t
W ard F ac ility
H osp ita l
![Page 8: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/8.jpg)
IMS DATABASE
• Information Management System.
• First and Oldest Database developed by IBM.
• DL/I user interface language
![Page 9: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/9.jpg)
DL/I
OS Access methods
Appl. Program
OS Access methods
File or dataset
Appl. Program
Database
IMS Software Environment
![Page 10: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/10.jpg)
IMS ENVIRONMENT
• IMS supports
– User written Batch Processing and Telecommunication applications.
– Provides Data Management Services and Data Communication Services.
• Data Management Services
– Support multiple applications using a common database.
• Data Communication Services
– Support multiple terminal-oriented applications using a common database.
![Page 11: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/11.jpg)
Components of DB & DC 1. Application Program
• User written programs in COBOL, PL/I, Assembler
2. DB PCB
• Enables the program to communicate with DL/I to get information from database.
3. DL/I DATA LANGUAGE I
• Set of IMS program modules.
• Exists external to the application programs.
• Allows the application programs to access the database sequentially or randomly.
• Not a programming language.
![Page 12: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/12.jpg)
APPLICATION PROGRAM
DB PCB
DL/I
IMSDATABASE
I/O PCB
IMS DC
TERMINAL
![Page 13: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/13.jpg)
BATCH MODE PROCESS FLOW
Appl. Program
DB PCB
DL/I
IMS DB
![Page 14: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/14.jpg)
ON-LINE MODE PROCESS FLOW
Terminal
IMS DC
I/O PCB
Appl. program.
DB PCB
DL/I
IMS DB
![Page 15: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/15.jpg)
IMS DB
OS
DL/I
IMS Control Blocks
Appl Programs
IMS DC
IMS Software Environment
![Page 16: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/16.jpg)
IMS ENVIRONMENT..• IMS database
– Center of the system. – Stored in direct access storage device (DASD).
• I/O PCB
- Enable program to communicate with IMS DC • IMS DC
– communicate with other programs and/or remote terminals.
• Terminal – Interactive on-line applications.
![Page 17: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/17.jpg)
IMS Terminology
![Page 18: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/18.jpg)
IMS - Terminology• Root
– Top most segment of the database– Does not have parent.
• Parent – Segment directly above
• Child – Segment directly below.
• Segment type – Generic term that describes collection of related data.
![Page 19: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/19.jpg)
• Twins – All occurrences of a segment type under a single
parent.
– Can be more than two.
• Twin chain – Set of twins dependent on a particular parent
• Tree structure – No segment can have more than one parent.
• Segment– Smallest unit of information that can be retrieved.
– Maximum of 255 segments.
![Page 20: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/20.jpg)
– Field
• An individual data item.
• Smallest unit of information in the database
– Dependent Segment
• Segments below a particular segment occurrence.
– Segment occurrence
• Collection of data items retrieved as a unit.
![Page 21: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/21.jpg)
– Hierarchy chart
• Chart showing the relationship between segments.
– Database record
• a single occurrence of a root segment type and all its dependent segments
– Database
• Collection of root segment occurrences.
– Level
• Position of segment.
• Maximum 15 levels.
![Page 22: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/22.jpg)
IMS HIERARCHIAL STRUCTURE
1
2
3
4
5
6
7
8
9
1011
12
13
14
15
1617
18
19
20
![Page 23: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/23.jpg)
Employee1
Salary13
Salary12
Salary11
DeductY
DeductX
DeductW
DeductV
DeductU
AddressX3
AddressX2
AddressX1
Sequential Processing order 1) Top-to-bottom 2) Front-to-back 3) Left-to-right
1-11-X-Y-12-U-V-W-13-X1-X2-X3-2
![Page 24: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/24.jpg)
Physical and Logical data structures
![Page 25: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/25.jpg)
IMS ENVIRONMENT...
DEFINING THE DATABASE
• Define segments & hierarchical structure.
• Choose key and search fields.
• DBA communicates to IMS.
• Control block is created DBD.
• Coding a series of DBDGEN control statements.
• Consists of Assembler language macro statements.
![Page 26: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/26.jpg)
DEFINING A LOGICAL DATA STRUCTURE
• Define logical data structure• PSB - Program specification block • PCB - Program communication block• PCB within one PSB defines one logical data
structure for a database • PSB generation (PSBGEN)• Application Data Structure(PCBs in PSB).
![Page 27: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/27.jpg)
•LOOK IN CODING OF DBD.
•LOOK IN CODING OF PCB.
![Page 28: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/28.jpg)
CODING OF DBD DBD NAME=EMPLOYEE,ACCESS=(HIDAM,OSAM)
DSGROUP0 DATASET DD1=DDEMP,DEVICE=3380,SIZE=(4096),FRSPC=(10,10)
SEGM NAME=EMPDATA,PARENT=0,BYTES=100
FIELD NAME=(EMPID,SEQ,U),BYTES=11,START=1,TYPE=C
SEGM NAME=WORKDATA,PARENT=EMPDATA,BYTES=200
FIELD NAME=(DEPTID,SEQ,U),BYTES=5,START=1,TYPE=C
DBDGEN
FINISH
END
![Page 29: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/29.jpg)
CODING OF PCB
PCB TYPE=DB,DBDNAME=EMPDBD,KEYLEN=16
SENSEG NAME=EMPDATA,PARENT=0,PROCOPT=K
SENSEG NAME=WORKDATA,PARENT=EMPDATA,PROCOPT=G
PSBGEN LANG=COBOL,PSBNAME=EMPPSB1
END
![Page 30: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/30.jpg)
EMPDATA
WORKDATA DEPDATA BENDATA
PCB TYPE=DB,DBDNAME=EMPDB,KEYLEN=16,PROCOPT=GSENSEG NAME=___________,PARENT=___________ SENSEG NAME=___________,PARENT=___________SENSEG NAME=___________,PARENT=___________ SENSEG NAME=___________,PARENT=___________ PSBGEN LANG=PLI,PSBNAME=EMPPSBYEND
![Page 31: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/31.jpg)
IMS Call
![Page 32: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/32.jpg)
AN IMS CALL
Five parts
• Call statement to DLI
• Function code
• PCB mask
• IO-AREA
• Segment Search Argument(s)
![Page 33: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/33.jpg)
Call to DLI
CBLTDLI
• uses qualifications in form of SSAs
Other forms are
PLITDLI for PLI
ASMTDLI for assembly lang
EXECDLI
• uses where clause for search criteria
![Page 34: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/34.jpg)
PCB MASK
How is PCB mask coded ?01 XXX- PCB-MASK.
05 XXX-DBD-NAME PIC X(08).
05 XXX-SEGMENT-LEVEL PIC XX.
05 XXX-STATUS-CODE PIC XX.
05 XXX-PROC-OPTS PIC X(04).
05 XXX-JCB-ADDRESS PIC S9(05) COMP.
05 XXX-SEG-NAME PIC X(08).
05 XXX-KEY-LENGTH PIC S9(05) COMP.
05 XXX-NUM-SENS-SEGS PIC S9(05) COMP.
05 XXX-KEY-FBK-AREA PIC X(??).
![Page 35: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/35.jpg)
I/O AREA
• standard record description.
• holds database segments for manipulation.
• used by DL/I.
• can be used by the programmer.
• Area length.
![Page 36: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/36.jpg)
SEGMENT SEARCH ARGUMENT
SEGMENT SEARCH ARGUMENT (SSA)
• identifies the segment which needs to be accessed
• SSA is an optional DL/I call parameter
• can also specify a particular segment type or segment occurrence
![Page 37: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/37.jpg)
Types of SSAs
• Unqualified SSA
• Qualified SSA
![Page 38: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/38.jpg)
SEGMENT SEARCH ARGUMENT..
UN QUALIFIED SSA
• only 8 byte segment name is specified
• 9th position of column is blank.
• does not indicate a particular occurrence of a segment.
• accesses the database sequentially.
![Page 39: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/39.jpg)
Qualified SSA
•Searches for a specific occurrences of a segment.
•Has complete information about the segment occurrence
•supplies either key or search field in addition to segment name
![Page 40: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/40.jpg)
RULES
• First field eight chars segment type
• 9th position identifies the type.
• When 9th position• ‘( ‘ indicates beginning of
qualification• ‘* ‘ SSA includes command
codes;qualification ‘(‘ follows command codes
• ‘)’ indicates end of qualification
![Page 41: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/41.jpg)
SEGMENT SEARCH ARGUMENT
• QUALIFIED SSA EXAMPLE:
HOSPITAL(HOSPNAME =RIVEREDGE )
WARD (WARDNO = 02)
PATIENT (PATNAME =BROWN )
• UN QUALIFIED SSAEXAMPLE:
GU HOSPITAL
WARD
PATIENT
![Page 42: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/42.jpg)
Operators in Qualified SSA
Equal to = EQ
Not equal to ¬= NE
Less than < LT
Less than or equal to <= =< LE
Greater than > GT
Greater than or equal to >= => GE
![Page 43: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/43.jpg)
Function Codes
![Page 44: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/44.jpg)
FUNCTION CODES
• Four byte-code.• Informs DL/I what to do in this call• 9 function codes
![Page 45: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/45.jpg)
Function Codes
GU
•Get Unique.
•Unique occurrence of a segment.
GN
•Get-Next.
•Next occurrence of a segment.
GNP
•Get-Next-Within-Parent.
•Next occurrence of a segment under a parent.
•Retrieves child segments under a parent.
![Page 46: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/46.jpg)
GHU
• Get-Hold-Unique.
GHN
• Get-Hold-Next.
GHNP
• Get-Hold-Next-within-Parent.
![Page 47: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/47.jpg)
REPL
• REPLace.
• Replace an occurrence of a segment.
DLET
• DeLETe.
• Delete an occurrence of a segment.
ISRT
• InSeRT.
• Insert an occurrence of a segment.
![Page 48: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/48.jpg)
DELETING, UPDATING, INSERTING SEGMENTS
• Rules for DELETING/UPDATING of segments• Issue Get-Hold call.
• No intervening calls(using the same database PCB MASK).
• No SSAs in the call.
• Do not modify the key field.
![Page 49: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/49.jpg)
DELETE,REPLACE,INSERT CALLS
• SYNTAX TO DELETE
GHU HOSPITAL(HOSPNAME= MAC NEAL )
WARD (WARDNO = 01)
PATIENT (BEDIDENT=0003)
DLET
• SYNTAX TO REPLACE
GHU HOSPITAL(HOSPNAME=MAC NEAL )
WARD (WARDNO =04)
REPL
• SYNTAX TO INSERT
ISRT HOSPITAL(HOSPNAME=MAC NEAL ) WARD (WARDNO =04)
PATIENT
![Page 50: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/50.jpg)
STATUS CODES
STATUS CODE
• DL/I call statement is executed a status code is generated.
• Code is based on the type of the call.
FOR GET-NEXT CALLS:
With Qualified SSAs.• Blank successful retrieval call.
• GE For segment not found.
Without SSAs.
• GA Moved up in level.
• GK New segment type encountered at same level.
• GB End of the database encountered.
![Page 51: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/51.jpg)
FOR INSERT CALLS:
• II Segment already exists.
• IL Insert rule violation.
FOR INSERT STATUS CODES FOR LOADING CALLS:
• LB Segment already exists.
• LC Key value out of sequence.
• LD No parent for segment being loaded.
• LE Segment type out of sequence.
![Page 52: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/52.jpg)
FOR DLET/REPL CALLS:
• DJ No previous GET-HOLD call.
• DA Key field modified.
• DX Delete rule violation.
• RX Replace rule violation.
![Page 53: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/53.jpg)
Command Codes
![Page 54: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/54.jpg)
COMMAND CODES
• Request a number of useful IMS functions.• used to save programming and processing time.• Number of SSAs reduced.• IMS to modify the way the call is handled. • There are ten command codes.
![Page 55: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/55.jpg)
COMMAND CODES..
• D Put this segment into the I/O area (Path Call).
• N do not replace this segment.• C Concatenated key in SSA.• F Locate the first occurrence.• L Locate the last occurrence.• P Establish the Parentage at this level.• Q En-queue this segment .• U Maintain current position at this level.• V Maintain current position here and
higher level.
• -- Null command code.
![Page 56: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/56.jpg)
COMMAND CODES
EXAMPLES:
• QUALIFIED SSAs WARD *D(WARDNO =04)
PATIENT *DNP(PATNAME =SMITH )
• UN QUALIFIED SSAs WARD *D
PATIENT *DN
![Page 57: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/57.jpg)
COMMAND CODES..
D & N Command Code :
AIM : To print hospital and ward information for a patient and we also want to update the patient segment.
Without Command Codes
Step1: GU HOSPITAL(HOSPNAME =RIVEREDGE )
Step2: GN WARD (WARDNO =02)
Step3: GHU PATIENT(BEDIDENT =0003)
Step4: REPL
![Page 58: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/58.jpg)
• With Command Codes
Step1: Hold call
GHU HOSPITAL*D(HOSPNAME =RIVEREDGE )
WARD *D(WARD =02)
PATIENT (BEDIDENT =0003)
Step 2: Replace call
REPL HOSPITAL*N(HOSPNAME =RIVEREDGE )
WARD *N(WARDNO =02)
PATIENT (BEDIDENT =0003)
![Page 59: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/59.jpg)
COMMAND CODES...
Combination of D&N command codes
HOSPITAL*DN(HOSPNAME =RIVEREDGE )
WARD *DN(WARDNO =02)
PATIENT (BEDIDENT =0003)
![Page 60: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/60.jpg)
Using C command code (Concatenation)
– With out command code
GHU HOSPITAL(HOSPNAME =RIVEREDGE )
WARD (WARDNO =02)
PATIENT (BEDIDENT =0003)
DOCTOR (DOCTNAME =BOSWELL )
– With command code
GHU DOCTOR *C(RIVEREDGE 020003BOSWELL )
![Page 61: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/61.jpg)
A Simple Batch IMS COBOL Program
![Page 62: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/62.jpg)
A COBOL-IMS application program structure
Working StorageI/O Areas ( Segments to and from Database)
Segment Search ArgumentsQualified or Unqualified
Linkage SectionPCB Area (Return information from DLI)
Procedure Division
Program Entry
Calls to DL/I (Get, Insert, Replace, Delete)
Processing Termination
DL/I Modules
DL/I Area
![Page 63: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/63.jpg)
COBOL CODING USING IMS IDENTIFICATION DIVISION.
PROGRAM-ID.
ENVIRONMENT DIVISION.
*
DATA DIVISION.
*
01 INFILE.
03 HOSPNAME-IN PIC X(20).
03 WARDNO-IN PIC X(2).
03 PATIENT-IN PIC X(20).
*
WORKING-STORAGE SECTION.
77 GET-UNIQUE PIC XXXX VALUE ‘GU ‘.
01 HOSPITAL-SSA.
03 FILLER PIC X(19) VALUE ‘HOSPITAL(HOSPNAME =‘.
03 HOSPNAME-SSA PIC X(20).
03 FILLER PIC X VALUE ‘)’.
01 WARD-SSA.
03 FILLER PIC X(19) VALUE ‘WARD (WARDNO =‘.
03 WARDNO-SSA PIC X(2).
03 FILLER PIC X VALUE ‘)’.
![Page 64: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/64.jpg)
COBOL CODING USING IMS..01 PATIENT-SSA.
03 FILLER PIC X(19) VALUE ‘PATIENT (PATNAME =‘.
03 PATNAME-SSA PIC X(20).
03 FILLER PIC X VALUE ‘)’.
01 IO-AREA COPY PATIENT.
LINKAGE SECTION.
01 PCB-MASK COPY MASKC.
PROCEDURE DIVISION.
ENTRY-LINKAGE.
ENTRY ‘DLITCBL’ USING PCB-MASK.
PROG-START.
OPEN INPUT INFILE.
OPEN OUTPUT OUTFILE.
READ-INPUT.
READ INFILE AT END GO TO END-OF-JOB.
MOVE HOSPNAME-IN TO HOSPNAME-SSA.
MOVE WARDNO-IN TO WARDNO-SSA.
MOVE PATNAME-IN TO PATNAME-SSA.
CALL ‘CBLIDLI’ USING GET-UNIQUE
PCB-MASK
IO-AREA
HOSPITAL-SSA
![Page 65: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/65.jpg)
COBOL CODING USING IMS...
WARD-SSA
PATIENT-SSA.
IF STATUS-CODE EQUAL TO ‘GE’ OR ‘GB’
MOVE STATUS-CODE TO DUMP-AREA
MOVE ‘ PATIENT NOT FOUND’ TO PRINT-PATIENT-NAME
ELSE
IF STATUS CODE NOT = SPACES
DISPLAY ‘ ERROR IN DATABASE READ’ STATUS-CODE
CALL DUMP
END-IF
END-IF.
PERFORM PRINT-ROUTINE.
GO TO READ-INPUT.
PRINT-ROUTINE.
• ……………….
END-OF-JOB.
CLOSE INFILE.
CLOSE OUTFILE.
GOBACK.
![Page 66: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/66.jpg)
COBOL CODING USING IMS...
01 HOSPITAL.
03 HOSPNAME PIC X(20).
03 HOSP-ADDR PIC X(30).
01 WARD.
03 WARDNO PIC XX.
03 BEDAVAIL PIC XXX.
01 PATIENT.
03 PATNAME PIC X(20).
03 PAT-ADDRESS PIC X(30).
01 SYMPTOM.
03 DIAG PIC X(20).
03 STMP-DATE PIC X(30).
01 TREATMENT.
03 TRTYPE PIC X(20).
03 TRDATE PIC X(10).
01 DOCTOR.
03 DOCNAME PIC X(20).
03 DOCADDRESS PIC X(30).
![Page 67: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/67.jpg)
Multiple Positioning
![Page 68: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/68.jpg)
Multiple Positioning
• Single Positioning
• Multi-Positioning
• Retrieving a set of child segments for each parent
![Page 69: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/69.jpg)
Hospital database
S ym p tom Trea tm en t D oc to r
P a tien t
W ard F ac ility
H osp ita l
![Page 70: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/70.jpg)
MULTI POSITIONING
GU HOSPITAL(HOSPNAME =XXX )
WARD (WARDNO = 01)
PATIENT (BEDIDENT =1012)
GNP SYMPTOM
GNP TREATMENT
GNP DOCTOR
SINGLE POSITIONING FAILS HERE..
GNP SYMPTOM
GNP TREATMENT
GNP DOCTOR
![Page 71: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/71.jpg)
MULTI POSITIONING
PCB TYPE=DB,NAME=HOSPITAL, POS=M
• POS parameter • POS = M• POS =S• IMS maintains separate position within a data
record for each dependent segment type
![Page 72: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/72.jpg)
Secondary Indexing
![Page 73: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/73.jpg)
Secondary Indexing
• A self contained database
• stores a series of pointers to segments of database being indexed
• processing other than the key sequence
![Page 74: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/74.jpg)
Secondary Indexing Terminology
• Index database
• PROCSEQ parameter
• Indexed field
• Index source segment
• Index target segment
• Index pointer segmentIndexed field + a pointer to target segment
![Page 75: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/75.jpg)
A Secondary Index
HOSPITAL
WARD FACILITY
PATIENT
TREATMNTSYMPTOM DOCTOR
DIAGINDX
• Index target - Patient
• Index Source - Symptom
• Indexed fields - Diagnose+Prescription
• (XDIAG)
![Page 76: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/76.jpg)
Using Secondary Index
PCB TYPE = DB, NAME=HOSPITAL
PROCOPT=A,PROCSEQ=DIAGINDX
1. GN HOSPITAL retrieves in DIAGNDX sequence
2. GU PATIENT(XDIAG =XXXX1231)
uses DIAGINDX to retrieve the required segment using the indexed field.
![Page 77: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/77.jpg)
Using Secondary Index
SENSEG NAME=HOSPITAL,PARENT=0,INDICES=DIAGINDX
1. GN HOSPITAL
retreives the in normal sequence
2. GU PATIENT(XDIAG = xxxx1234 )
retreives using DIAGINDX with the index key.
![Page 78: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/78.jpg)
Secondary Index Restrictions
• Any type of calls can be issued on segments below index target segment
• DLET or ISRT calls cannot be made for index target segment or any of its parents in original hierarchy
![Page 79: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/79.jpg)
Independent-AND
• Can be used to retrieve data where more than one index pointer segment can point to a given index target segment.
GU PATIENT(XDIAG = PLAGUE * XDIAG = FLU )
GU PATIENT(XDIAG = PLAGUE # XDIAG = FLU )
![Page 80: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/80.jpg)
Secondary IndexingA
B C
D
F
E
G
INDEX1
INDEX2
A
B
E
GPCB … PROCSEQ=INDEX1
PCB … PROCSEQ=INDEX2
![Page 81: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/81.jpg)
Secondary Indexing Relationships
Secondary index and the database may have
• one to one relationshipIndex pointer segments have unique key fields
• one to many relationshipIndex pointers segments does not have the key field as
unique
![Page 82: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/82.jpg)
Logical databases and Logical Relationships
![Page 83: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/83.jpg)
Logical Relationships - A Snapshot
• Restructuring the hierarchy
• Connecting the physical databases
• Reduce redundancy of segments in different databases
![Page 84: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/84.jpg)
Logical database terms
• Logical child
• Logical parent
• Logical database
• Logical Twins
![Page 85: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/85.jpg)
An Example
HOSPITAL
WARD FACILITY
PATIENT
TREATMNTSYMPTOM DOCTOR Pointersegment
NAME
BILLING HISTORY
![Page 86: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/86.jpg)
Logical Relationships - Types
• Unidirectional
• Bi-directional– bi-directional virtual logical relationship– bi-directional physical logical relationship
![Page 87: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/87.jpg)
Logical databases
NAME
ADDRESS PAYROLL NAME
EXPR EDUC
SKILL
Payroll database (Physical) Skills database (Physical)
![Page 88: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/88.jpg)
Logical databasesNAME SKILL
LOGICAL DBDGEN
NAMESKIL
MYPSB
2 physical databases
Are merged in to
Produce a logical dbd
The PCB (and program) use the name of the
logical database
![Page 89: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/89.jpg)
Logical database
NAME
EXPR EDUC
SKILL
ADDRESS PAYROLL
![Page 90: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/90.jpg)
Logical database
NAME
ADDRESS PAYROLL
EXPR EDUC
SKILL
![Page 91: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/91.jpg)
Variable Length Segments
![Page 92: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/92.jpg)
Variable Length Segments
• save space
• two byte length field
dataLength
1 2 3
Variable Length Segment
![Page 93: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/93.jpg)
Variable Length Segment
SEGM NAME=TREATMENT, PARENT=PATIENT,BYTES=(160,90)
160 Maximum size of segment
90 Minimum size of segment
![Page 94: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/94.jpg)
Generalized Sequential Access Method
![Page 95: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/95.jpg)
GSAM
• Access to standard sequential dataset or VSAM ESDS using IMS calls
• no hierarchical structure
• no key or search fields
![Page 96: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/96.jpg)
GSAM call
Call ‘CBLTDLI’ USING GET-NEXT
GSAM-PCB
I-O-AREA
GSAM-RSA.
![Page 97: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/97.jpg)
DL/I Recovery & Restart Features
![Page 98: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/98.jpg)
Terms for discussion
• Abnormal Termination routines
• IMS Log
• Recovery– forward recovery– backward recovery
![Page 99: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/99.jpg)
Checkpointing
• Other terms -checkpoint,sync point, commit point, point of integrity
• Checkpoint call - CHKP
• Types of checkpointing• basic checkpointing
• symbolic checkpointing with extended restart facility
![Page 100: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/100.jpg)
Basic CheckpointingLinkage Section.
01 I-O-PCB-MASK.
05 FILLER PIC X(10)
05 I-O-PCB-STATS-CODE PIC XX.
CALL ‘CBLTDLI’ USING DLI-CHKP
I-O-PCB-MASK
CHECKPOINT-ID
![Page 101: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/101.jpg)
Symbolic CheckpointingWorking Storage Section.
01 COUNT-FIELDS
….
01 PRINT-FIELDS
…...
01 CHECKPOINT-ID PIC S9(08) COMP.
01 RESTART -WORK-AREA PIC X(12) VALUE SPACES.
01 LENGTH FIELDS COMP.
05 LENGTH-COUNT-FIELDS PIC S9(5) VALUE +11.
05 LENGTH-PRINT-FIELDS PIC S9(5) VALUE + 9.
05 LENGTH-LONGEST-SEGMENT PIC S9(5) VALUE + 128.
LINKAGE SECTION.
01 I-O-PCB.
05 FILLER PIC X(10).
05 I-O-PCB-STATUS-CODE PIC X(2).
…..
![Page 102: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/102.jpg)
PROCEDURE DIVISION.
ENTRY ‘DLITCBL’ USING I-O-PCB ….
CALL ‘CBLTDLI” USING DLI-XRST
I-O-PCB
LENGTH-LONGEST-SEGMENT
RESTART-WORK-AREA
LENGTH-COUNT-FIELDS
COUNT-FIELDS
LENGTH-PRINT-FIELDS
PRINT-FIELDS.
IF I-O-PCB-STATUS-CODE NOT = SPACE
DISPLAY ‘RESTART-FAILED -- STATUS CODE :’ I-O-PCB-STATUS-CODE
ELSE
IF RESTART-WORK-AREA NOT= SPACES
PERFORM 100-REPOSITION-DATA-BASE.
……
![Page 103: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/103.jpg)
230-ISSUE-CHECKPOINT-CALL.
ADD 1 TO CHECKPOINT-ID.
CALL ‘CBLTDLI’ USING DLI-CHKP
I-O-PCB
LENGTH-LONGEST-SEGMENT
CHEKPOINT-ID
LENGTH-COUNT-FIELDS
COUNT-FIELDS
LENGTH-PRINT-FIELDS
PRINT-FIELDS.
IF I-O-PCB-STATUS-CODE NOT =SPACE
DISPLAY ‘ CHECKPOINT FAILED -- STATUS CODE:’ I-O-PCB-STATUS-CODE
…..
![Page 104: IMSDB Data](https://reader033.vdocuments.us/reader033/viewer/2022061107/544cde48b1af9f67018b4f2e/html5/thumbnails/104.jpg)
General Structure of an Online Program
Get twa.
IF twa-save-area not = low values
****the control to this program has come from a different transaction
Get the some information from TWA
process the details from TWA
Load the map
send it and return.
else
if eibcalen > 0 (check commarea)
****the program is in pseudoconversation
get information from commarea
receive map
process the details on the map
send it and return
else
*****program is invoked for the first time from screen
Load the map with default values
send the map and return.