62884091 ims db fundamentals latest

Upload: anupam-srivastava

Post on 04-Jun-2018

230 views

Category:

Documents


3 download

TRANSCRIPT

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    1/111

    IMS / DB

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    2/111

    2IMS Fundamentals

    Table of Contents

    Database SystemDefinition and Types

    Introduction to IMS

    IMS terminologies, organization, access methods

    Control Blocks (DBD and PCB)

    DBD - Definition, Functions and Macros PSB - Definition, Functions and Macros

    How to run application program using DL/I

    SSAsQualified and Unqualified

    Command Codes

    DL/I Calls

    Status Codes

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    3/111

    3IMS Fundamentals

    Table of Contents (Contd..)

    System service DL/I calls

    Checkpoint Restart

    Rollback calls

    Exercises Case StudyHR Application

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    4/111

    4IMS Fundamentals

    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 informationprocessing

    Concurrency and easily manageable.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    5/111 5IMS 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 eachrecord 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.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    6/111 6IMS Fundamentals

    Types of DBMS (Contd..)

    2. Network

    The network model is a database model conceived as a more flexiblealternative to the hierarchical model. Where the hierarchical modelstructures data as a tree of records, with each record having oneparent record and many children, the network model allows eachrecord to have multiple parent and child records, forming a lattice

    structure.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    7/1117IMS 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.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    8/1118IMS Fundamentals

    What is IMS?

    IMS (Information Management System) is IBM's hierarchical databaseproduct

    Hierarchical Data base management system that supports the applicationprogram while processing data bases in batch or on-line environments.

    IMS maintains an Inverted Tree Structure starting with the Root Segmentby 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

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    9/111

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    10/111

    10IMS 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.

    Limitat ions:

    Not many tools for IMS compared to DB2 (File aid ~ file structure on pc)

    Rigid design of IMS doesnt make it programmer friendly

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    11/111

    11IMS Fundamentals

    IMSComponents

    Five componentsof IMS Environment

    1. Database Management System Is the heart of IMS subsystem.Shared by many concurrent tasks. Data is stored in DASD. Applicationprograms access data by making DL/I calls.

    2. DL/I (Data Language Interp reter) Is a set of program modulesinterfacing database and application program. The modules use standardoperating system access methods and a set of specialized access methodsto handle data transfers to and from the database. Is an interface languageused by the application program.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    12/111

    12IMS Fundamentals

    IMSComponents (Contd..)

    3. DL/I Contro l Block s- There are two main DL/I control blocks namely, Database Descriptor (DBD) which describes the databasestructure and Program Communication Block (PCB) which identifieshow the database may be accessed by the program.

    4. Appl icat ion Program Are designed and coded by theprogrammers. Programs use a standard DL/I interface to other IMScomponents. DL/I application programs use standard CALL statementswith a parameter list to communicate with IMS. Programs may be writtenin COBOL, PL/I and ASM. Eg: first stmt in IMS program DLITCBL, all

    subsequent calls are CBLTDLI.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    13/111

    13IMS Fundamentals

    IMSComponents (Contd..) &

    Features

    5. Data Communication Is a set of program modules that allowthe program to communicate with remote terminals. Programscommunicate with terminals through a Standard Interface Languageusing CALL statements with a parameter list.

    Primary Products IMS/ESA Transaction ManagerIMS/TM

    IMS/ESA Database ManagerIMS/DB

    Product Implementations

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

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    14/111

    14IMS Fundamentals

    Typical Hierarchical structure

    DEALER

    MODEL

    ORDER STOCK SALES

    Parent of Model segment

    Child (dependent of dealer

    segment parent of order, stock,and sales Segments)

    Dependents of Model Segment

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    15/111

    15IMS Fundamentals

    Traversal in IMS database

    IMS database traversal generally follows:

    Top to bottom

    Left to right

    Front to back

    Illustration follows:

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    16/111

    16IMS Fundamentals

    Traversal in IMS database (Contd..)

    Emp - 002Ep - 001

    Cp -

    SSE

    Bd -

    22345

    67890

    Sd - Mar06Sd - Feb06

    Sd - Jan06

    Ed1

    Ec1

    Ad1

    Sd - Mar06

    Sd - Feb06

    Sd - Mar05

    Sd - Feb05

    Bd -

    12988

    76890

    Cp -

    SSE

    Cp -

    SE

    Bd -

    12345

    67890

    Sd - Jan05Sd - Jan06

    Ed1

    Ec1

    Ad1

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    17/111

    17IMS Fundamentals

    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.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    18/111

    18IMS Fundamentals

    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.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    19/111

    19IMS Fundamentals

    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

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    20/111

    20IMS Fundamentals

    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.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    21/111

    21IMS Fundamentals

    Terms in an IMS Database (Contd..)

    TWINS

    - All occurrences of a particular segment type under a single parentsegment occurrence are called TWINS

    DATABASE (IMS)

    - A database consists of all root segment occurrences along with theirdependents.

    - Is normally shared by multiple applications.

    DATABASE RECORD

    - A database record has one root segment occurrence along with all theoccurrences of its child segments in hierarchic sequence

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    22/111

    22IMS Fundamentals

    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

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    23/111

    23IMS Fundamentals

    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 thephysical structure of the database. The DBD also defines the appearanceand 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 theway it is accessed.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    24/111

    24IMS Fundamentals

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

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    25/111

    25IMS Fundamentals

    What is DL/I ?

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

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

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    26/111

    26IMS Fundamentals

    DL/I and Application program

    DL/I and the Application Program

    DATA BASE

    OPERATING SYSTEM

    DL/I

    DBD PSB

    APPLICATION PROGRAM

    YourAddressSpace orRegion

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    27/111

    27IMS Fundamentals

    How DL/I Relates to your

    application program

    DATABASE

    DATASET

    DL/I

    APPLICATION

    PROGRAM

    DL/I DATA BASE

    PROCESSING

    OPERATING

    SYSTEM

    ACCESS

    METHOD

    FILE DATA

    SET

    STANDARD FILE

    PROCESSING

    STANDARD

    COBOL I/O

    STATEMENTS

    CALLS TO DL/I

    OPERATING

    SYSTEM

    ACCESS

    METHOD

    APPLICATION

    PROGRAM

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    28/111

    28IMS Fundamentals

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

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    29/111

    29IMS Fundamentals

    Defining DBD

    Suppose the ACCENTURE hierarchical structure has been designed. Thename of the segments has been chosen. Now we must tell IMS about thisdatabase. IMS needs to know about all the keys, search fields, andrelationships that are designed as part of the organization database.

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

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    30/111

    30IMS Fundamentals

    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.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    31/111

    31IMS Fundamentals

    DBD - Data base definitionMacros

    DBD Names the database being described and specifies itsorganization.

    DATASET Specifies the names of files used to store the data. Defines

    each file which comprises the data base. It defines the DDnames and the dataset information.

    SEGM Defines the name of the segment type, its position inthe data base and how it is related to other segments.

    LCHILD Defines a relationship between two different segmenttypes. This could be an index relationship, a logicalrelationship or a secondary index.

    FIELD Defines a field within a segment. It identifies the fieldname, its length in bytes, its starting position, and thetype of data in the field.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    32/111

    32IMS Fundamentals

    DBD-Data base definition Macros(Contd..)

    XDFLD Defines the source fields for a secondary index.

    DBDGEN This statement ends the SEGM and FIELD definitions for

    the DBD. Marks the end of statements defining the DBD.

    END This statement marks the end-of-data to the assembler

    process.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    33/111

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    34/111

    34IMS Fundamentals

    Data Base Descriptor (DBD)(Contd..)

    The RULES can be FIRST, LAST AND HERE. This is primarily used forINSERT operations with no key field or has a NON UNIQUE key.

    RULES = LASTInsert as the LAST OCCURANCE for the NON

    UNIQUE keyRULES =FIRSTInsert as the FIRST OCCURANCE for the NON

    UNIQUE key

    RULES = HEREInsert at the CURRENT POSITION established in thedatabase for the corresponding NON UNIQUE key

    PARENT=(SEGMENTNAME,SNGL)Only pointer

    PARENT=(SEGMENTNAME,DBLE)Two pointers DBDGEN process creates the DBD load

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    35/111

    35IMS Fundamentals

    Data types in DBD Macro

    The following data types are allowed in a DBDmacro:

    C : Character

    P : Packed decimal

    Z : Zoned decimal

    X : Hexadecimal

    H : Halfword binary

    F : Fullword binary

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    36/111

    36IMS Fundamentals

    Hands On - DBD

    Create the structure of a Database from the given DBD in mainframe

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    37/111

    37IMS Fundamentals

    PSBProgram specification block

    PSB is the view of an IMS database or the "Program Can Seepart of thedatabase for an application program

    Describes the logical structure of one or more data bases to theapplication program

    The logical data structure is defined by creating PSB

    Defines segment sensitivity for each data base

    Defines the processing options for the segments

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    38/111

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    39/111

    39IMS Fundamentals

    PSB - Program specification block(Contd..)

    The PSB statements are processed by the PSBGEN and a load

    module is produced, much the same as the DBDGEN process.

    Within the PSB are one or more control blocks, called PCBs or

    program communication blocks. There is a control block for eachdata base that may be accessed. If more than one pointer is

    required for processing the data base in the program, then there will

    be multiple PCBs for the same data base. If there is a secondary

    index associated with the data base, then there is a separate PCB to

    specify the secondary index processing option.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    40/111

    40IMS Fundamentals

    PSB - Program Specification Block

    - Macros

    PCB Defines the database to be accessed by the applicationprogram. The statement also defines the type of operationsallowed by the application program. Each database requires aseparate PCB statement. PSB generation allows for up to 255

    database PCBs.

    SENSEG Defines the segment types to which the applicationprogram will be sensitive. A separate SENSEGstatement is required for each segment type. If asegment is defined as sensitive, all the segments in thepath from the root to that segment must also be defined assensitive.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    41/111

    41IMS Fundamentals

    PSB - Program Specification Block

    Macros (Contd..)

    SENFLD - Defines the fields in a segment type to which the

    application program is sensitive. Can be used only in

    association with field-level sensitivity.TheSENFLD

    statement must follow the SENSEG statement to which

    it is related.

    PSBGEN - Identifies the language of the program that will use

    the PSB and gives a name to the PSB coded at the

    end.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    42/111

    42IMS Fundamentals

    PSB - Program Specification Block

    Macros (Contd..)

    PROCOPT-Defines the type of access to a database or segment.

    PROCOPTs can be used on the PCB or SENSEGstatements.

    Primary PROCOPTcodes are as follows:

    G - read only

    R - replace, includes G

    I - insert

    D - delete, includes G

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    43/111

    43IMS Fundamentals

    PSB - Program Specification Block

    Macros (Contd..)

    A - get and update, includes G, R, I, D

    K - used on SENSEG statement; program will have key-only

    sensitivity to this segment

    L/LS- load database

    Secondary PROCOPTcodes are as follows:

    E - exclusive use of hierarchy or segments

    O - get only, does not lock data when in use

    P - must be used if program will issue path call using the D

    command code S - sequential (LS is required to load HISAM and HIDAM

    databases; GS gets in ascending sequence)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    44/111

    44IMS Fundamentals

    PSB - Program Specification Block(Contd..)

    Illustration of using PROCOPT codes.

    PCB TYPE=DB

    DBDNAME=INVENORG,

    KEYLEN=24,

    PROCOPT=GO (G as primary, O as secondary)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    45/111

    45IMS Fundamentals

    PSB - Program Specification Block(Contd..)

    SENSEG NAME=LOCATION,PARENT=0,

    PROCOPT=O

    SENSEG NAME=PROJECT,PARENT=LOCATION

    SENSEG NAME=EMPLOYEE,PARENT=PROJECT,

    PROCOPT=A

    PSBGEN LANG = COBOL,PSBNAME=ORGAN

    END

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    46/111

    46IMS Fundamentals

    PSB - Program Specification Block(Contd..)

    TYPE=DB -- required for each database the program can access

    TYPE=TP -- required for output message destinations in case of IMS/DC

    SENSEG -- required for each segment in the database the application

    program can access (up to 30000 SENSEG statements canbe defined for PSB generation)

    SENFLD -- required for each field in the segment that an application

    program can access (up to 255 SENFLD statements can bedefined for each SENSEG and an overall 10000 SENFLDcan occur in a PSB)

    PROCOPT -- required to specify the program's processing options

    KEYLEN -- indicates the greatest KEYLEN from all the paths in a DB PSBGEN -- required for each PSB generation

    END -- required for each PSB generation

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    47/111

    47IMS Fundamentals

    Hands On - PSB

    Create the structure of a PSB from the given DBD in mainframe

    How to Run an Application

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    48/111

    48IMS Fundamentals

    How to Run an Application

    Program Using DL/I

    DL/I Batch initialization module (DFSRRC00).

    //STEP1 EXEC PGM=DFSRRC00,REGION=962K,TIME=2,COND=(4,LT),

    // PARM=(DLI,PGMNAME,PSBNAME,,,,,,,,,,,N)

    Application program and DL/I execute together.

    CALL CBLTDLI USING DLI-function

    PCB-Mask

    Segment-io-area

    { SSA(s) }

    COBOL Basics For Processing a

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    49/111

    49IMS Fundamentals

    COBOL Basics For Processing a

    DL/I database

    ENTRY statements

    ENTRY 'DLITCBL USING PCB-MASK1

    PCB-MASK2PCB-MASK3

    The order in which the PCB masks appear in the Entry Statement is

    important, the linkage section PCB-Mask's can be in any order.

    GOBACK instead of STOP RUN.

    COBOL Basics For Processing a

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    50/111

    50IMS Fundamentals

    COBOL Basics For Processing a

    DL/I database (Contd..)

    LINKAGE SECTION.

    01 PCB-MASK1.

    05 PCB-EMPLOYEE-DB.

    10 PCB-DBN-DB1 PIC X(08). --> Name of Database

    10 PCB-LEV-DB1 PIC X(02). --> Level of last successful

    call10 PCB-STC-DB1 PIC X(02). --> Status Code

    10 PCB-PRO-DB1 PIC X(04). --> PROCOPT from PSB

    10 PCB-RES-DB1 PIC S9(5) COMP. --> Reserved for DL/I

    10 PCB-SGN-DB1 PIC X(08). --> Last Segment

    Successfully retrieved ina call

    10 PCB-LKF-DB1 PIC S9(5) COMP. --> Length of ConcatenatedKey

    COBOL Basics For Processing a

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    51/111

    51IMS Fundamentals

    COBOL Basics For Processing a

    DL/I database (Contd..)

    10 PCB-NOS-DB1 PIC S9(5) COMP. --> Number of

    Segments used to

    create the

    concatenated key

    10 PCB-KFB-DB1 PIC X(26). --> Key Feed Back

    Area (to get the

    concatenated key)

    10 FILLER REDEFINES PCB-KFB-DB1.

    15 PCB-KFB-KEY1-SEG1-EMPDB PIC X(06).

    15 FILLER PIC X(20). Key

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    52/111

    52IMS Fundamentals

    Some common status codes

    SPACESsuccessful retrieval.

    GBEnd of database.

    GENot found.

    II Duplicate segment while insertion.

    DAKey field changed.

    DJNo get hold call before DLET or REPL.

    GKSegment of diff type but at the same hierarchical level.

    GAHigher level segment was retrieved during sequential

    call.

    SSA Segment Search Argument

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    53/111

    53IMS Fundamentals

    SSA - Segment Search Argument

    Segment Search Argument

    The SSA is used to specify to DL/I the segment and path of the data you

    want to access with the DL/I call. In most cases, a separate SSA is used

    for each hierarchical level on the path to the required segment. The SSA

    may be unqualified or it may be qualified with the key field name andvalue of the segment being accessed.

    An example of a typical SSA entry in a COBOL application program. The

    KEY-FIELD-VALUE depends on the length of the key field of the

    segment being searched.

    SSA - Segment Search Argument

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    54/111

    54IMS Fundamentals

    (Contd..)

    01 SSA1.05 SEGMENT-NAMEPIC X(08).

    05 COMMAND-CODES PIC X(03).

    05 LEFT-PARENPIC X(01).

    05 KEY-FIELD-NAME PIC X(08).

    05OPERATORPIC X(02).

    05 KEY-FIELD-VALUE PIC X(08).

    05 RIGHT-PARENPIC X(01).

    CALL CBLTDLI USING CALL-FUNCTION

    PCB-DB

    IO-AREA

    SSA1

    SSA2

    .

    .

    .

    SSAn.

    SSA - Segment Search Argument

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    55/111

    55IMS Fundamentals

    SSA Segment Search Argument(Contd..)

    An SSA contains the following statements:

    SEGMENT NAME - This value tells DL/I which segment to access.

    COMMAND CODES - IMS command codes can be used here to modify theDL/I call.

    LEFT PAREN (OR SPACE) - If left blank, the SSA will be an unqualified SSA.

    SSA - Segment Search Argument

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    56/111

    56IMS Fundamentals

    SSA Segment Search Argument(Contd..)

    KEY FIELD NAME - The key field, search field, or index field that will be used

    in the segment search.

    OPERATOR - A relational operator (for example, EQ, GT, LT) can be used.

    KEY FIELD VALUE - This is the value of the field that will be processed.

    RIGHT PAREN - This statement is used to indicate the end of the SSA.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    57/111

    57IMS Fundamentals

    Qualified and Unqualified SSAs

    Qualified call

    A qualified call is the one in which we have SSAs. Qualified call can beeither with Qualified SSA or Unqualified SSA.

    Qualified SSA

    Has 8 characters segment name followed by ( in the 9thposition of the

    SSA defined.

    Unqualified SSA

    Has 8 characters Segment name followed by space in the 9th position ofthe SSA defined.

    Unqualified call

    An un-qualified call on the other hand has no SSA.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    58/111

    58IMS Fundamentals

    DL/I Calls

    The purpose of a DL/I call is to instruct DL/I to perform a certain action

    involving the data stored in the IMS database.

    A DL/I call includes four parts :

    CALL FUNCTION - Tells DL/I what needs to be done (for example,

    retrieve, update, insert, delete).

    PCB - Gives the name of the PCB of the database that will be referenced

    by the call.

    I/O AREA - Specifies the work area for the requested segment.

    SSA - Specifies the segment and path of the data to be accessed.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    59/111

    59IMS Fundamentals

    DL/I Calls (Contd..)

    Format of a DL/I call in a COBOL application program.

    CALL CBLTDLI USING CALL-FUNCTION

    PCB-DB

    IO-AREA

    SSA1

    SSA2

    .

    .

    .SSAn.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    60/111

    60IMS Fundamentals

    DL/I Calls (Contd..)

    DL/I calls can be subdivided into:

    Retrieval calls

    Update calls and

    Miscellaneous calls

    Generally all the DL/I calls are defined in a copybook and copied

    into the program. There by reusing the copybook in all IMS

    programs. Only calls that are required by a program can be used.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    61/111

    61IMS Fundamentals

    Retrieval calls

    GU(Get Unique) Gets the first segment which matches thequalifiers

    GN (Get Next) Gets the next segment in hierarchic order whichmatches the qualifiers in the call

    GNP(Get Next Within Parent) Gets the next segment under the current parentwhich matches the qualifiers specified in the call

    GHU(Get Hold Unique) Same as GU, but locks the segment forsubsequent update (DLET or REPL)

    GHN(Get Hold Next) Same as GN, but locks the segment forsubsequent update (DLET or REPL)

    GHNP(GHN Within Parent) Same as GNP, but locks the segment forsubsequent update (DLET or REPL)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    62/111

    62IMS Fundamentals

    Update calls

    ISRT(Insert) To insert a segment in the database

    REPL (Replace) To replace an existing segment with new

    data (The key to segment can not be

    changed, and previous 'GET HOLD'

    command must be issued)

    DLET (Delete) To delete an existing segment from the

    data base (The previous 'GET HOLD'

    command must be issued)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    63/111

    63IMS Fundamentals

    Miscellaneous Calls

    CHKP To take a 'check point' or 'commit updates to the databasebefore the program terminates.

    XRST To restore the database position after a check point hasbeen taken

    PCB To schedule a PSB in an on-line program

    TERM To terminate a PSB in an on-line program

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    64/111

    64IMS Fundamentals

    Command Codes

    Command Codes in a SSA makes the call powerful since DL/I treats suchSSAs differently from those without the command codes while performingsome special functions.

    Command codes save programming and processing time.

    Command codes are specified in an SSA following the segment name andan Asterisk *.

    * in the ninth position in a SSA indicates that one or more commandcodes follow the * and 10thposition will be reserved for the commandcode.

    11thposition will be for the left parenthesis (.

    A Blank or Left parenthesis marks the end of the command codes.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    65/111

    65IMS Fundamentals

    Command Codes(Contd..)

    ONE or MORE command codes can be used in any combination usingrelational operators like &.

    Command Codes are codes specified in the SSAsthat help to optimizethe performance of IMS programs and leads to Simplified Coding.

    Command Codes extend the functionality of DL/I calls.

    Multiple DL/I calls can be reduced to a single DL/I call by usingCommand Codes.

    If we dont need to use Command Codes while processing we canoverride the existing command code in the program (before the callwhere SSA is used) by passing/using the NULL (-) Command Code.

    C C

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    66/111

    66IMS Fundamentals

    Command Codes(Contd..)

    The 10 Command Codes available in IMS are :

    C Concatenated key in the SSA.

    D Retrieve this segment data into the I-O Area (Path call).

    F Locate the first segment occurrence that satisfies the SSA.

    L Locate the last segment occurrence that satisfies the SSA.

    N Do not replace this segment.

    Q Locks a segment for your program's exclusive use.

    Command Codes (Contd )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    67/111

    67IMS Fundamentals

    Command Codes(Contd..)

    U Specify the current database positions at that level is not allowed tobe changed by the call

    P Establish Parentage at this level

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

    'NULL Used as the place holder in SSA's so that command codes canbe removed/inserted from SSA's without having to define

    separate SSA's in working storage.

    Examples for command codes

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    68/111

    68IMS Fundamentals

    Examples for command codes

    Command code C can be used to replace multiple SSAs into one single SSA. If we are retrieving just lower level segment occurrences instead of defining multiple

    SSAs, with field name, relational op and search value, define the concatenated key forthe segment.

    01 Employee-Bankdetl-SSA.

    05 Filler pic x(11) value EMPLOYEE*C(.

    05 Employee-SSA-empno pic x(06) value spaces.

    05 Compdtl-SSA-desg pic x(02) value spaces.05 Bankdtl-SSA-acctno pic x(10) value spaces.

    05 Filler pic x value ).

    01 Bankdtl-IO-area pic x(21).

    .

    .

    Procedure Division.

    Pass the key values to empno, desg and account no. before the call.

    Call CBLTDLI Using DLI-GUPCB-Mask

    Employee-Bankdetl-SSA

    Bankdtl-IO-area

    Examples for command codes(Contd )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    69/111

    69IMS Fundamentals

    (Contd..)

    Command code D (path call) can be used to replace multiple IMS CALL statements with a single CALLstatement.

    If we need to retrieve all the I/O areas of the path traversed, the calls can be combined together with a I/O areadefinition, that would accommodate all the fields retrieved. IO area should be defined with caution.

    01 Employee-SSA.

    05 Filler pic x(11) value Employee*D(.

    05 Filler pic x(10) value Emplno =.

    05 empl-no pic x(06).

    05 Filler pic x value ).01 Compdtl-SSA.

    .

    01 Bankdtl-SSA.

    .

    01 Path-Call-IO-area.

    05 emp-io-area pic x(56).

    05 comp-io-area pic x(12).

    05 bank-io-area pic x(11).

    Procedure Division.

    Call CBLTDLI using DLI-GUPcb-mask

    path-call-io-area

    employee-ssa

    compdtl-ssa

    bankdtl-ssa

    Some examples of IMS retrieval

    ll

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    70/111

    70IMS Fundamentals

    calls

    GU - Get Unique - Fully Qualified SSA

    11000000

    10000009

    PROJ0002

    EMP00002EMP00003

    01 LOCATE-QSSA.

    05 F PIC X(9) VALUE LOCATION(.

    05 F PIC X(08) VALUE LOCATEID.

    05 LOCATE-OP PIC X(02) VALUE SPACES.

    05 LOCATE-KEY PIC X(08) VALUE ZERO.

    05 F PIC X(01) VALUE ).

    MOVE 100000009 TO LOCATE-KEY

    MOVE EQ TO LOCATE-OP

    CALL CBLTDLI USING GU-FUNCTION

    ORGAN-PCB-MASK

    LOCATE-SEGMENT

    LOCATE-QSSAIF LOCATE-PCB-STATUS = bb

    CONTINUE

    ELSE

    PERFORM error-routine.

    IMS retrieval calls

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    71/111

    71IMS Fundamentals

    IMS retrieval calls(Contd..)

    GU - Multiple Fully Qualified SSAs

    10000000

    10000009

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002EMP00003

    MOVE 10000009 TO LOCATE-KEY

    MOVE EQ TO LOCATE-OP

    MOVE PROJ0002 TO PROJECT-KEY

    MOVE EQ TO PROJECT-OP

    CALL CBLTDLI USING GU-FUNCTION

    PARTS-PCB-MASK

    SUPPLIER-SEGMENT

    LOCATE-QSSA

    PROJECT-QSSA

    IF LOCATE-PCB-STATUS = bb

    CONTINUEELSE

    PERFORM error-routine.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    72/111

    IMS retrieval calls (C td )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    73/111

    73IMS Fundamentals

    IMS retrieval calls (Contd..)

    GUMULTIPLE - Unqualified SSA

    11000000

    10001009

    10000001

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002

    EMP00003

    01 LOCATION-USSA. PIC X(9) VALUE LOCATION .

    01 PROJECT-USSA PIC X(9) VALUE PROJECT .

    01 EMPLOYEE-USSA PIC X(9) VALUE EMPLOYEE .

    05 F PIC X(9) VALUE LOCATION .

    CALL CBLTDLI USING GU-FUNCTION

    ORGAN-PCB-MASK

    EMPLOYEE-SEGMENT

    LOCATION-USSA

    PROJECT-USSA

    EMPLOYEE-USSA.

    IF LOCATE-PCB-STATUS = bb

    CONTINUE

    ELSE

    PERFORM error-routine.

    IMS retrieval calls (C td )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    74/111

    74IMS Fundamentals

    IMS retrieval calls (Contd..)

    GUMISSING - SSAS

    11000000

    10001009

    10000001

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002

    EMP00003

    01 LOCATE-QSSA.

    05 F PIC X(9) VALUE LOCATION .

    CALL CBLTDLI USING GU-FUNCTION

    ORGAN-PCB-MASK

    PROJECT-SEGMENT

    PROJECT-USSA

    EMPLOYEE-USSA.

    IF ORGAN-PCB-STATUS = bb

    CONTINUE

    ELSE

    PERFORM error-routine.

    IMS retrieval calls (Contd )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    75/111

    75IMS Fundamentals

    IMS retrieval calls (Contd..)

    GUNO - SSAS

    11000000

    10001009

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002

    EMP00003

    CALL CBLTDLI USING GU-FUNCTION

    ORGAN-PCB-MASK

    LOCATE-SEGMENT

    IF ORGAN-PCB-STATUS = bb

    CONTINUE

    ELSE

    PERFORM error-routine.

    IMS retrieval calls (Contd )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    76/111

    76IMS Fundamentals

    IMS retrieval calls (Contd..)

    GN - Fully Qualified SSA

    11000000

    10000009

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002EMP00003

    01 LOCATE-QSSA.

    05 F PIC X(9) VALUE LOCATION(.

    05 F PIC X(08) VALUE LOCATEID.

    05 LOCATE-OP PIC X(02) VALUE ZERO.

    05 LOCATE-KEY PIC X(08) VALUE ZERO.

    05 F PIC X(01) VALUE ).MOVE 110000000 TO LOCATE-KEY

    MOVE EQ TO LOCATE-OP

    CALL CBLTDLI USING GN-FUNCTION

    ORGAN-PCB-MASK

    LOCATE-SEGMENT

    LOCATE-QSSA

    IF LOCATE-PCB-STATUS = bb

    CONTINUE

    ELSE

    PERFORM error-routine.

    IMS retrieval calls (C td )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    77/111

    77IMS Fundamentals

    IMS retrieval calls (Contd..)

    GN - Unqualified SSA

    11000000

    10001009

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002

    EMP00003

    01 LOCATE-QSSA.

    05 F PIC X(9) VALUE EMPLOYEE .

    CALL CBLTDLI USING GU-FUNCTION

    ORGAN-PCB-MASK

    LOCATE-SEGMENT

    EMPLOYEE-USSA.

    IF LOCATE-PCB-STATUS = bb

    CONTINUE

    ELSE

    PERFORM error-routine.

    IMS retrieval calls (Contd )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    78/111

    78IMS Fundamentals

    IMS retrieval calls (Contd..)

    11000000

    10001009

    10000001

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002

    EMP00003

    CALL CBLTDLI USING GN-FUNCTION

    ORGAN-PCB-MASK

    EMPLOYEE-SEGMENT

    LOCATION-QSSA

    PROJECT-QSSA

    EMPLOYEE-USSA.

    IF LOCATE-PCB-STATUS = bb

    CONTINUE

    ELSE

    PERFORM error-routine.

    GNMULTIPLEUnqualified SSAS

    IMS retrieval calls (Contd )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    79/111

    79IMS Fundamentals

    IMS retrieval calls (Contd..)

    11000000

    10001009

    10000001

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002

    EMP00003

    CALL CBLTDLI USING GN-FUNCTION

    ORGAN-PCB-MASK

    GENERAL-IO-AREA .

    IF LOCATE-PCB-STATUS = bb OR GA OR GK

    CONTINUE

    ELSE

    PERFORM error-routine.

    GN-Combination of SSA types

    IMS retrieval calls (Contd )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    80/111

    80IMS Fundamentals

    IMS retrieval calls (Contd..)

    11000000

    10001009

    10000001

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002

    EMP00003

    01 LOCATION-USSA. PIC X(9) VALUE LOCATION .

    01 PROJECT-USSA PIC X(9) VALUE PROJECT .

    01 EMPLOYEE-USSA PIC X(9) VALUE EMPLOYEE .

    05 F PIC X(9) VALUE LOCATION .

    CALL CBLTDLI USING GU-FUNCTION

    ORGAN-PCB-MASK

    EMPLOYEE-SEGMENT

    LOCATION-USSA

    PROJECT-USSA

    EMPLOYEE-USSA.

    IF LOCATE-PCB-STATUS = bb

    CONTINUE

    ELSE

    PERFORM error-routine.

    GN - No SSAS

    IMS retrieval calls (Contd..)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    81/111

    81IMS Fundamentals

    IMS retrieval calls (Contd..)

    GNPGET NEXT WITH IN PARENT

    11000000

    10001009

    10000001

    PROJ0001

    PROJ0002

    EMP00001

    EMP00002

    EMP00003

    CALL CBLTDLI USING GU-FUNCTION

    ORGAN-PCB-MASK

    LOCATION-SEGMENT

    LOCATIONI-QSSA

    IF ORGAN-PCB-STATUS = BB

    PERFORM 1500-GNP-PROJECT

    UNTIL ORGAN-PCB-STATUS = GE

    ELSE PERFORM ERROR-ROUTINE

    1500-GNP-PROJECT.

    CALL CBLTDLI USING GNP-FUNCTION

    ORGAN-PCB-MASK

    SUPPLIER-SEGMENT

    PROJECT-USSA

    ISRT Calls

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    82/111

    82IMS Fundamentals

    ISRT Calls

    Inserts a new segment occurrence. Before issuing the call, you must

    populate the I/O area for the new segment. The I/O area must contain the

    same fields in the same order, length, and data types that exist on the

    segment being inserted.

    ISRT Calls are used to add segments to a DL/I database either during theupdate processing of new segments or during the load operation.

    ISRT calls can use qualified or unqualified SSA s, E.g. Of ISRT Call usingan unqualified EC SSA, make sure of the pointer before unqualified call.

    ISRT Calls (C td )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    83/111

    83IMS Fundamentals

    ISRT Calls(Contd..)

    DL/I will try to execute this call by inserting the EC occurrence in the Database basedon the current position in the database

    CALL 'CBLTDLI' USING CN-ISRT

    PCB-MASK1

    WK-OUTPUT-REC

    WS-UNQUAL-EC-SSA

    E.g. Of ISRT Call using a qualified call

    CALL 'CBLTDLI'USING CN-ISRT

    PCB-MASK1

    WK-OUTPUT-RECWS-QUAL-EMP-SSA

    WS-QUAL-CP-SSA

    WS-UNQUAL-BD-SSA

    ISRT Calls (Contd )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    84/111

    84IMS Fundamentals

    ISRT Calls(Contd..)

    DL/I will try to execute this call by inserting the BD occurrence in theDatabase based on the position obtained from the QUAL-EMP segmentoccurrence and the QUAL-CP segment occurrence.

    DL/I returns status code GE if the segment occurrence mentioned usingthe qualified SSA s is not found.

    When the lower level segment types in a database have non uniquesequence fields or dont have any sequence fields then the ISRT worksbased on RULES specified in the DBD.

    RULES = FIRST, the new segment occurrence is inserted before allexisting twins

    RULES = LAST, the new segment occurrence is inserted after all existingtwins

    ISRT Calls (C td )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    85/111

    85IMS Fundamentals

    ISRT Calls(Contd..)

    RULES = HERE, the new segment occurrence is inserted at the currentposition in the database

    The RULES mentioned in the DBD can be overridden by CommandCode

    RULES = FIRST can be overridden by coding Command Code L inSSA

    However RULES = LAST, CANNOT be overridden by coding CommandCode F

    The D Command Code can be specified to insert more than onesegment occurrence types along a path

    ISRT Calls (Contd )

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    86/111

    86IMS Fundamentals

    ISRT Calls(Contd..)

    When D Command Code is being used for insert, the PROCOPT=P shouldbe specified in the PSB.

    For Load operation, all segments must be inserted in hierarchical sequence.Also the PSB must have PROCOPT = L or LS.

    The Status Code GE during ISRT calls happen when the segment occurrencebeing inserted with Qualified SSA s is not present in the database.

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    87/111

    ISRT Calls (INSERT MODE)

    Status Codes

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    88/111

    88IMS Fundamentals

    Status Codes

    The following are some status codes encountered while issuing a ISRTcall to insert a segment into an already loaded database:

    IIThe segment already exists in the database. A duplicate key value

    is being inserted into.

    IXEncountered an Insert Rule Violation. Program tried to insert a

    segment into the wrong place. For e.g. A stock segment is being

    inserted under the Dealer segment, when it is in fact dependant

    upon the Model segment.

    ISRT Calls (LOAD MODE)Status

    Codes

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    89/111

    89IMS Fundamentals

    Codes

    The following are some status codes encountered while issuing a ISRTcall to load segments into an empty database:

    LBWhen you try to load the same segment twice i.e. segment already

    exists

    LCThe segments being loaded are not in their Hierarchical sequencei.e. key values out of sequence

    LDNo Parent for the segments being loaded. You cannot load a

    dependant segment until its parent has been loaded

    LESegment types out of sequence. For e.g. If you tried to load a stock

    segment before a model segment

    REPL Calls

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    90/111

    90IMS Fundamentals

    Replaces current data in a selected segment with new data from the I/O area.

    It must be preceded by a GHU, GHN, or GHNP call.

    A REPL generally does not use an SSA. The segments key fields cannot be

    changed.

    There are two restrictions for REPL Calls

    Cannot ch ange the length of the Segment

    Cannot c hange the value of the Sequence Field

    Never Code a qualified SSA on a REPL Call. Replace processing can be done

    with Path Calls.

    REPL Calls(Contd..)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    91/111

    91IMS Fundamentals

    ( )

    For Replace operation with Path Calls, we can negate replacement of certainintermediate segment occurrences by giving Command Code N

    E.g. Of REPL Call

    CALL 'CBLTDLI' USING CN-GHUPCB-MASK1

    WK-REC

    WS-QUAL-EMP-SSA

    WS-QUAL-SAL-SSA

    WS-QUAL-TAX-SSA

    Change some values obtained in WK-REC

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    92/111

    REPL Calls(Contd..)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    93/111

    93IMS Fundamentals

    The Status code AJ happens when we try to use Qualified SSA on a

    REPL Call

    The Status Code DJ happens when a GHU or GHN call doesnt precede

    the REPL Call

    The Status Code DA happens when the program tries to make change

    to the Segment Key field before giving REPL call

    REPL Calls Status Codes

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    94/111

    94IMS Fundamentals

    REPL Calls Status Codes

    The following are some status codes encountered while issuing a REPLcall :

    DJReplace call issued without an immediately preceding GETHOLD

    call

    DAProgram has changed the segments KEY FIELD

    RXEncountered a Replace Rule Violation

    AJUsed a qualified SSA

    DLET Calls

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    95/111

    95IMS Fundamentals

    Deletes the segment previously retrieved and all of its dependents, even if

    the application is not defined as sensitive to them. It must be preceded by

    a GHU, GHN, or GHNP call (see GET HOLD Calls). Deletes generally do

    not use SSAs.

    Works similar to a REPL call, a Get Hold Call should be given first followedby a DLET call.

    Never code a qualified SSA with DLET call.

    Unqualified SSA s can be coded in a DLET call when we are using PathCalls (Command Code D, since the pointer position is known)

    DLET Calls(Contd..)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    96/111

    96IMS Fundamentals

    A DLET Path Call will delete the entire path.

    The scope of a Path Delete can however be limited by supplying oneunqualified SSA without a command code, such calls should be avoidedunless sure of the pointer position.

    The Status code AJ happens when we try to use Qualified SSA on a DLETCall.

    The Status Code DJ happens when a GHU or GHN call doesnt precede theDLET Call.

    The Status Code DA happens when the program tries to make change to theSegment Key field before giving DLET call.

    DLET CallStatus Codes

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    97/111

    97IMS Fundamentals

    The following are some status codes encountered while issuing a DLETcall :

    DJDelete call issued without an immediately preceding GETHOLD

    call

    DAProgram has changed the segments KEY FIELD

    DXEncountered a Delete Rule Violation

    AJUsed a qualified SSA

    Some more DL/I Status codes

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    98/111

    98IMS Fundamentals

    AB The call did not specify a segment IO area AC SSA with a hierarchical error

    AH Call requires at least one SSA

    AJ Call specifies an Invalid SSA

    AI Error encountered when trying to open the database

    dataset. An error in the JCL DD statement

    AK The field named in a qualified SSA is not correct

    AT The IO area specified in the call is too large but the

    programs PSB may be incorrect

    AO Call caused an operation resulting in a physical IO error

    System ServiceDL/I Calls

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    99/111

    99IMS Fundamentals

    The four important DL/I calls that perform various system servicefunctions 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 IMSprogramming 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 lastcheckpoint to be permanently committed to the physical database therebymaking Backout impossible.

    A CHKP call causes the database position for a PCB to be reset, apartfrom releasing all the locks held by the program.

    System ServiceDL/I Calls

    (Contd..)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    100/111

    100IMS Fundamentals

    ( )

    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 outdatabase updates up to the last checkpoint.

    Works with the Extended Restart (XRST) call to restart your program if itterminates abnormally

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    101/111

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    102/111

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    103/111

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    104/111

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    105/111

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    106/111

    Exercises (Contd..)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    107/111

    107IMS Fundamentals

    DOCTORDOC_NAME PIC X(20)

    DOC_ADDR PIC X(50)

    DOC_PHONE PIC X(10)

    DOC_SPL PIC X(15)

    Assume the following data is available in the database:

    WARD Segment:

    101, 20, 25, F

    102, 10, 22, G

    103, 30, 45, M

    Exercises (Contd..)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    108/111

    108IMS Fundamentals

    PATIENT Segment:1001, PAUL, 101/B OAK WOOD NY, 41278906

    1231, SIMPSON, 123/C JOHN STREET NJ, 4177231

    1231, CATHY, 77-Y WINSTON ROAD ATLANTA, 7634211

    1001, PAUL, 101/B OAK WOOD NY, 41278906

    DOCTORSegment:

    SAMUEL, 11-9 KENNEDY ST CAL, 890076, ORTHO

    RANDY, 15/A PERKIN HALL IN, 77886611, DENTIST

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    109/111

    Exercises (Contd..)

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    110/111

    110IMS Fundamentals

    4. Write aDLET call to delete theWARDrecord.

    102, 10, 22, G

    5. Write anISRT call to insert theDOCTOR record.

    CHRISTY, 78/L TOM ST OHIO, 892357, OPTHALMOLOGY

    Case StudyHR Application

  • 8/13/2019 62884091 IMS DB Fundamentals Latest

    111/111

    111IMS Fundamentals