Sie sind auf Seite 1von 85

TATA INFOTECH LTD.

Information Management System Hand Out


TABLE OF CONTENTS

1.

WHAT IS IMS? ................................................................................................................................... 1 1.1. HIERARCHICAL DATA BASE .............................................................................................................. 1

2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17.

GENERAL CONCEPTS IN IMS ...................................................................................................... 2 ARCHITECTURE OF IMS ............................................................................................................... 6 WHAT IS A DBD? .............................................................................................................................. 7 WHAT IS A PSB? ............................................................................................................................... 8 WHAT IS AN ACB? ......................................................................................................................... 10 WHAT IS DL/I? ................................................................................................................................ 10 IMS PROCESSING .......................................................................................................................... 11 DL/I DATABASE ORGANIZATION ............................................................................................. 14 ENTRY AND GOBACK STATEMENT ........................................................................................ 21 IMS PROCESSING .......................................................................................................................... 23 WHAT IS A SSA? ............................................................................................................................. 23 DL/I CALLS ...................................................................................................................................... 24 UNSUCCESSFUL CALLS ............................................................................................................... 32 COMMAND CODES ........................................................................................................................ 33 DL/I STATUS CODES ..................................................................................................................... 34 DL/I ACCESS METHODS .............................................................................................................. 37

17.1. HSAM ....................................................................................................................................... 37 17.1.1. Defining HSAM ..................................................................................................................... 37 17.1.2. Stored Segment Occurrence .................................................................................................. 38 17.2. HISAM ...................................................................................................................................... 38 17.2.1. Data storage using KSDS-ESDS: ...................................................................................... 38 17.2.2. Stored Segment Occurrence .................................................................................................. 39 17.2.3. Stored Segment Occurrence .................................................................................................. 41 17.3. HDAM ....................................................................................................................................... 44 17.3.1. Data Storage using ESDS/OSAM ......................................................................................... 44 17.3.2. Defining HDAM .................................................................................................................... 46 17.3.3. Stored Segment Occurrence .................................................................................................. 46 17.4. HIDAM ..................................................................................................................................... 47 17.4.1. Defining HIDAM .................................................................................................................. 47 18. SECONDARY INDEXING .............................................................................................................. 48 SEGMENTS IN SECONDARY INDEXING ......................................................................................... 48 SECONDARY DATA STRUCTURE ................................................................................................. 49 POINTERS IN SECONDARY INDEXING .......................................................................................... 50

18.1. 18.2. 18.3.

IIMSHD/VER 0.2 .

For Internal Use Only

TATA INFOTECH LTD.


19. 20.

Information Management System Hand Out

MULTIPLE DATASET GROUP .................................................................................................... 52 WHAT IS A LOGICAL RELATIONSHIP? .................................................................................. 53 TYPES OF LOGICAL RELATIONSHIPS ........................................................................................... 54 DEFINITIONS............................................................................................................................... 57 RULES IN LOGICAL RELATIONS................................................................................................... 65

20.1. 20.2. 20.3. 21.

DATA COMMUNICATION AND MESSAGE FORMAT SERVICE ........................................ 65

21.1. WHAT IS A LOGICAL TERMINAL? ................................................................................................ 66 21.2. MESSAGE PROCESSING IN IMS ................................................................................................... 66 PROCESSING A JOB IN IMS DB/DC ENVIRONMENT .................................................................................. 67 21.4. INPUT MESSAGE AREA ............................................................................................................... 70 21.5. OUTPUT MESSAGE AREA ........................................................................................................... 71 21.6. MESSAGE FORMAT SERVICE AND ITS CONTROL BLOCKS ............................................................ 72 CODING OF MFS STATEMENTS ................................................................................................................... 1 21.8. CODING OF DEVICE FORMAT STATEMENTS ................................................................................. 74 21.9. CODING MESSAGE DESCRIPTOR CONTROL STATEMENTS ........................................................... 79 21.10. DYNAMIC CHANGING OF ATTRIBUTES AND CURSOR POSITION CONTROL .................................. 81

IIMSHD/VER 0.2 .

For Internal Use Only

TATA INFOTECH LTD.

Information Management System Hand Out

1. What is IMS?
IMS is an acronym that stands for Information Management System. A software product for creating and managing the physical storage and retrieval of data that is organized using hierarchical data structure. 1.1. Hierarchical Data Base A hierarchical data base consists of collection of elements called as segments. Segments are connected to each other through links. It is similar to an upside down tree structure. The top of hierarchy forms the root. A segment may relate downwards to one or more sub-ordinate segments called as child segments. A segment may relate to only one segment above it called as parent segment.

COURSE (Root)

CLASS (Parent/Child)

INSTRUCTOR (Child)

STUDENT (Child)

Fig.1.0. Hierarchical Structure

IIMSHD/VER 1.0

For Internal Use Only

Page 1 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

2. General Concepts in IMS


Segment: Each grouping of data. Basic element of the data structure. Consists of one or more related fields. Can be compared with file record. Unit of I/O. It is an entity and cannot be broken. Can contain Key Field or Sequence Field: A field within a segment used for searching, indexing and sequencing purposes. Only one key per segment is allowed and should be the first field in the segment. It may or may not be unique. Search Field: A field within a segment that is a non-key field but can be used for search operations. Data Field: A field within a segment that contains data related to the segment. Data in this field cannot be used for search operations

In Fig. 1.0. COURSE, CLASS, INSTRUCTOR, STUDENT are segments. Segment Type: Layout of segment within hierarchical structure. Can be compared with record description. Maximum 255 per data base record. Segment Occurrence: Consists of a set of field occurrences within a segment. Can be compared with a record occurrence in a flat file system. Can have key field called as sequence field. A particular segment type can have any number of segment occurrences. Fig 2.0. shows the segment occurrences.

IIMSHD/VER 1.0

For Internal Use Only

Page 2 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

COURSE2 COURSE1
CLASS1 Segment Occurrence

INSTRUCTOR1 INSTRUCTOR2

STUDENT2 STUDENT1

Twin Segments Fig. 2.0.

Root Segment: Highest level segment in data base structure. Only one root per data base record. A root may have any number of child segments. Root segment is at level 01. Refer Fig.2.1. Dependent Segments: All segments under a particular segment are dependent segments. Any segment other than root segment is called as dependent segment. Parent Segment: A dependent segment which has one or more dependent segments is called as a parent segment. Refer Fig.2.1. Child Segment: A segment that is directly dependent on some other segment is called child segment. A child segment cannot have more than one parent. Refer Fig.2.1. Only Parent Segment: A segment which does not have any parent. The root is the parent-only segment. Refer Fig.2.1. Only Child Segment: A dependent which does not have any dependents. Refer Fig.2.1.

IIMSHD/VER 1.0

For Internal Use Only

Page 3 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Parent/Child Segment: A dependent, which has dependents, can be a parent/child segment. Refer Fig. 2.1.

Twin Segment: Multiple occurrences of a particular child segment under a common parent segment. Refer to fig. 2.0. Sibling: Child segment types under one parent segment type. Refer Fig 2.1. Path: Series of continuous segment occurrences starting from root to any dependent segment. The path starting from the root and ending at the last level is called complete path. Level: This indicates the depth of tree from root. The roots being at level one. There can be maximum 15 levels. Refer Fig. 2.1. Segment Type Code (STC): Each Segment is assigned a value ranging from 1 to 255 according to hierarchic sequence. This value is called STC. Root always starts with STC = 01. These values are used by the operating system access methods for the retrieval of data. Refer Fig. 2.1. STC = 01

COURSE (Level-01)
STC = 02 PRE-REQ (Level-02) STC = 03 CLASS (Level-02) Parent/Child

Root /Only Parent

Sibling STC = 04 INSTR (Level-03)

STC = 05 STUDENT (Level-03) Only Child & Siblings Fig. 2.1.

IIMSHD/VER 1.0

For Internal Use Only

Page 4 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Data Base Record: Each occurrence of root segment with all its sub-ordinate segments makes a single data base record. Refer Fig. 2.2.

COURSE1
CLASS1

INSTRUCTOR2 INSTRUCTOR1

STUDENT2 STUDENT1

Twin Segments Fig. 2.2. Data Base Record Concatenated Key: Sequence field of each segment within hierarchical path beginning with root segment sequence field. Is positioned from left to right. Refer Fig. 2.3.

COURSE1

CRS1

Concatenated Key

CRS1PRE1

PREQ1

CLASS1

CRS1CLS1

STUDENT1
Fig. 2.3. Concatenated Key IIMSHD/VER 1.0 For Internal Use Only

CRS1CLS1STU1

Page 5 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

3. Architecture of IMS

Host Language + DL/I

PSB

P C B

P C B

...

Logical Database

D B D

D B D

D B D

........

Physical Database

Fig 3.0. Architecture of IMS

Fig.3.0. shows the architecture of IMS. The host language Data language/I (DL/I) acts as an interface between the application program and the operating system. The Program Communication Block (PCB) describes a logical view of the database as seen by the application program. An application program can have more than one view. These views are clubbed together to form a Program Specification Block (PSB). The physical data structure is called as Data Base Descriptor (DBD). The operating system access methods used for IMS are: Virtual Storage Access Method (VSAM) IIMSHD/VER 1.0 For Internal Use Only

Page 6 of 84

TATA INFOTECH LTD. Indexed Sequential Access Method (ISAM) Overflow Sequential Access Method (OSAM)

Information Management System Hand Out

4. What is a DBD?
Means Data Base Description. Used to describe the complete structure of database (physical database). The DBA initiates a process called DBDGEN (Data base generator) to describe physical structure of database.

A DBD contains: Segment Types. Parent Child relations. Field in each segment. Search fields (optional).

Defining a DBD: Source form of DBD written in assembler macro is input to DBDGEN program. Assembly Macros are expanded with the help of Macro Library. Load Module is stored in DBD library and retrieved when required by IMS. Refer Fig.4.0.

Assembler Macro

DBDGEN Programs

DBD Library

Macro Library

Fig.4.0. DBDGEN Definition. IIMSHD/VER 1.0 For Internal Use Only Page 7 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Essentials for defining the structure: Data base name. Dataset name and location. Segment name, parent and size. Field names, size, start position and type.

DBDGEN Statements: DBD NAME=TRGDBD DATASET DD1=IN,DEVICE=3380 SEGM NAME=COURSE,PARENT=0,BYTES=256 FIELD NAME=(COURSE#,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=TITLE,BYTES=33,START=4,TYPE=C ............... DBDGEN FINISH END.

5. What is a PSB?
Means Program Specification Block. This control block specifies the information regarding different views i.e. the databases (one or more) a program can access, the data elements the program can see in those databases, and the processing the program can do. There is only one PSB in a given application program. What is a PCB? Means Program Communication Block. An application program may have more than one view (logical data structure). Each view is defined in a PCB. Set of all PCBs is included in the PSB. The PCB defines which of the segments in the database the program can access. PCB also defines how the application program is allowed to process the segments (update, retrieve only, load only etc.). PCB has two types of sensitivity : Segment level sensitivity If an entire segment is included in the view it is said to have segment level sensitivity. Field level sensitivity If the data view includes only certain fields within a segment it is said to have field level sensitivity.

IIMSHD/VER 1.0

For Internal Use Only

Page 8 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

A PCB contains: DBD Name. Concatenated Key length. Processing Options (PROCOPT). Sensitive Segments. Sensitive fields. Defining a PSB: Source form of PSB written in assembler macro is input to PSBGEN program. Assembly Macros are expanded with the help of Macro Library. Load Module is stored in PSB library and retrieved when required by IMS. Refer Fig.5.0.

Assembler Macro

PSBGEN Programs

PSB Library

Macro Library

Fig. 5.0. PSBGEN Definition. PSBGEN Statements: TYPE=DB,DBDNAME=TRGPDBD,KEYLEN=15, PROCOPT=A SENSEG NAME=STREAM SENFLD NAME=STRNO . IIMSHD/VER 1.0 For Internal Use Only Page 9 of 84 PCB

TATA INFOTECH LTD. . PSBGEN NAME=INLOAD,LANG=COBOL END

Information Management System Hand Out

PCB : Program Communication Block PROCOPT : Program processing options. SENSEG : Sensitive Segment. SENFLD : Sensitive field

6. What is an ACB?
Means Application Control block. Used to pre-build the database with DBDs and PSBs. Used for faster access.

7. What is DL/I?
Stands for Data Language /I. It is the data manipulation language (DML) for IMS. Serves as an interface between the data base and application program i.e. It transfers information to and from database. Allows application program to manipulate database. Set of IMS modules that exist external to the application program. Subroutine called by application program that is host language (COBOL). DL/I Functions: Calls GU (Get- Unique) GN ( Get-Next) GNP (Get-Next-Within-Parent) REPL Description To obtain a unique occurrence of a segment within a database. To obtain the next occurrence of a segment within a database. Retrieves child segments under a parent To replace an occurrence of a segment in database. To delete an occurrence of segment in database. To insert an occurrence of segment in database.

DLET ISRT

IIMSHD/VER 1.0

For Internal Use Only

Page 10 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

8. IMS Processing

BATCH Processing

BATCH/MESSAGE

ON-LINE MESSAGE

Processing

Processing

Fig.8.0. Types of IMS Processing IMS processing is of the following types: (Refer Fig.8.0.) Batch Processing Online Message processing Batch Message processing IMS Batch Processing: JCL IMS Controller Application Program

DATA SET

DL/I

DBD Lib

PSB Lib

IIMSHD/VER 1.0

For Internal Use Only


DATA BASE

Page 11 of 84

TATA INFOTECH LTD. Fig.8.1. IMS Batch Processing

Information Management System Hand Out

IIMSHD/VER 1.0

For Internal Use Only

Page 12 of 84

TATA

Information Management System Hand Out

INFOTECH LTD. Data base access is offline. No data communication services or terminals are used. Input is pre-planned. Can access DL/I database as well as OS/VS data sets. Application Program is scheduled by JCL. Refer fig.8.1.

IMS Online Message Processing:

T E R M I N A L

MVS Address Space (VTAM)

Communication Controller Queue Manager

Message Queues

DL/I

DBD Lib

PSB Lib

Fig.8.2. DATA BASE IMS On-line Message Processing Called as Message Processing Program (MPP). Data Base Access is online. Can Access Message Queue and cannot access OS/VS data sets. Data communication services or terminals are used. Used for interactive processing. Transactions are entered at the terminal, which are stored in message queues. To process the transaction application program is invoked. Output can be seen at the terminal screen. Data Communication Calls are made in order to send and receive data on to the screens and Database calls are made to retrieve and store data on to database. Refer fig.8.2.

IIMSHD/VER 0.2

For Internal Use Only

Page 13 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out IMS Batch Message Processing Combination of Batch and Online Processing. BMP programs are scheduled by JCL. Can access online databases in Batch mode. Can access both OS/VS datasets and DL/I database Can access Message Queues. To invoke Application program through JCLs the transaction-Id is passed as a PARM parameter.

9. DL/I Database organization DL/I DATA BASE ORGANISATION

Hierarchical Sequential

Hierarchical Direct

HSAM

HISAM

HDAM

HIDAM

Fig.9.0. Access Methods

Access Methods (Refer Fig.9.0.) HSAM -> Hierarchical Sequential Access Method HISAM-> Hierarchical Indexed Sequential Access Method HDAM -> Hierarchical Direct Access Method HIDAM-> Hierarchical Indexed Direct Access Method

IIMSHD/VER 0.2

For Internal Use Only

Page 14 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

DL/I Databases are internally stored on Operating System data sets. DL/I uses Access Methods like:

HSAM

HISAM ISAM/ OSAM or VSAM

HDAM

HIDAM ISAM/ OSAM or VSAM

SAM

OSAM or VSAM

Fig.9.1. DL/I data base access methods Sequential access method (SAM). Indexed Sequential Access method (ISAM). Overflow sequential Access Method (OSAM). Virtual Storage Access Method (VSAM).

Understanding a DBD DBD statement Data set Statement Segment Statement Field Statement Consider the following Database Structure.

SUPPSEG

ITEM SEG

LOCSEG
Fig. 9.2. IIMSHD/VER 0.2 For Internal Use Only Page 15 of 84

TATA INFOTECH LTD. The DBD is as follows: PRINT DBD DATASET SEGM FIELD FIELD FIELD FIELD FIELD SEGM FIELD FIELD FIELD FIELD SEGM FIELD FIELD FIELD DBDGEN FINISH END

Information Management System Hand Out

NOGEN NAME= INPDBD,ACCESS=(HISAM,VSAM) DD1=PRIMEDS, OVFLW= OVFLWDS,DEVICE=3380, RECORD=(128,128) NAME=SUPPSEG,PARENT=0,BYTES=95 NAME=(SNO,SEQ,U),BYTES=3,START=1,TYPE= C NAME=SNAME,BYTES=30,START=4,TYPE=C NAME=SADDR,BYTES=30,START=34,TYPE=C NAME=SCITY,BYTES=20,START=64,TYPE=C NAME=SSTATE,BYTES=2,START=84,TYPE=C NAME=PARTSEG,PARENT=SUPPSEG,BYTES=45 NAME=(PNO,SEQ,U),BYTES=5,START=1,TYPE= C NAME=PNAME,BYTES=30,START=6,TYPE=C NAME=COLOR,BYTES=6,START=36,TYPE=C NAME=WEIGHT,BYTES=4,START=42,TYPE=P NAME=LOCSEG,PARENT=PARTSEG,BYTES=37 NAME=(LOCCOD,SEQ,U),BYTES=3,START=1,TYPE= C NAME=LDES,BYTES=30,START=4,TYPE=C NAME=QTY,BYTES=4,START=34,TYPE=C

DBD Statement Defines the database. It includes: Name of the database INPDBD. (All names are limited to 1-8 characters). DL/I access method HISAM. Underlying OS Access Method VSAM. It should be the first statement in database definition. Format: DBD NAME=dbdname, ACCESS=(HSAM) (HISAM [ ,ISAM ) VSAM ] (HDAM [ ,OSAM ) VSAM] (HIDAM [ ,OSAM ) VSAM] (INDEX [ ,ISAM ) for index in HIDAM VSAM] IIMSHD/VER 0.2 For Internal Use Only Page 16 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

DATASET Statement Defines the Operating System Data set(s) used to store the database. Eg: HISAM requires 2 data sets PRIMEDS, primary data set (VSAM KSDS) OVRFLWDS , Overflow data set (VSAM ESDS) RECORD=(128,128) specifies the logical record length of primary and overflow data set respectively. Data Definition names DD1 and DD2 are required to identify the data sets at execution time. DEVICE=3380, specifies the unit Format: DATASET

DD1=ddname1 ,DEVICE=device ,DD2=ddname2 ,OVFLW=ddname3 , RECORD=(lrec1,lrec2)

Example of DATASET statement: For HSAM DATASET DD1= ddname1 ,DD2=ddname2 ,DEVICE=device , RECORD=(lrec1,lrec2) For HISAM DATASET

DD1=ddname1 ,DEVICE=device ,OVLFLW=ddname3 , RECORD=(lrec1,lrec2)

For HDAM DATASET

DD1=ddname1 ,DEVICE=device

For HIDAM DATASET

DD1=ddname1 ,DEVICE=device

IIMSHD/VER 0.2

For Internal Use Only

Page 17 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

SEGM statement: SEGM statement defines the segment type and inter segment relationship. Sequence of SEGM statement reflects the hierarchical structure of the database. The order will be taken from Top to Bottom Left to Right

Format: SEGM NAME=segname1, PARENT=( [ ,0 or Segname2]) BYTES=max bytes

PARENT=0 indicates that the segment is root segment. PARENT=segname2 indicates that the current segment (segname1) is a child of segname2.

FIELD statement: Defines the format of field within the segment. It specifies: Name Length Type Starting position of field Specification of sequence field is optional. Default for SEQ is U (unique) unless M (multiple) is specified. Sequence field should be defined as the first field in the segment.

Format: FIELD

NAME=(fldname[,SEQ][,U/M]), BYTES=bytes, START=start position, TYPE=[C/X/P]

IIMSHD/VER 0.2

For Internal Use Only

Page 18 of 84

TATA INFOTECH LTD. Understanding PCB: PCB statement SENSEG Statement Referring to fig.9.2. the PCB for the DBD is PRINT PCB SENSEG SENSEG SENSEG PSBGEN END

Information Management System Hand Out

NOGEN TYPE=DB,DBDNAME=INPDBD,KEYLENGTH=11, PROCOPT=LS NAME=SUPPSEG NAME=PARTSEG,PARENT=SUPPSEG NAME=LOCSEG,PARENT=PARTSEG PSBNAME=INLOAD,LANG=COBOL

PCB Statement: Defines the DBD name, the key length and the processing options. TYPE=DB specifies that the PCB is for database and not for data communication (TYPE=TP). DBDNAME=INPDBD specifies the underlying physical database to which the PCB corresponds to. KEYLENGTH=11 specifies the length of the longest concatenated key. PROCOPT parameter specifies the type of operations user will be permitted to perform on the segment. The different PROCOPTs are: G Get operation IInsert RReplace DDelete AAll (GIRD) L or LSInitial Load KKey sensitivity OOnly P For path calls Note: PROCOPT can have four options at the most. SENSEG Statement It defines the segment to be included in the PCB. PSBGEN Statement Assigns a name to the PSB. LANG parameter specifies the host language, which is going to use the PSB.

IIMSHD/VER 0.2

For Internal Use Only

Page 19 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Definition of PCBMASK: Specifies address of each PCB in PSB.

DL/I

APPLICATION PROGRAM

ENTRY DLITCBL USING PCB-name1 [PCB-name2 .....] PCBs should be defined in the linkage section of COBOL program .....these are called PCB masks.
Fig.9.3. PCB Mask

For each PCB in the PSB an area with certain predefined fields is declared in the linkage section of the COBOL program. This area is called as PCBMASK.

Format: 01 PCB-MASK-1. 05 PCB-DBD-NAME 05 PCB-SEG-LEVEL 05 PCB-STATUS-CODE 05 PCB-PROC-OPTION 05 FILLER 05 PCB-SEG-NAME 05 PCB-KEY-LENGTH 05 05 PCB-NUM-SEN-SEG 05 PCB-KEY-FB-AREA

PIC X(8). PIC XX. PIC XX. PIC X(4). PIC S9(5) COMP. PIC X(8). PIC S9(5) COMP. PIC S9(5). COMP. PIC X(11).

PCB-DBD-NAME: Contains the name of the DBD being processed.

PCB-SEG-LEVEL: Contains the level of segment just processed.

IIMSHD/VER 0.2

For Internal Use Only

Page 20 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

PCB-STATUS-CODE: Tells whether DL/I call was successful or failed. If it is blank the call was successful. PCB-PROC-OPTION: Contains the processing options defined at the time of creation of PCB. PCB-SEG-NAME: Contains the name of the segment that has been just processed. PCB-KEY-LENGTH: Contains the length of the concatenated key until the last successful call. PCB-NUM-SEN-SEG: Gives the number of sensitive segments defined in the PCB macro.

PCB-KEY-FB-AREA: Contains the fully concatenated key . Note: All the data items defined in the PCBMASK are of a fixed length except for the PCB-KEY-FB-AREA. Its length will correspond to the length of longest possible concatenated key.

10. Entry and Goback Statement

ENTRY CBLTDLI DL/I GO BACK APPLICATION PROGRAM

Fig.10.0. Entry and Go Back Statement

IIMSHD/VER 0.2

For Internal Use Only

Page 21 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Entry Statement (Refer fig.10.0.) Used to initiate communication between DL/I and Application Program and facilitate use of IMS Resources. Should be the first statement in Procedure Division. Format: ENTRY DLITCBL USING pcb-name1 [pcb-name2]

GOBACK Statement (Refer fig.10.0.) Used to terminate the Application Program and transfer control to IMS. Should be the last statement coded in Procedure Division.

Format: GOBACK. Note: STOPRUN should not be coded.

DL/I Call Statement This statement is used to transfer control from the application program to the DL/I interface. Coded in the Procedure Division. Format: CALL CBLTDLI USING dli-function pcb-mask segment-io-area [ssas ] dl/i function is used to specify the operation to be performed on the database. This function has to be specified in the working-storage section. Eg: GU (Get Unique) Note: COBOL does not support Literal on CALL Statement segment-io-area is the name of the working-storage section field into which DL/I will return the retrieved data and from which DL/I will get the data for write, update operations.

IIMSHD/VER 0.2

For Internal Use Only

Page 22 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

ssa is the segment search argument. It is used to specify the search criteria. This is a variable in the working-storage section used to hold either the sequence field or the search field but not the data field.

11. IMS Processing


There are two types of IMS processing: Sequential Processing. Random Processing.

Sequential Processing: Data is read in a hierarchic sequence. To get the nth segment all the n-1 segments have to be read. The GN and GNP DL/I functions are used to retrieve data.

Random Processing: Access to database records is random. Only one read call (GU/GN) gets the required record.

12. What is a SSA?


Stands for Segment Search Argument. It is an area in the WORKING-STORAGE SECTION used to identify the segment that the program wants to access. It can be used to: Identify any occurrence of a segment type. Identify a specific occurrence of a segment type. It always follows the I/O area parameter. There can be 1-15 SSAs in a DL/I call. The SSAs must appear in hierarchical order of segment types.

SSA Contains: The segment name. The segment name and sequence field. The segment name and search field. Types of SSAs Unqualified searches for a specific segment type only. Qualified searches for a specific segment occurrence of a specific segment type.

IIMSHD/VER 0.2

For Internal Use Only

Page 23 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Unqualified SSA Specifies the segment name only. Call made using unqualified SSA will access the database to retrieve the segment from the current position.

Format: 01 UNQUALIFIED-SSA. 05 U-SSA-SEGMENT-NAME 05 FILLER

PIC X(8). PIC X VALUE .

Note: Segment name is padded with spaces whenever it is less than 8 characters. The blank in the 9th position distinguishes an unqualified SSA from a Qualified SSA.

Qualified SSA It supplies the DL/I call with either a sequence field value or search field value in addition to the segment name. Format: 01 QUALIFIED-SSA. 05 Q-SSA-SEGMENT-NAME 05 FILLER 05 KEY-NAME 05 OPERATOR 05 KEY-VALUE 05 FILLER

PIC X(8) VALUE SUPPSEG . PIC X VALUE (. PIC X(8) VALUE SNO . PIC XX VALUE =. PIC X(3) VALUE 111. PIC X VALUE ).

Note: Segment name is padded with spaces whenever it is less than 8 characters. value of sequence/search field depends on actual size of the field (variable).

13. DL/I Calls


Retrieve from database GU (Get Unique) GN (Get Next) GNP (Get Next Within Parent) Hold Calls GHU (Get hold Unique) GHN(Get hold next) GHNP(Get hold next within parent)

IIMSHD/VER 0.2

For Internal Use Only

Page 24 of 84

TATA INFOTECH LTD. Insert Call ISRT(Insert into Database ) Update Call REPL(Replace a record in database) DLET(Delete a record form database)

Information Management System Hand Out

COURSE

CLASS

STUDENT

Fig.13.0. Data base structure GU (Get Unique): Used to retrieve a unique segment. Used in case of random processing. Is independent of the position established by the previous calls. Retrieves the first occurrence of the segment satisfying the condition even if issued in a loop. Used to establish position in the database. The types of GU calls are: GU without SSA: Retrieves the first occurrence of the root segment. Used to reset the position in database. Format: CALL CBLTDLI USING DLI-GU PCB-MASK IO-AREA. Eg: In fig.13.0. GU call retrieves first occurrence of COURSE.

IIMSHD/VER 0.2

For Internal Use Only

Page 25 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

GU with unqualified SSA: Retrieves the first segment occurrence in the database that meets the criteria. The segment retrieved will be the one specified at the lowest level SSA.

Format: CALL CBLTDLI USING DLI-GU PCB-MASK IO-AREA USSA. Eg: Consider USSA is COURSE CLASS In fig.13.0. issuing this call will retrieve the first occurrence of CLASS under the first occurrence of COURSE. GU with qualified SSA: Retrieves the first segment occurrence in the database that meets the criteria. The segment retrieved will be the one specified at the lowest level SSA. A complete set of SSAs to retrieve a segment includes uniquely identified SSAs one for each segment. Processing is based on unique fields and unique values. Format: CALL CBLTDLI USING DLI-GU PCB-MASK IO-AREA QSSA. Eg: Consider that QSSA is COURSE (CRSNO = IMS) CLASS (EDCTR = ED01) STUDENT (STUNO = 001). In fig. 13.0. issuing the call with above SSA will retrieve the student details whose number is 001 under CLASS ED01 attending COURSE IMS.

IIMSHD/VER 0.2

For Internal Use Only

Page 26 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out GN (Get Next): Retrieves the next segment meeting the criteria from the currently established position. Used in case of sequential processing. Is dependent of the position established by the previous calls. GN without SSA if issued in a loop retrieves the entire database.

Types of GN calls are: GN without SSA: Retrieves the next occurrence of the segment that meets the criteria from the current position. When issued in a loop retrieves the entire database. Format: CALL CBLTDLI USING DLI-GN PCB-MASK IO-AREA. Eg: In fig.13.0. GN call retrieves next occurrence of COURSE from the current position. GN with unqualified SSA: Retrieves the next segment occurrence in the database that meets the criteria from the current position. The segment retrieved will be the one specified at the lowest level SSA. Format: CALL CBLTDLI USING DLI-GN PCB-MASK IO-AREA USSA. Eg: Consider USSA is COURSE CLASS In fig.13.0.. issuing this call will retrieve the next occurrence of CLASS under the COURSE where the current position is established.

GN with qualified SSA:

IIMSHD/VER 0.2

For Internal Use Only

Page 27 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out Retrieves the next segment occurrence in the database that meets the criteria from the current position. The segment retrieved will be the one specified at the lowest level SSA. A complete set of SSAs to retrieve a segment includes uniquely identified SSAs one for each segment. Processing is based on unique fields and unique values. This is same as GU issued with a fully qualified SSA. Used when sequence field is not unique i.e. used to retrieve duplicate segment occurrences. Format: CALL CBLTDLI USING DLI-GN PCB-MASK IO-AREA QSSA. Eg: Consider the QSSA as COURSE (CRSNO = IMS) CLASS (EDCTR = ED01) STUDENT (STUNO = 001) In fig13.0. issuing the call with above SSA will retrieve the student details whose number is 001 under CLASS ED01 attending COURSE IMS. GNP (Get-Next-Within-Parent): Used to sequentially access dependent segments of an established parent segment. Parentage has to be established before using GNP. Parentage can be established by issuing a GU or a GN call. After establishment of parentage the GNP call can be issued to retrieve all dependent segments. It searches only segment occurrence within a common parent. Establishing new parentage by issuing GU or GN can change parentage. Delete and Replace calls do not affect parentage. Insertion at higher level or same level as parentage will destroy the parentage. GNP with qualified SSA in a loop retrieves all the duplicates just like a GN with a fully qualified SSA. Format: CALL CBLTDLI USING DLI-GNP PCB-MASK IO-AREA [USSA/QSSA]

Eg: In fig.13.0. if the parentage is established at CLASS where CLASS=ED001 and a unqualified GNP call is issued ,then all the students under ED001 are retrieved. IIMSHD/VER 0.2 For Internal Use Only Page 28 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Hold Calls: GHU, GHN and GHNP functions like GU, GN and GNP respectively. These calls are issued to hold the segments retrieve by the call. These calls are used prior to DLET or REPL call. RULE Option for ISRT, REPL and DEL Format: RULE = position Position can take the values: FIRST: For insert the segment occurrence must be inserted at the first. For delete the first segment occurrence must be deleted. For replace the first segment occurrence must be replaced. HERE: For insert the segment occurrence must be inserted just after the current position. For delete the segment occurrence at the current position. must be deleted. For replace the segment occurrence at the current position. is to be be replaced. LAST: For insert the segment occurrence must be inserted at the last. For delete the last segment occurrence must be deleted. For replace the last segment occurrence must be replaced. Note: LAST is the default rule. LAST overrides FIRST and HERE. FIRST overrides HERE. LAST cannot be overridden. ISRT (Insert): Used to Add a data to an existing database. To load a new database. The data to be inserted is moved to the IO-AREA. An unqualified SSA is given to the segment to be inserted.

Inserting data to a existing Segment: A fully qualified SSA has to be given in order to establish the position where in the segment to be inserted and an unqualified SSA for the segment being inserted.

IIMSHD/VER 0.2

For Internal Use Only

Page 29 of 84

TATA INFOTECH LTD. Format: CALL CBLTDLI USING DLI-ISRT PCB-MASK IO-AREA QSSA1 USSA1.

Information Management System Hand Out

Eg: In fig.13.0. if data is to be inserted in STUDENT for an already existing COURSE and CLASS the SSAs will be QSSA1 is COURSE (CRSNO = IMS) CLASS (EDCTR = ED001) USSA1 is STUDENT With the above SSAs when an insert call is issued the data present in IO_AREA will be inserted as a new student for IMS course for ED001 class.

Initial loading of database: In this case only unqualified SSA is specified and the data to be inserted is placed in the IO-AREA. Format: CALL CBLTDLI USING DLI-ISRT PCBMASK IO-AREA USSA. Eg: USSA is COURSE. In fig.13.0. if ISRT call is issued with the above SSA a new database record for COURSE is inserted. REPL (Replace a segment occurrence): Used to replace an existing segment occurrence. Before REPL is issued, a GHU, GHN or GHNP must be issued in order to hold the segment occurrence to be replaced. No SSA must be given along with a REPL call (except path call). The length of segment cannot be changed and the value of sequence field cannot be changed.

When path call is issued along with GHU and a particular segment data is not to be changed then command code N must be issued along with the SSA for that particular segment. The new data must be moved to IO-AREA before replace call is issued.

IIMSHD/VER 0.2

For Internal Use Only

Page 30 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Format: CALL CBLTDLI USING DLI-REPL PCB-MASK IO-AREA . Eg: CALL CBLTDLI DLI-GHU PCB-MASK IO-AREA USSA. Here USSA is COURSE. CALL CBLTDLI DLI-REPL PCB-MASK IO-AREA. After this call is issued the first course data will be replaced with the new data that is in the IO-AREA. (Refer fig.13.0.)

DLET (Delete a segment occurrence): Used to delete an existing segment occurrence. Before DLET is issued, a GHU, GHN or GHNP must be issued in order to hold the segment occurrence to be deleted. No SSA must be given along with a DLET call (except path call). In case if the previous call was a path call, an unqualified SSA for the segment to be deleted can be given along with DLET call. When a segment occurrence is deleted then all the subordinate occurrences of that segment will also be deleted.

Format: CALL CBLTDLI USING DLI-DLET PCB-MASK IO-AREA [USSA].

Eg: CALL CBLTDLI USING DLI-GHU PCB-MASK IO-AREA USSA.

IIMSHD/VER 0.2

For Internal Use Only

Page 31 of 84

TATA INFOTECH LTD. Here USSA is COURSE. CALL CBLTDLI USING DLI-DLET PCB-MASK IO-AREA.

Information Management System Hand Out

After this call is issued the first course and its corresponding dependents data will be deleted (Refer fig.13.0.)

14.Unsuccessful Calls
What happens when a call fails?

A1

B3 B2 B1

E1

C2

C1
Fig. 14.0. Refer fig. 14.0. Consider the call GU A(AKEY=A1) B(BKEY=B1) C(CKEY=C3)

D1

F1

GN

What is the Output? Ans: D1

IIMSHD/VER 0.2

For Internal Use Only

Page 32 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out As seen in fig14.0. the COURSE occurrence with key C3 is not available. So the GU call fails. The Key feedback area contains values up to the step till where the call is successful. Hence when the call GN fails the data stored in Key feedback area is A1B1C1C2. So the current position established is at segment occurrence C2. Now the next call given is GN. So the next segment occurrence following it is D1. Hence the output is D1. Note: In case of GU and GN the current position is established just after the segment retrieved, in case of successful calls. In case of unsuccessful GU and GN the current position is established just after the segment examined to satisfy the criteria. In case of successful ISRT call the current position is just after the segment inserted. In case of successful DLET call the position is established at the point where the segment is deleted. In case of successful REPL call the previously established position is maintained.

15.Command Codes
Specified along with the SSA. This is used to Enhance functionality of SSA. Reduce the number of SSAs required. Reduces the number of calls required. Command codes can be used in Qualified Calls Unqualified Calls Format: For unqualified SSA WORKING-STORAGE SECTION. 01 UNQUALIFIED-SSA. 05 U-SSA-SEG-NAME 05 FILLER 05 U-SSA-COMD-CODE 05 FILLER

PIC X(8). PIC X VALUE *. PIC X. PIC X VALUE .

For qualified SSA WORKING-STORAGE SECTION. 01 QUALIFIED-SSA.

IIMSHD/VER 0.2

For Internal Use Only

Page 33 of 84

TATA INFOTECH LTD. 05 SSA-SEG-NAME 05 FILLER 05 SSA-COMD-CODE 05 FILLER 05 SRCH-FLD-NAME 05 FILLER 05 SRCH-VALUE 05 FILLER

Information Management System Hand Out PIC X(8). PIC X VALUE *. PIC X. PIC X VALUE (. PIC X(8) VALUE COURSE . PIC X(2) VALUE = . PIC X(8). PIC X VALUE ).

Command Code C D F L N P Q U V -

Meaning Use concatenated key for segment Path Call Retrieve the first occurrence of the segment under its parent Retrieve the last occurrence of the segment under its parent No replace for the segment for a path replace call Establish parentage at this level (above the lowest level segment returned by the call) Enqueue the segment Hold position for subsequent retrieval on this segment Hold position for subsequent retrieval on this segment and those above it The null command code has the same effect as no command code at all.

Note: F command code can be used with GN and GNP calls. Using it with GU call is meaningless since GU always retrieves the first segment occurrence meeting the criteria L command code can be used with GU, GN and GNP calls. PROCOPT= P should be defined in PCB before using D command Code.

16. DL/I Status Codes


These are the status codes returned as a result of the call issued against standard DL/I databases. IIMSHD/VER 0.2 For Internal Use Only Page 34 of 84

TATA INFOTECH LTD. Status Code AB AC AD AH AI AJ AK AM AO AT AU DA DJ DX GA GB GD GE GK GP II IX LB LC LD LE DL/I Call All All get calls & ISRT All ISRT All All All get calls & ISRT All All DLET,ISRT,R EPL All DLET, REPL DLET, REPL DLET Unqualified GN & GNP GN ISRT All get calls and ISRT Unqualified GN & GNP GNP ISRT ISRT ISRT ISRT ISRT ISRT Description

Information Management System Hand Out

Call did not specify a segment IO area Call included an SSA with an hierarchical error Function code field specified for the call contains an incorrect value. Call requires at least one SSA Error occurred when trying to open database data set. Invalid SSA Field you name on qualified SSA is incorrect. Processing options for call given not specified in PCB Call caused a physical I/O error The I/O Area the call specified is to large SSA specified in call exceeded maximum length allowed in PSB Sequence field has been changed Call wasnt immediately preceded by a successful get hold call The call violated a delete rule for segment A higher level segment was retrieved during sequential retrieval (expected condition) End of data base during sequential retrieval Position lost before the call could be completed. A segment occurrence meeting the specified condition wasnt found A segment of different type but at same hierarchical level was retrieved (expected condition) Proper parentage isnt in effect Segment already exists in database The call violated an insert rule for the segment Segment already exists in database Input data is not in hierarchical sequence One or more segment segments in path to the segment being loaded The sequence of segment types at the same level isnt same as that specified in DBD Description Call caused a physical I/O error on secondary index

Status Code NO

DL/I Call DLET,REPL,I SRT

IIMSHD/VER 0.2

For Internal Use Only

Page 35 of 84

TATA INFOTECH LTD. RX V1 bb(spaces) A3 A5 QC QD QE QF QH RX XA

Information Management System Hand Out Call violated a replace rule for a segment Variable length segment longer than maximum segment size specified The call was executed normally Program tried to send a message to a modifiable PCB but no destination associated with it. Program specified a MOD name for a segment other than the first in output message No input message are present for the program No segments are present for the current input message The Program issued a GN call before message GU call The message segment is 5 chars long or less The destination of output message is undefined The call violated a replace rule for a segment The program has already responded to the originating terminal, but it is trying to pass the SPA to another program The Program has already passed the SPA to another program but trying to send output message to the originating terminal The Program sent a message whose ZZ field has value other than binary zeros The logical terminal involved in a conversation is not defined properly to IMS An IO error occurred while IMS was Accessing the SPA The first output message of a conversational program was not the SPA SPA is invalid because the first six bytes were altered by the program The program tried to perform a message switch to a non conversational program The program tried to perform a message switch by passing SPA to it more then once Th program tried to perform a message switch to a transaction that is not defined. A system or I-O error The SPA the program tried to insert is larger then the value specified in PSB

ISRT DLET, REPL,ISRT All ISRT ISRT Message GU Message GN Message GN Message GU, ISRT Message ISRT Database ISRT Message ISRT

XB

Message ISRT

XC XF X1 X2 X3 & X7 X4 X5 X6 X8 X9

Message ISRT Message ISRT Message GU,ISRT Message ISRT Message ISRT Message ISRT Message ISRT Message ISRT Message ISRT Message ISRT

IIMSHD/VER 0.2

For Internal Use Only

Page 36 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

17. DL/I Access Methods


The different Access methods are: HSAM -> Hierarchical Sequential Access Method HISAM-> Hierarchical Indexed Sequential Access Method HDAM -> Hierarchical Direct Access Method HIDAM-> Hierarchical Indexed Direct Access Method 17.1. HSAM Is stored on a tape or DASD as a sequential data set. Here the segments of a database record are related by physical adjacency. Used for sequential processing only i.e. entire database is searched sequentially for a segment. GN, GU,GNP calls can be processed. No capability for REPL and DLET calls. Any modification on existing database is done by creating a new version of database. Sequence Key need not be defined for the dependents, when defined for the root the database records should be stored in ascending value of key.

17.1.1. Defining HSAM

10 1617 72 DBD NAME=SAMHSAM,ACCESS=HSAM DATASET DD1=SAMHSAM1,DD2=SAMHSAMO,DEVICE=3380, X RECORD=(512,512)

ACCESS=HSAM specifies that DL/I access method HSAM should be used DD1=SAMHSAMI,DD2=SAMHSAMO SAMHSAMI is used for input operations (GN, GU,GNP) SAMHSAMO is used to contain new version of database after replace or delete RECORD=(512,512) is the record length of SAMHSAMI, SAMHSAMO respectively HSAM does not have capability of Multiple data set groups* logical relations* Secondary Indexing* Note: * will be discussed later.

IIMSHD/VER 0.2

For Internal Use Only

Page 37 of 84

TATA INFOTECH LTD.


17.1.2. Stored Segment Occurrence

Information Management System Hand Out

S T C

D B

SEGMENT DATA
Fig.17.0.

Segment Type Code (STC): This is the first byte in the segment. The value ranging from 1-255. Delete Byte: It is of one byte. When set used to indicate that the segment occurrence is marked for deletion. Not used in case of HSAM. Segment Data: The actual data of the segment. 17.2. HISAM Requires two data sets Primary Overflow Gives indexed access to root segment data stored in primary data set. Gives sequential access to the dependents. (may be stored in Primary/Overflow dataset). Capability for REPL and DLET calls. Used primarily for sequential processing. HISAM using Key Sequential Data Set (KSDS) as Primary Data set and Entry Sequential Data Set (ESDS) as overflow data set
17.2.1. Data storage using KSDS-ESDS:

INDEX SET Dependent data SEQUENCE SET CONTROL AREA CONTROL INTERVAL (CI) KSDS Dataset Fig. 17.1. Note: - - - - -> indicates NDP ESDS Dataset 00

IIMSHD/VER 0.2

For Internal Use Only

Page 38 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

As shown in the fig.17.1. KSDS is divided into Index component and Data component The index component contains the index set and sequence set. The data is stored in control Area. Control Area is divided in to number of Control Intervals (CI). Number of entries in sequence set will be equal to number of CI in a control area. Number of sequence sets will be equal to the number of control areas. The entries in index set correspond to the number of sequence set. An entry in sequence set corresponds to the highest value of the root segment entered in CI. Each database record starts at the beginning of logical record in primary dataset. The Root along with some of the dependents is stored in KSDS and the remaining dependents are stored in ESDS. The pointer from a root in KSDS to corresponding dependents in ESDS , the link between two records in ESDS is called as next dependent pointer(NDP). NDP occupies four bytes and contains the Relative Byte Address (RBA) of next dependent segment in ESDS. NDP will have value zeros if it is in the last segment occurrence of a particular database record. Insertion, Replace and Deletion can be performed for segments in both datasets. In case of deletion of a segment occurrence in KSDS the deletion is physically done and the space becomes reusable. Deletion in case of ESDS dataset is done by setting the delete byte in that segment occurrence. Physical deletion does not take place. Hence the space is not reusable.
17.2.2. Stored Segment Occurrence

S T C

D B

N D P

SEGMENT DATA

Fig.17.2. In fig. 17.2. NDP stands for next dependent pointer that occupies four bytes and contains the Relative Byte Address (RBA) of the record containing next dependent segment.

IIMSHD/VER 0.2

For Internal Use Only

Page 39 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Insertion Each time a root Segment is entered a new KSDS record is created. Root Segment is placed at the front of the record. As many subordinate segments as will fit in the record are placed after the root. If the KSDS is filled before all the dependent segments are loaded A new ESDS record is created. Next dependent segment is placed at the front of the record. RBA of the ESDS is placed in the next dependent pointer position of the root. If ESDS record is filled before all dependent segments have been loaded A new ESDS record is created. RBA of the new ESDS record is placed in the NDP position of the previous ESDS record. HISAM using Indexed Sequential Data Set (ISDS) as Primary Dataset and Operating System Access Method (OSAM) as overflow dataset. Data storage in ISAM-OSAM HISAM

ISAM/OSAM

ISAM dataset

OSAM dataset

Fig.17.3.

IIMSHD/VER 0.2

For Internal Use Only

Page 40 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out Here no control Intervals/ control areas are there. Here ISAM is divided into logical records. The Index contains entry for each logical record in ISDS.
17.2.3. Stored Segment Occurrence

Segment Prefix

Root Overflow Pointer

Segment Data

Next Dependent Pointer

Fig.17.4. In fig 17.4. NDP stands for next dependent pointer, which occupies four bytes and contains the Relative Byte Address (RBA) of next dependent segment. Here the NDP exists at the end of all stored segments in the record. Here address is of 3 bytes. ROP stands for Root Overflow Pointer. It is used to contain the pointer to a root in OSAM dataset, inserted after initial load.

Data storage in ISAM / OSAM CRS1 CRS3 CRS4 Dependent Data

CRS1

Dependent Data

ROP

CRS3 CRS4

. . . CRS2

ISAM Fig. 17.5

New Root Inserted OSAM

IIMSHD/VER 0.2

For Internal Use Only

Page 41 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out While loading the database initially, each root segment is stored in an ISAM record. As many subordinate segments as will fit in the record are placed after the root. The root along with some of the dependents is stored in ISAM dataset and the subsequent segments are stored are stored in OSAM dataset. RBA of OSAM record is placed in dependent pointer of ISAM record. For all Subsequent segments a new OSAM record is created and next dependent pointer of previous record is set accordingly. If the insertion of a root segment occurrence is done after the initial loading then Case (i) The root segment is being inserted in between two previously entered root segment occurrences. Here the root segment along with its dependents gets inserted in OSAM data set. The ROP is adjusted accordingly so that proper link is maintained. Eg: In Fig.17.5. Two COURSES with sequence key CR1 and CR3 have been initially inserted and now we want to insert course with sequence key CR2. A new record is created in OSAM and COURSE with sequence key CR2 is stored in it along with its dependents. Now the ROP of COURSE with sequence key CR3 points to COURSE with sequence key CR2. Note: Here index once created during initial loading is not updated. The links are maintained through ROP. Case(ii) The root segment occurrence is to be inserted at the end of the database( i.e. after the previously entered record) Here a new record is created in ISAM and the data is filled accordingly as when initially loaded. Eg: In fig. 17.5. COURSES with sequence key CR1,CR2 and CR3 have been initially inserted and now we want to insert course with sequence key CR4. A new record is created in ISAM. The root along with some dependents depending on the size of record are filled in that record and the subsequent segments are inserted in OSAM. The index is updated accordingly.

Deletion in case of ISAM-OSAM Deletion of a segment is accomplished by setting the flag in Delete byte. Here space after deletion is not reusable.(both for the data stored in ISAM as well as OSAM). IIMSHD/VER 0.2 For Internal Use Only Page 42 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

HISAM has capability of Multiple dataset groups* logical relations* Secondary Indexing* Note: * will be discussed later.

Defining a HISAM DBD NAME=SAHISAM,ACCESS=(HISAM,VSAM) DATASET DD1=HISAMPR,OVFLW=HISAMOV DEVICE=3380, RECORD=(128,128)

ACCESS=(HISAM,VSAM) specifies DL/I access method HISAM should as underlying access method. DD1=HISAMPR, ,OVFLW=HISAMOV HISAMPR is the primary dataset(KSDS) HISAMOV is the overflow dataset(ESDS)

be used. VSAM is used

RECORD=(128,128) is the length of HISAMPR, ,HISAMOV respectively.

Hierarchical Direct (HD) databases Use Hierarchical Direct Access Method. Here the relationships among segments do not rely on their physical positions. Instead segments are related to one another by pointer values stored in them. The pointer values are four-byte relative addresses (RBAs). Here each direct pointer which is stored in the segments prefix points directly to another segment occurrence, whether that segment is at the beginning of a record or not. After a segment has been inserted into a HD database, its position is fixed; i.e. it isnt moved when some other segments are added as in HISAM database. When a segment is deleted from a HD data base the space is immediately available to store another segment.

Child & Twin Pointers There are four kinds of child/Twin Pointers.

IIMSHD/VER 0.2

For Internal Use Only

Page 43 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out Physical Child First (PCF) Pointer This pointer is a part of the prefix of parent segment and its value contains the RBA of the first child occurrence of the related child segment subordinate to the parent segment. If a parent segment has more than one directly dependent segment types, there is one PCF pointer for each. Physical Child Last (PCL) Pointer This points to the last occurrence of the specified segment type subordinate to a given parent segment occurrence . Physical Twin Forward (PTF) Pointer This pointer chains to the next twin segment occurrence. Physical Twin Backward (PTB) Pointer This pointer chains to the previous twin segment occurrence. This pointer is optional.

17.3.

HDAM Provides Direct (randomized) access to the root. Provides Direct (pointer) access to the dependents. Used for primarily direct processing. Implemented using either ESDS or OSAM.

Data Storage using ESDS/OSAM

Logical Record

Root Addressable Area

Overflow Area

ESAM/ OSAM Fig. 17.6.

IIMSHD/VER 0.2

For Internal Use Only

Page 44 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

ESDS/ OSAM dataset are divided into two areas: Root Addressable Area: Overflow Area. (Refer fig.17.6.) In each control interval in the root addressable area, DL/I creates one/more root anchor points (RAPs). A RAP is a four-byte field that contains an RBA. RAP points to the occurrences of root segments . Maximum number of RAPs that can be defined in a CI is 255. When a root segment is inserted in HDAM database the HDAM randomizing module thats being used calculates two values: The CI that should contain the segment The RAP within the CI that should point to it. Then if adequate space is available in the CI, DL/I adds the segment to the control interval and stores its RBA in the RAP. And if enough space isnt available in the CI for the root segment, Dl/I stores it in a nearby CI that has enough free space. Randomizing Module: This is a program that uses a technique similar to hashing function and generates the random address used to store the records. The following parameters have to be given as the input for randomizing module. RMname = (Name, Anchor pt, rbn, Bytes) Name: is the name of the module we are using for random generation. Anchor pt: specifies the number of RAPs required. rbn: specifies number of RBNs to be used for root addressable area. Bytes: number of bytes of a database record to be stored along with root segment occurence.

Root segments that randomize to the same RBN and RAP are called synonyms. They are chained through twin pointers.

IIMSHD/VER 0.2

For Internal Use Only

Page 45 of 84

TATA INFOTECH LTD.


17.3.1. Defining HDAM

Information Management System Hand Out

DBD

NAME=SAHDAM,ACCESS=(HDAM,VSAM), RMNAME=(DFSHDC10,,10) DATASET DD1=SAHDAM1,DEVICE=3380 SEGM NAME=COURSE,POINTER=TWINBWD FIELD . . . . SEGM NAME=PREREQ,PARENT=((COURSE,DBLE)), POINTER=TWINBWD POINTER=TWIN means PTF should be generated =TWINBWD means PTF and PTB should be generated =NOTWIN means no twin allowed i.e. neither PTF nor PTB generated. PARENT=(0 or segment name, SNGL or DBLE) 0 means the segment is root else if segment name given means that segment is the parent of the segment being defined. SNGL means PCF should be generated DBLE means PCF and PCL should be generated.
17.3.2. Stored Segment Occurrence

STC

DB

PTF

PTB

PCF

PCL

..........................

Segment Data

Fig.17.7.

IIMSHD/VER 0.2

For Internal Use Only

Page 46 of 84

TATA INFOTECH LTD. 17.4. HIDAM

Information Management System Hand Out

Provides indexed access to the root segment. Provides pointer access to the subordinate segments i.e. direct access. It consists of two databases namely Main database. Index database. Each of the databases is defined through their own DBDGEN. Root segments & subordinate segments are stored in the OSAM or ESDS dataset. The segments in the main database are chained through Child pointers (PCF, PCL). Twin pointers (PTF, PTB). Access to the root segment is via index database. Subordinate segments are accessed via twin/child pointers. Index database is used to index the database records stored in the main database Index contains only one segment (root only). Index segment prefix contains the pointers to database records. Index database can use either ISAM or VSAM. Index database is HISAM database & HISAM rules apply to it.

17.4.1.

Defining HIDAM

Main database DBD NAME=SAHDAM,ACCESS=(HIDAM,VSAM),RMNAME=(...) DATASET DD1=SAHIDAM,DEVICE=3380 SEGM NAME=COURSE,POINTER=TWINBWD LCHILD NAME=(IDXSEG,IDXDBD),POINTER=INDEX FIELD NAME=(CRSNO,SEQ),BYTES= . . . . SEGM NAME=PREREQ,PARENT=((COURSE,DBLE)), POINTER=TWINBWD

IIMSHD/VER 0.2

For Internal Use Only

Page 47 of 84

TATA INFOTECH LTD. Index Database

Information Management System Hand Out

DBD NAME=IDXDBD,ACCESS=(INDEX,VSAM), DATASET DD1=IDXDS,DEVICE=3380 SEGM NAME=IDXSEG, BYTES=.. LCHILD NAME=(COURSE,EDUDBD),INDEX=CRSNO FIELD NAME=(CRSNO,SEQ),BYTES= DBDGEN FINISH END.

18. Secondary Indexing


COURSE

CLASS

INSTRUCTOR

STUDENT

Fig.18.0. IMS being a hierarchical database supports only one to many relationships. Eg: In fig. 18.0. a query like all the students in a particular class can be obtained but a query like Find details of a CLASS given the STUDENT details cannot be answered. In order to facilitate the access of a parent through its child secondary indexing is used. DL/I maintains an alternate sequence by storing pointers to segments of indexed database in a separate index database.

18.1. Segments in secondary indexing

IIMSHD/VER 0.2

For Internal Use Only

Page 48 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out Pointer Segment: Is present in the indexed database. It contains the key field (indexed field) and points to the segment that is to be retrieved. Source Segment: Contains field or fields that the pointer segment uses as key field. Each time a new entry is made in source segment the corresponding entry is duplicated in index database. Should be at the same level or at lower level as target segment. In case if source and target segments are different, source segment should be dependent of target segment. Target Segment: Is the one which is retrieved .It is present in the main database. Pointer segment points to the target segment. Target segment can be at any of the 15 levels. If target segment is not specified then the source itself becomes the target segment.

Pointer segment contains two main elements: Prefix element: The prefix element of pointer segment contains a pointer to the target segment. Data element: The data element contains the key value on which index is built.

18.2. Secondary Data Structure When a secondary index is created the hierarchical tree structure changes. The rearranged tree structure is called as secondary data structure. Properties of secondary data structure The target segment becomes the root. Ancestors of target segment will become the dependents to the target segment, in the reverse order. Original dependants of target segment are moved to the right. Others segments are not included.

The data structure shown in fig.8.0. becomes: CLASS

IIMSHD/VER 0.2 COURSE

For Internal Use Only STUDENT

Page 49 of 84

TATA INFOTECH LTD.

Information Management System Hand Out Fig.18.1. Secondary Data Structure Note: In fig.18.1. a secondary index from to INSTRUCTOR cannot be created as STUDENT is not a dependent of INSTRUCTOR. 18.3. Pointers in secondary indexing Direct Pointer: Here the relative byte address (RBA) of target segment is stored in prefix of the pointer segment. This can be used only in HD databases and cannot be used in HISAM, as in HISAM the records are continuously moving, which results in constant changing RBA. Pointer segment for Direct Pointer: S T C D B P T F P T B RBA of target segment Segment data.

Fig. 18.2. Symbolic Pointer: Here the sequence key field of the source segment is duplicated in data portion i.e. the key field is physically stored. This is generally used in case of HISAM database.

Pointer segment for Symbolic Pointer: S T C D B P T F P T B Key field of the Target segment Fig.18.3. Segment data.

DBDGEN requirements for secondary indexing: (Refer fig.18.0.) Main DBD PRINT NOGEN DBD NAME=EDUDBD,ACCESS=HDAM DATASET DD1=COURSE,DEVICE=3380 SEGM NAME=COURSE,PARENT=0,BYTES=10 FIELD NAME=(CRSNO,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=CRSNAME,BYTES=4,START=7,TYPE=C SEGM NAME=CLASS,PARENT=COURSE,BYTES=10 FIELD NAME=(CLSNO,SEQ,U),BYTES=3,START=1,TYPE=C

IIMSHD/VER 0.2

For Internal Use Only

Page 50 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out LCHILD NAME=(IDXSEG,IDXDBD),POINTER=INDX XDFLD NAME=XSTUNO,SRCH=STUNO,SEGMENT=STUDENT FIELD NAME=CLSNAME,BYTES=4,START=7,TYPE=C SEGM NAME=STUDENT,PARENT=CLASS,BYTES=10 FIELD NAME=(STUNO,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=STUNAME,BYTES=4,START=7,TYPE=C SEGM NAME=INSTRT,PARENT=CLASS,BYTES=10 FIELD NAME=(INSNO,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=INSNAME,BYTES=4,START=7,TYPE=C DBDGEN FINISH END Index DBD PRINT NOGEN DBD NAME=INDEXDBD,ACCESS=INDEX DATASET DD1=IDX1,DEVICE=3380 SEGM NAME=IDXSEG,PARENT=0,BYTES=3 LCHILD NAME=(IDXSEG,IDXDBD),POINTER=INDX FIELD NAME=(STUNO,SEQ,U),BYTES=3,START=1,TYPE=C DBDGEN FINISH END PSBGEN requirements for secondary indexing: PCB for normal view PCB TYPE=DB,DBDNAME=EDUDBD,KEYLEN=9,PROCOPT=A SENSEG NAME=COURSE, PARENT=0 SENSEG NAME=CLASS, PARENT=COURSE SENSEG NAME=STUDENT, PARENT=CLASS SENSEG NAME=INSTRT, PARENT=CLASS PCB for secondary index view PCB TYPE=DB,DBDNAME=EDUDBD,KEYLEN=9,PROCOPT=A PROCSEQ=IDXDBD SENSEG NAME=CLASS, PARENT=0 SENSEG NAME=COURSE, PARENT=CLASS SENSEG NAME=STUDENT, PARENT=CLASS PSBGEN NAME=EDUPSB,LANG=COBOL END

IIMSHD/VER 0.2

For Internal Use Only

Page 51 of 84

TATA INFOTECH LTD.

Information Management System Hand Out Some of the terms related to secondary indexing: LCHILD: This macro relates a target segment to its associated secondary index database. Eg: In the Main DBD the macro LCHILD relates CLASS segment to the pointer segment IDXSEG in the secondary index database IDXDBD. LCHILD macro declared in the index segment of index DBD relates pointer segment to the target segment. XDFLD: This macro supplies a field name that is used to access the database via the secondary key. SRCH: This specifies the fields from the source segment that are used to build Indexed field. The maximum number of fields that can be given in SRCH is 5. In case when indexed field is not unique (i.e. there are duplicate values in indexed field) the search field may be made unique by adding another field in search criteria. Even if 5 fields together do not make the search unique then SUBSEQ (subsequent) fields can be added. Subsequent fields are not given during actual search. Search keys can be made unique using system defined fields. In HD databases, code the field name starting with /SX. The name of the field can go upto 8 characters including /SX. When this kind of field is coded IMS generates a unique 4 byte RBA of source segment and puts it in the subsequent field of the pointer segment. For the system field no start must be coded as /SX field does not occupy any storage. PROCSEQ: For secondary index PCB view PROCSEQ parameter is specified on the PCB macro. In absence of this parameter the processing is done in usual hierarchic sequence. The value of PROCSEQ is the DBD name of the secondary index database. This indicates the new processing sequence and the processing is done based on the secondary index view. If the same program needs to access more than one secondary indexed database, the multiple PCBs are coded with different PROCSEQ values.

Multiple Dataset Group


The hierarchical tree structure can be stored in more than one dataset group. There will be one primary dataset group and there can be multiple (maximum 9) secondary dataset groups. The root essentially being stored in the primary dataset group.

IIMSHD/VER 0.2

For Internal Use Only

Page 52 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out Used to increase the efficiency of search and retrieval of data. It can be used for HISAM and HD databases. In case of HISAM split can occur only at the second level i.e. at immediate child of root. In case of HD databases split can occur at any level below root provided the parent and child segments at split point are connected through child pointers and twin segments in child are connected through twin pointers .

What is a logical relationship?


A logical relationship is the link between two segments that are otherwise unrelated. These two segments may reside in separate physical databases. Logical relations are established for: Accessing a segment in another database: During data conflicts between segments, the segment causing conflict can be kept in a separate database and a logical relation ship can be established. COURSE CUSTOMER CLASS

INSTRUCTOR

STUDENT

Fig.20.0. Note: indicates logical relationship.

Eg: In fig.20.0. CUSTOMER segment cannot be put under any segment because this leads to many to many relationships. In order to avoid this conflict CUSTOMER is put in a separate database and a logical relationship between CUSTOMER and STUDENT is established. The basis for logical relation ship is called logical child segment. The logical child has two parents: one physical parent and one logical parent. In fig.20.0. STUDENT is the logical child, CLASS is the physical parent and CUSTOMER is the logical parent. Inverting parent child relationship: In an hierarchical tree, to provide access from child to parent without disturbing the existing parent child relationship this technique

IIMSHD/VER 0.2

For Internal Use Only

Page 53 of 84 CUSTOMER

TATA

Information Management System

INFOTECH LTD. Hand Out is used. In this case the parent must be the original segment and the logical child may be dummy segment. INSTRUCTOR (Parent)

COURSE

CLASS (Parent)

CLASS (Dummy)

INSTRUCTOR (Dummy)

STUDENT

Fig.20.1. Note: indicates logical relationship

In fig.20.0. if a report has to be generated instructor wise i.e. classes handled by the instructor it is not possible directly. Consider fig.20.1. using this the same report can be generated very easily.

Types of Logical Relationships Unidirectional logical relationship: The relationship is from logical child to logical parent. Logical parents data can be accessed from logical child but vice versa is not allowed. One logical child can have one logical parent and one physical parent, for all the occurrences of that child segment type. Logical relation is established using logical parent pointer (LP).

Logical parent pointer is of two types:

IIMSHD/VER 0.2

For Internal Use Only

Page 54 of 84

TATA INFOTECH LTD.

Information Management System Hand Out 1) Symbolic Pointer: In this the logical parent concatenated key (LPCK) is physically stored as the first field of logical child. This pointer is used when the parent resides in HISAM database. S T C D B P T F P T B Logical Parent Pointer Segment data. (LP) LPCK of the logical parent Fig 20.2. 2) Direct Pointer: In this, the relative byte address of logical parent is stored in logical child in its pointer area. This is used when parent resides in HD databases.

S T C

D B

P T F

P T B

Logical Parent Pointer Segment data. (LP) RBA of the logical parent Fig 20.3.

DBDGEN requirements for unidirectional logical relationship in HDAM database: (Refer fig.20.0.) DBD for customer data base PRINT NOGEN DBD NAME=CUSTDBD,ACCESS=(HDAM,VSAM), RMNAME=(..) DATASET DD1=CUST,DEVICE=3380 SEGM NAME=CUSTOMER, BYTES=11, PARENT=0,POINTER=TWINBWD FIELD NAME=(CUSTNO,SEQ,M),BYTES=3,START=1,TYPE=C LCHILD NAME=(STUDENT,EDUDBD) FIELD NAME=CUSTNAME,BYTES=7,START=4,TYPE=C DBDGEN

IIMSHD/VER 0.2

For Internal Use Only

Page 55 of 84

TATA INFOTECH LTD. FINISH END

Information Management System Hand Out

DBD for COURSE database PRINT NOGEN DBD NAME=EDUDBD,ACCESS=(HDAM,VSAM), RMNAME= (. ) DATASET DD1=COURSE,DEVICE=3380 SEGM NAME=COURSE,PARENT=0,BYTES=10 FIELD NAME=(CRSNO,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=CRSNAME,BYTES=7,START=4,TYPE=C SEGM NAME=CLASS,PARENT=COURSE,BYTES=10 FIELD NAME=(CLSNO,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=CLSNAME,BYTES=7,START=4,TYPE=C SEGM NAME=STUDENT, BYTES=11, PARENT=((CLASS),(CUSTOMER,P,CUSTDBD)), POINTER=(LPARNT,TWINBWD),RULE=(LLL,LAST) FIELD NAME=(CUSTNO,SEQ,M),BYTES=6,START=1,TYPE=C FIELD NAME=STUNO,BYTES=3,START=4,TYPE=C FIELD NAME=STUNAME,BYTES=4,START=7,TYPE=C SEGM NAME=INSTRT,PARENT=CLASS,BYTES=10 FIELD NAME=(INSNO,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=INSNAME,BYTES=7,START=4,TYPE=C DBDGEN FINISH END

DBD indicating logical relation PRINT NOGEN DBD NAME=LOGDBD,ACCESS=LOGICAL DATASET LOGICAL SEGM NAME=COURSE,PARENT=0,SOURCE=(COURSE,D,EDUDBD) SEGM NAME=CLASS,PARENT=COURSE,SOURCE=(CLASS,D,EDUDBD) SEGM NAME=STUCUST,PARENT=CLASS, SOURCE=((STUDENT,D,EDUDBD),(CUSTOMER,D,CUSTDBD)) SEGM NAME=INSTRT,PARENT=CLASS, SOURCE=(INSTRT,D,EDUDBD) DBDGEN FINISH END

IIMSHD/VER 0.2

For Internal Use Only

Page 56 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Note: In case of HIDAM the DBDs will remain same but only addition is a LCHILD statement after the segment definition and the sequence field definition indicating the index and in index data base the corresponding LCHILD must be specified.

PSBGEN requirements for logical relationship (Refer fig.20.0.) Normal View PRINT NOGEN PCB TYPE=DB,DBDNAME=EDUDBD,KEYLEN=9,PROCOPT=A SENSEG NAME=COURSE,PARENT=0 SENSEG NAME=CLASS,PARENT=COURSE SENSEG NAME=STUDENT,PARENT=CLASS SENSEG NAME=INSTRT,PARENT=CLASS PCB TYPE=DB,DBDNAME=CUSTDBD,KEYLEN=3,PROCOPT=A SENSEG NAME=CUSTOMER,PARENT=0 Logical View PCB TYPE=DB,DBDNAME=LOGDBD,KEYLEN=9,PROCOPT=A SENSEG NAME=COURSE,PARENT=0 SENSEG NAME=CLASS,PARENT=COURSE SENSEG NAME=STUCUST,PARENT=CLASS SENSEG NAME=INSTRT,PARENT=CLASS PSBGEN PSBNAME=LOGPSB,LANG=COBOL END

Definitions PARENT Operand specified for the logical child segment. Specifies whether direct pointer is used or symbolic pointer is used. Format: PARENT ((physical parent name), (logical parent name, P/V, dbd name of logical parent)). PPhysical; V Virtual If the parameter is P in the declaration along with the logical parent name it means that the logical parent concatenated key is stored as first field in the logical IIMSHD/VER 0.2 For Internal Use Only Page 57 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out child i.e. symbolic pointer is used. If V is specified then logical parents key is used to generate the relative byte address of the logical parent and the key of logical parent is not stored i.e. direct pointer is used.

Layout of Concatenated Segment: Logical Child LPCK Intersection data Logical Parent LPK Fig.20.4. SOURCE Is used to represent a concatenated segment. Format: SOURCE=(segment name, D/K, dbd name) for normal segments. SOURCE=((logical child segment name, D/K, dbd name), (logical parent segment name, D/K, dbd name) For the concatenated segment. K Key value. D Data value. This value K or D is specified in order to control the data that is coming into the I-O area. If K is specified only key value of that segment is moved into I-O area and if D is specified the entire data is moved into I-O area. Logical Parent data

DATASET LOGICAL indicates that the database exists virtually and is not physically stored. Logical Twins: are the occurrences of a logical child segment type that are all subordinates to a single occurrence of the logical parent segment type. Note: In case of uni-directional logical relationship access from logical parent to logical child is not allowed. In order to facilitate access in either direction bidirectional logical relationship should be used. Bi-directional physically paired logical relationship: The relation ship is two ways: from logical child to logical parent and vice versa.

IIMSHD/VER 0.2

For Internal Use Only

Page 58 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out In this case the logical child is duplicated in both the databases. When logical child is accessed from its physical parent the path is said to be a physical path.

AREA

BIRD

SIGHTA

SIGHTB

Physically paired Fig.20.5. DBDGEN requirements for Bi-directional logical relationship (Refer fig.20.5.) DBD for AREA database PRINT NOGEN DBD NAME=AREADBD,ACCESS=(HDAM,VSAM), RMNAME= (.) DATASET DD1=AREA1,OVFLW=AREA2,DEVICE=3380 SEGM NAME=AREA, BYTES=10,POINTER=TWINBWD FIELD NAME=(AREANO,SEQ,U),BYTES=3,START=1,TYPE=C LCHILD NAME=(SIGHTB,BIRDDBD),PAIRED=SIGHTA FIELD NAME=AREANAME,BYTES=7,START=4,TYPE=C SEGM NAME=SIGHTA,PARENT=((AREA),(BIRD,P,BIRDDBD)), BYTES=35,POINTER=(TWINBWD,LPARNT,PAIRED) FIELD NAME=(BIRDNO,SEQ,M),BYTES=3,START=1,TYPE=C FIELD NAME=DATE,BYTES=8,START=4,TYPE=C FIELD NAME=REMARKS,BYTES=22,START=13,TYPE=C DBDGEN FINISH END

DBD for BIRD database

IIMSHD/VER 0.2

For Internal Use Only

Page 59 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out PRINT NOGEN DBD NAME=BIRDDBD,ACCESS=(HDAM,VSAM), RMNAME= (. ) DATASET DD1=BIRD1,OVFLW=BIRD2,DEVICE=3380 SEGM NAME=BIRD,PARENT=(0,DBLE), BYTES=10,POINTER=TWINBWD FIELD NAME=( BIRDNO,SEQ,U),BYTES=3,START=1,TYPE=C LCHILD NAME=(SIGHTA,AREADBD),PAIRED=SIGHTB FIELD NAME= BIRDNAME,BYTES=7,START=4,TYPE=C SEGM NAME=SIGHTB,PARENT=(( BIRD),(AREA,P,AREADBD)), BYTES=35,POINTER=(TWINBWD,LPARNT,PAIRED) FIELD NAME=(AREANO,SEQ,M),BYTES=3,START=1,TYPE=C FIELD NAME=DATE,BYTES=8,START=4,TYPE=C FIELD NAME=REMARKS,BYTES=22,START=13,TYPE=C DBDGEN FINISH END

DBD indicating logical relation of SIGHTA with BIRD PRINT NOGEN DBD NAME=LOGDBD1,ACCESS=LOGICAL DATASET LOGICAL SEGM NAME=AREA,PARENT=0,SOURCE=(AREA,D,AREADBD) SEGM NAME=SIBIRD,PARENT=AREA, SOURCE=((SIGHTA,D,AREADBD),(BIRD,D,BIRDDBD)) DBDGEN FINISH END DBD indicating logical relation of SIGHTB with AREA PRINT NOGEN DBD NAME=LOGDBD2,ACCESS=LOGICAL DATASET LOGICAL SEGM NAME=BIRD,PARENT=0,SOURCE=(BIRD,D,BIRDDBD) SEGM NAME=SIAREA,PARENT=BIRD, SOURCE=((SIGHTB,D,BIRDDBD),(AREA,D,AREADBD)) DBDGEN FINISH END

Logical View1

AREA IIMSHD/VER 0.2 SIBIRD Internal Use Only For SIGHTA BIRD Page 60 of 84

TATA INFOTECH LTD. Fig.20.6.

Information Management System Hand Out

Note: SIBIRD is the concatenated segment of SIGHTA and BIRD segments.

Logical View2 BIRD SIAREA SIGHTB AREA

Fig.20.7. Note: SIAREA is the concatenated segment of SIGHTB and AREA Segments.

PSBGEN requirements for logical relationship Logical View1 (Refer fig .20.6.) PCB TYPE=DB,DBDNAME=LOGDBD1,KEYLEN=12,PROCOPT=A SENSEG NAME=AREA,PARENT=0 SENSEG NAME=SIBIRD,PARENT=AREA

Logical View2 (Refer fig.20.7.) PCB SENSEG SENSEG PSBGEN END TYPE=DB,DBDNAME=LOGDBD2,KEYLEN=12,PROCOPT=A NAME=BIRD,PARENT=0 NAME=SIAREA,PARENT=BIRD PSBNAME=LOGPSB,LANG=COBOL

IIMSHD/VER 0.2

For Internal Use Only

Page 61 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Bi-directional virtually paired logical relationship: The relation ship is same as bi-directional physically paired bi-directional logical relation ship but in this case the logical child is not duplicated but accessed from the original database. When logical child is accessed from its physical parent the path is said to be physical path. When logical child is accessed from its logical parent the path is said to be logical path. AREA BIRD

SIGHTA (Original)

SIGHTB (Dummy)

Virtually paired Fig.20.8.

DBDGEN requirements for Bi-directional logical relationship: DBD for AREA database PRINT NOGEN DBD NAME=AREADBD,ACCESS=(HDAM,VSAM), RMNAME= (.) DATASET DD1=AREA1,OVFLW=AREA2,DEVICE=3380 SEGM NAME=AREA,PARENT=(0,DBLE), BYTES=10,POINTER=TWINBWD FIELD NAME=(AREANO,SEQ,U),BYTES=3,START=1,TYPE=C FIELD NAME=AREANAME,BYTES=7,START=4,TYPE=C SEGM NAME=SIGHTA,PARENT=((AREA),(BIRD,P,BIRDDBD)), BYTES=35,POINTER=(LTWINBWD,LPARNT,PAIRED) FIELD NAME=(BIRDNO,SEQ,M),BYTES=3,START=1,TYPE=C FIELD NAME=DATE,BYTES=8,START=4,TYPE=C FIELD NAME=REMARKS,BYTES=22,START=13,TYPE=C DBDGEN FINISH IIMSHD/VER 0.2 For Internal Use Only Page 62 of 84

TATA INFOTECH LTD. END DBD for BIRD database

Information Management System Hand Out

PRINT NOGEN DBD NAME=BIRDDBD,ACCESS=(HDAM,VSAM), RMNAME= (. ) DATASET DD1=BIRD1,OVFLW=BIRD2,DEVICE=3380 SEGM NAME=BIRD,PARENT=(0,DBLE), BYTES=10,POINTER=TWINBWD FIELD NAME=( BIRDNO,SEQ,U),BYTES=3,START=1,TYPE=C LCHILD NAME=(SIGHTA,AREADBD),PAIRED=SIGHTB,PTR=DBLE FIELD NAME= BIRDNAME,BYTES=7,START=4,TYPE=C SEGM NAME=SIGHTB,PARENT= BIRD,BYTES=35,POINTER=PAIRED, SOURCE=(SIGHTA,V,AREADBD) FIELD NAME=(AREANO,SEQ,M),BYTES=3,START=1,TYPE=C FIELD NAME=DATE,BYTES=8,START=4,TYPE=C FIELD NAME=REMARKS,BYTES=22,START=13,TYPE=C DBDGEN FINISH END

DBD indicating Logical Relationship between SIGHTA and BIRD PRINT NOGEN DBD NAME=LOGDBD1,ACCESS=LOGICAL DATASET LOGICAL SEGM NAME=AREA,PARENT=0,SOURCE=(AREA,D,AREADBD) SEGM NAME=SIAREA,PARENT=AREA, SOURCE=((SIGHTA,D,AREADBD),(BIRD,D,BIRDDBD)) DBDGEN FINISH END DBD indicating Logical Relationship between SIGHTB and AREA PRINT NOGEN DBD NAME=LOGDBD2,ACCESS=LOGICAL DATASET LOGICAL SEGM NAME=BIRD,PARENT=0,SOURCE=(BIRD,D,BIRDDBD) SEGM NAME=SIBIRD,PARENT=BIRD,

IIMSHD/VER 0.2

For Internal Use Only

Page 63 of 84

TATA INFOTECH LTD. DBDGEN FINISH END

Information Management System Hand Out SOURCE=((SIGHTB,D,BIRDDBD),(AREA,D,AREADBD))

PSBGEN requirements for logical relationship. Logical View1 (Refer fig.20.6.) PCB TYPE=DB,DBDNAME=LOGDBD1,KEYLEN=12,PROCOPT=A SENSEG NAME=AREA,PARENT=0 SENSEG NAME=SIBIRD,PARENT=AREA

Logical View2 (Refer fig.20.7.) PCB TYPE=DB,DBDNAME=LOGDBD2,KEYLEN=12,PROCOPT=A SENSEG NAME=BIRD,PARENT=0 SENSEG NAME=SIAREA,PARENT=BIRD PSBGEN PSBNAME=LOGPSB,LANG=COBOL END

Some of the pointers related to bi-directional logical relationships Logical Child First (LCF) Pointer This pointer is a part of the prefix of logical parent segment and its value contains the RBA of the first logical child occurrence of the related child segment subordinate to the logical parent segment. Logical Child Last (LCL) Pointer This points to the last occurrence of the specified segment type subordinate to a given logical parent segment occurrence. This pointer is optional. Logical Twin Forward (LTF) Pointer This pointer chains to the next logical twin segment occurrence. Logical Twin Backward (LTB) Pointer This pointer chains to the previous logical twin segment occurrence. This pointer is optional. Physical Parent (PP) Pointer Used to allow the physical parent of a logical child to be retrieved when the access is via the logical parent.

IIMSHD/VER 0.2

For Internal Use Only

Page 64 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Logical Parent (LP) Pointer Used to allow access to logical parent through the logical child.

Rules in Logical relations Rules of logical child : A logical child can have one physical parent and one logical parent. Logical child cannot be defined at root level. A logical child cannot have a physical child defined at next level which is again a logical child. Rules of logical parent: Logical parent can be defined at any level including the root Logical parent can have any number of logical children. A segment cannot be defined both as logical parent and logical child Rules of physical parent: Physical parent of a logicl child cannot be a logical child.

DATA COMMUNICATION AND MESSAGE FORMAT SERVICE


The data communication in IMS is similar to a batch program that is extended by a network and connected to a terminal. This helps in online processing.

IM Terminal OM Fig.21.0. IMS DC Program

Process DL/I database

IIMSHD/VER 0.2

For Internal Use Only

Page 65 of 84

TATA INFOTECH LTD. Note: IM Input Message (Transaction). OM Output Message.

Information Management System Hand Out

Fig.21.0. shows the elements of a typical DC program. It has An input message that is entered by a terminal user. DC program does the processing depending upon the input message and generates an output message. The output message is sent to the terminal that originated the input message. The program loops through this cycle once for each input message. Th program ends or expires when there are no more input messages.

What is a logical terminal? In order to obtain device independence, physical terminal is give different names referred to as logical terminal names (LTERM), and the user uses the logical terminal names. Physical terminal can have more than one LTERM name. Because IMS uses LTERM names for message processing it is possible for the IMS operator to reassign logical terminals to different physical devices if some terminals are out of service.

Message Processing in IMS There are two types of messages in IMS Input Messages Output Messages Input Message Types: 1. Transaction (Program switch). 2. Terminal to terminal message switch 3. IMS commands (command switch) IMS uses first eight bytes of the input message to identify the messages type: If the first eight characters name an application program IMS knows that the message is a transaction. The first eight bytes in a transaction are called as the transaction code. The application program corresponding to this trans-id is executed.

IIMSHD/VER 0.2

For Internal Use Only

Page 66 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out If the first eight characters name an terminal (LTERM name) IMS knows that the message is a terminal to terminal message switch. The message followed by the terminal id is sent to the specified logical terminal. If the first character is / IMS knows that it is a IMS command .IMS does the action according to the specified command following the /. Input message processing: A queue is maintained in IMS .All the transaction ids are kept in queue. Staged processing is done by IMS. 1. The terminal users enter the input messages. 2. IMS receives all the messages and puts them in input message queue. 3. The first 8 bytes are matched with the transaction ids defined in transaction reference table (TRT). If a matching trans-id exists then corresponding to that trans-id the application program is loaded. 4. If no matching trans-id is found, it is mapped to the LTERM table. If the 8 bytes correspond to a defined LTERM name then message switch is performed else checks for a command switch. 5. If it is none of the three message types then the message is discarded from the queue.

Output messages Processing: In case of a program switch: 1. The corresponding application program is executed and the results of all the calls made on database are put in the output message queue. 2. From the output message queue the data is sent to the terminal that originated the input message. 3. The program expires as the processing is over and output is put into output message queue.

Processing a job in IMS DB/DC Environment


IMS control Region

MPP Region

V T A M IIMSHD/VER 0.2

DC

DL/I

Common Services Scheduling Others Page 67 of 84 BMP Region.

For Internal Use Only MFS

TATA INFOTECH LTD. Master Terminal

Information Management System Hand Out

Fig.21.1. User Terminal

Format lib

Load Lib

MQ

Log File

DL/I databa se

After the edited input message, beginning with the transaction code, has been queued in the input message queue, IMS starts scheduling. IMS reads the first 8 bytes and matches them with the trans-ids defined in the TRT. If there is no matching entry then the message is deleted from the queue. If there is an entry of the referenced trans-id in TRT, the corresponding program is moved into the dependant region i.e. the program is loaded from the load library as in fig.21.1. and the control is passed onto the application program. The application program initiates the session by issuing a Receive (GU) call against the terminal. The data from the user is accepted into IO area called Input Message Area (IMA) defined in working storage section. In order to retrieve the data depending upon the query placed by user, the query and control are passed to DL/I. DL/I process the query and retrieves the data from data base, and puts it in the output message area (OMA) defined in the working storage section and the control is passed to application program. The program issues a send command (ISRT) to send the output to the requesting terminal. The output is put into the output message queue. At the end of application program when a GOBACK is encountered the application program expires. IMS picks the data from the output queue and sends it to the terminal that originated the input message.

IIMSHD/VER 0.2

For Internal Use Only

Page 68 of 84

TATA INFOTECH LTD. DL/I function in a DC Call:

Information Management System Hand Out

The DL/I calls that are generally used in DC are: GU issued to retrieve the first segment of an input message. GN issued to retrieve subsequent segments if an input message contains multiple segments. ISRT issued to insert a segment in the output message. Format of GU call in DC CALL CBLTDLI USING DLI-GU IO-PCB-MASK INPUT-MESG-AREA. Format of GN call in DC CALL CBLTDLI USING DLI-GN IO-PCB-MASK INPUT-MESG-AREA. Format of ISRT call in DC CALL CBLTDLI USING DLI-ISRT IO-PCB-MASK OUTPUT-MESG-AREA.

Note: INPUT-MESG-AREA is the input message area. OUTPUT-MESG-AREA is the output message area. These are discussed in detailed in the later part of this session. PCB MASK in a DC call: Format of IO-PCB-MASK: 01 IO-PCB-MASK. 05 IO-PCB-LTERM 05 FILLER 05 IO-PCB-STATUS-CODE 05 IO-PCB-DATE 05 IO-PCB-TIME 05 IO-PCB-MSG-SEQ-NUM 05 IO-PCB-MOD-NAME 05 IO-PCB-USER-ID

PIC X(8). PIC XX. PIC XX. PIC S9(7) COMP-3. PIC S9(6)V9 COMP-3. PIC S9(5) COMP. PIC X(8). PIC X(8).

IIMSHD/VER 0.2

For Internal Use Only

Page 69 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out IO-PCB-LTERM: Contains the eight-byte LTERM name of the terminal that sent the current input message. This is maintained, when an ISRT is issued IMS routes the output message depending upon the LTERM name. FILLER: Used by IMS. IO-PCB-STATUS-CODE: Contains the status code returned after the DC call is processed. IO-PCB-DATE: Contains the date of arrival of the message. It is of the format YYDDD. IO-PCB-TIME: Contains the time of arrival of the message. It is of the format HHMMSS. IOPCB-DATE and IO-PCB-TIME together provide time stamp for identification of input message. IO-PCB-MSG-SEQ-NUM: This is a four byte field, contains a serial number assigned to input message by IMS. The number is stored as binary value.

IO-PCB-MOD-NAME: Contains the name of Message Format Service message definition (called as Message Output Descriptor MOD) currently in use. (MOD is discussed in the later session.) IO-PCB-USER-ID: Contains security information. Its contents depend on : Whether or not RACF security manager is installed. If installed ,depends on the kind of security checking in effect. Note: RACF means resource access control facility.

Input Message Area

Format of input message area LL 2 bytes

IIMSHD/VER 0.2

For Internal Use Only

Page 70 of 84

TATA INFOTECH LTD. ZZ 2 Bytes TRANS-ID 8 Bytes

Information Management System Hand Out Other Variables

Fig.21.2. Fig.21.2. indicates the format of input message area. This is declared in WORKING-STORAGE SECTION of the COBOL program. The input message area starts with LL field followed by ZZ field. Each filed occupies 2 bytes. The LL field contains, in a binary format, the length of input message segment including LL and ZZ fields. This is automatically populated by IMS. The ZZ field is for IMS internal usage purpose. Followed by ZZ is the 8-byte transaction id. After the transaction is the actual data fields are declared.

Structure of Input Message Area: 01 INPUT-MESG-AREA. 05 LL PIC S9(3) 05 ZZ PIC S9(3) 05 TRANS-ID PIC X(8). 05 .... 05 . 05 .......

COMP. COMP.

Output Message Area Format of output message area LL ZZ 2 bytes 2 Bytes IIMSHD/VER 0.2 Other Variables

For Internal Use Only

Page 71 of 84

TATA INFOTECH LTD. Fig.21.3.

Information Management System Hand Out

Fig.21.3. Indicates the format of output message area. This is declared in WORKING-STORAGE SECTION of the COBOL program. The output message area starts with LL field followed by ZZ field. Each field occupies 2 bytes. The LL field contains, in a binary format, the length of output message segment including LL and ZZ fields. The user must specify the value of LL field and ZZ must be initialized to zeros. After the ZZ field actual data fields are declared. Whenever data has to be sent to terminal it must be placed in output message area. Structure of Output Message Area 01 OUTPUT-MESG-AREA. 05 LL PIC S9(3) 05 ZZ PIC S9(3) 05 ... 05 ... 05 .......

COMP VALUE xx. COMP VALUE ZEROS.

Note: Value of xx must be the total length of all the data fields plus 4 bytes (for LL and ZZ fields).

Message Format Service and its control Blocks Message format service (MFS) is an IMS facility that is used to format the screens in DC environment. Device Input Format (DIF) Terminal Device Output Format (DOF) For Internal Use Only Message Output Descriptor (MOD) Page 72 of 84 Message Input Descriptor (MID)

Application Program

IIMSHD/VER 0.2

TATA INFOTECH LTD.

Information Management System Hand Out

Fig.21.4. Fig.21.4. indicates the various control blocks used by MFS. For an input message MFS uses DIF (device input format) to interpret the data as it is received from the terminal. MFS uses MID (message input descriptor) to determine how the input must be formatted. MFS uses MOD (message output descriptor) to interpret the data received from the application program. MFS uses DOF (device output format) to determine how the data must be formatted for transmission to the terminal. A group of related MIDs, MODs, DIFs and DOFs is called a format set.

Coding of MFS statements 1-8 Label 10-14 Operation 16-71 Operand/Comment 72 Continuation Character

Fig.21.5.

Fig.21.5 shows the format of an device format control statement. Columns 1 through 8 make the label field. The first character must be alphabet. The second field begins at column 10. It is the operation field.. It contains the control statements like FMT, DFLD etc. The third field starts from 16th column and is known as operand field. This field extends from 16th column to 71st column. If the entire statement does not fit in one line then X is put in 72nd column and the statement is continued in next line. A * in column 1 indicates that it is a comment. IIMSHD/VER 0.2 For Internal Use Only Page 73 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Coding of device format statements 1 TO 6 7 TO 9 10 TO 15 16 TO 71

label1

FMT DEV DIV DPAGE DFLD FMTEND

The FMT and FMTEND control statements: Format: 1 6 10 16 label FMT FMTEND

Label Is a one to six character name. It is a part of DIF and DOF created as a result of device format specification. FMT identifies the beginning of a device format. FMTEND identifies the end of a device format.

The DEV control statement: Identifies the beginning of a series of control statements for a particular device type. Multiple DEV statements can be coded within a device format. Format: 10 DEV 16 TYPE= (3270,1) (3270,2) (3270-An)

,FEAT=IGNORE [,PFK=(pfkeyfield , [integer= IIMSHD/VER 0.2 For Internal Use Only literal NEXTPP ])] NEXTMSGP Page NEXTLP 74 of 84 ENDMPPI

TATA INFOTECH LTD.

Information Management System Hand Out

[,SYSMSG=msgfield] TYPE parameter: specifies the device models for which device format blocks should be created. [,DSCA=Xnnnn] The values are: 3270,1 indicates 3270 model 1 display station (12-line screen) 3270,2 indicates 3270 model 2 display station (24-line screen)

3270-An 3270 display station symbolic name. Typical values for installation may be: 3270-A1 12 line, 80 column 3270-A2 24 line, 80 column 3270-A3 32 line, 80 column 3270-A4 43 line, 80 column 3270-A5 12 line, 40 column 3270-A7 27 line, 132 column FEAT parameter: The value IGNORE specifies that DIF and DOF generated for this DEV statement will work with the indicated 3270 terminal type, regardless of any special features. PFK parameter : pfkey field Specifies a name that can be referred to by the MFLD statement that defines the input message that will receive literal data as a result of a PF key operation. integer An integer value from 1 to 36 that identifies the PF key that will be associated with the value that follows. If integer key word is not used to identify PF key assignments, the assignments are positional. literal Specifies the text string user wants to associate with the PF key. NEXTPP This causes MFS to display the next physical page of a message. NEXTMSGP Requests the next message bypassing remaining pages of current message. NEXTLP Requests the next logical page of an output message.

IIMSHD/VER 0.2

For Internal Use Only

Page 75 of 84

TATA INFOTECH LTD.

Information Management System Hand Out ENDMPPI Indicates MFS that no more physical pages are left to be entered for a mutlipage input message.

The DSCA parameter: Xnnnn is a hexa decimal value of two-byte default system control area for the terminal. The value of the field determines the terminal actions when output messages are received. Value X00A0 causes unprotected fields on the screen to be erased before new data is written to it. Value X00C0 causes the entire device buffer to be cleared before an output is written to the screen. The SYSMSG parameter : msgfield Specifies the name of device field that can be used to display messages for IMS.. This field must be atleast 79 bytes long. It is usually defined at the bottom of the screen.

The DIV control statement: Identifies the beginning of a set of control statements for a particular formats type subordinate to DEV statement. Format: 10 DIV 16 TYPE=INOUT

TYPE parameter: Value as INOUT specifies that the same device format should be used to generate both DIF and DOF. If the Value is INPUT the device format should be used to generate DIF. If the Value is OUTPUT the device format should be used to generate DOF. The DPAGE control statement: Identifies the beginning of a series of control statements for a device page subordinate to a DIV statement Format: 1 to 8 label

10 to 15 DPAGE

16 [CURSOR=((linenum, columnnum[,cfield]).....)] [, FILL=fillchar] [, MULT=YES]

label The name of the logical device page.

IIMSHD/VER 0.2

For Internal Use Only

Page 76 of 84

TATA

Information Management System

INFOTECH LTD. Hand Out CURSOR : Specifies where the cursor should be placed when screen is sent on to the terminal 1. Linenum specifies the line number of the default cursor position. 2. Columnum specifies the column number of default cursor position. 3. Cfield The name of a pseudo field referred to in an MFLD statement that will be used to pass the cursor control information in between MFS and the application program. FILL : fillchar : The fill parameter to be used for output device fields. Values that can be specified are: PT Specifies the program tab. Output fields that dont fill the device field are followed by a program tab character to erase the remainder of device field. Cc specifies a character to be used as fill character. Xhh specifies an hexa decimal value to be used as a fill character. MULT parameter: Value YES indicates that multiple physical pages within the device page can be used to generate an input message. DFLD control statement: Identifies a device field within a device page. Format: 1 to 8 label 10 to 15 DFLD 16 to 71 [literal] ,POS=(line,column[,page]) [,LTH=length] [,ATTR=( ALPHA NUM NOPROT , PROT 72

NORM , NO DISP HI ,

NOMOD MOD

)] CD BLUE RED PINK GREEN TURQ YELLOW NEUTRAL

[,EATTR=(

HD HBLINK HREV HUL

)]

,.

IIMSHD/VER 0.2

For Internal Use Only

Page 77 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Label: The one to eight character name of the device field .If literal is coded then label must not be specified. Literal Parameter: Specifies the constant value for the device field. If literal has to define, it must be the first parameter on DFLD statement. Eg. It can be used to create caption on screen.

POS parameter : The POS parameter tells MFS where a device field is located Line Specifies the line that contains the first charcter of the device field. Column Specifies the column that contains the first character of the device field (not its preceding attribute byte). Page specifies the physical page where the field is located.

LTH parameter : Length Specifies the length in bytes of the device field.If literal is coded then LTH parameter need not be coded. ATTR parameter: The ATTR parameter of the DFLD statement allows to set default values for basic attributes of the device field. If the attributes are not specified then by default IMS takes the attributes as : 1. ALPHA (alpha numeric), NOPROT (unprotected), NORM (display in normal intensity) and NOMOD (do not allow the changes to the device field) for data entry fields. 2. NUM(numeric), PROT(protected), NORM(display with normal intensity) EATTR parameter: The EATTR parameter on the DFLD statement allows to set some extended attributes to the device field.. Values are: HD Defualt highlight. HBLINK Make field blink. HREV Display the field in reverse video. HUL Underline the field. CD use default colour NEUTRAL device dependant usually White. IIMSHD/VER 0.2 For Internal Use Only Page 78 of 84

TATA INFOTECH LTD. Coding Message Descriptor Control Statements Format 1 to 8 10 to 71 MSG MFLD MFLD MSGEND

Information Management System Hand Out

The MSG and MSGEND statement: MSG identifies the beginning of the message descriptor. MSGEND identifies the end of message descriptor.

Format: Msgname

TYPE={INPUT / OUTPUT} ,SOR=(dfname,IGNORE) [,NXT=next msgname] [,PAGE=YES] MSGEND

MSG

TYPE parameter on MSG statement: To specify whether to generate a MID (message input descriptor) or MOD (message output descriptor). INPUT Specifies that the statements following the message control statement is used to generate MID. OUTPUT Specifies that the statements following the message control statement is used to generate MOD. SOR parameter on MSG statement: Is required to be specified on each MSG statement. Contains the name of the device format. dfname The device format to which this message descriptor is related. IGNORE Indicates that the device format coded with FEAT =IGNORE must be used. NXT parameter on MSG statement: Specifies the message descriptor MFS should use after the one defined by the statement associated with this MSG is executed. Next msgname If the TYPE=INPUT, the name of next MOD to be used and if the TYPE =OUTPUT the name of next MID to be used. PAGE parameter on MSG statement: Is coded on the MSG statement that defines an output message descriptor when logical paging has to be used. PAGE=YES is valid only if TYPE=OUTPUT. Specifies that logical paging should be supported for this output message. IIMSHD/VER 0.2 For Internal Use Only Page 79 of 84

TATA INFOTECH LTD.

Information Management System Hand Out PAGE=NO is the default. It indicates that logical paging is not supported for this output message.

MFLD control statement: The statements that define messages are coded against MFLD statements. There is one to one relationship between fields in the message segment descriptor and the fields in the application programs IO area.

Format MFLD {source / destination} [, LTH=length] [, JUST={L / R}] [, FILL = fill char] [, ATTR=(YES)]

Source: This is specified for input messages only. This parameter specifies the source of the data IMS will map into this field. This parameter can be coded in three ways namely: Literal A literal value thats to be a part of every input sent to the application program. This bears no relation to a device field. Devfield Thelabel of the device field from which the data to this message field will be mapped. (devfield , literal) The first sub parameter devfield is the label of the device field from which data for this message field is mapped.If device field is left empty The value specified for literal will be used . Destination: This is specified for output messages only. This parameter specifies the destination of data MFS will map from this field. This parameter can be coded in two ways: devfield The label of the device field into which data from this message field is mapped. (Devfield, syslist) The first sub parameter, devfield, is the label of the device field into which data from this message field is mapped. The data is specified by system list (syslist) which is one of the system literal. If this option is used, space must not be given for this field. System list: IIMSHD/VER 0.2 For Internal Use Only Page 80 of 84

TATA INFOTECH LTD. Name DATE1 DATE2 DATE3 DATE4 TIME LTNAME Length 6 8 8 8 8 8

Information Management System Hand Out Description System date in the format YY.DDD System date in the format MM/DD/YY System date in the format DD/MM/YY System date in the format YY/MM/DD System time in the format HH:MM:SS Logical name of the terminal device that will receive the current output message

LTH parameter: length specifies the length in bytes of the field. This parameter is not coded if system literal is defined on an MFLD field. JUST parameter: This is used to provide justification to the data. R is used if right justification is needed and L is used if left justification is required. FILL parameter: Specifies the character to be padded when the data is shorter than specified length. It is valid only for the fields defined for an input message. The possible values of fill char are: X hh Any specified hex value C c Any specified character value NULL Do not use fill ATTR parameter: When the value is specified as YES, the dynamic modification of attributes by application program is allowed.

Dynamic Changing of Attributes and cursor position control To change the attributes dynamically On the MFLD statement of the field whose attributes are to be changed dynamically, code ATTR=YES. The control information is passed through the cobol program. A two-byte field prefixed along with data declaration in the output message area can be used to control the attributes dynamically. Eg. In the output message area if the attributes of course number are to be changed dynamically it will be declared as: 05 COURSE. 10 PREFIX. 20 CP PIC X. 20 ATTR PIC X. 10 CRSNO PIC X(5).

IIMSHD/VER 0.2

For Internal Use Only

Page 81 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Format of CP 0 1 2 0 3 0 4 0 5 0 6 0 7 0

Cursor Positioning 00 No cursor Position 01 Invalid 10 Invalid 11 Place Cursor at this field

2 to 7 are always zeros. Format of ATTR 0 1 1 2 3 4 5 6 7

MDT

Shift Attribute Override Protection

Intensity

Light Pen Detectable Attribute

IIMSHD/VER 0.2

For Internal Use Only

Page 82 of 84

TATA INFOTECH LTD.

Information Management System Hand Out

Bit 0 1

Function Attribute Over ride

Value 1 0

Description Always Use only the attributes whose corresponding over ride bit is 1 Replace all the attributes of the device field Unprotected Protected Alphanumeric Shift Numeric shift Normal Intensity No display Bright Intensity Bright Intensity Should always be zero for non light pen application MDT off MDT on

1 2 Protection attribute 0 1 0 1 00 01 10 11 6 Light Pen detectability attribute Modified data tag (MDT) 0

3 45

Shift attribute

Intensity attribute

0 1

IIMSHD/VER 0.2

For Internal Use Only

Page 83 of 84

Das könnte Ihnen auch gefallen