IMS DB Tutorial Learn Quickly

IMS OPERATING MODES

The three modes that IMS is run on:

  1. Batch DL/I: No Data communication services or terminals are used. Transactions are batch generated and saved in standard files. Application Program Run’s are initiated by using JCL. Processing output is in a hard copy format. Databases are accessed in the Off-line.
  2. BMP mode – A combination of Batch and Online Processing. There are two kinds of BMP ’s. Transaction oriented: Access the online message queues. Process Input from and output to OS/VS files and Databases. Batch Oriented: Access online databases in batch mode, can send messages to the message queue, are scheduled by the operator by using a JCL.
  3. Teleprocessing Program mode also called as Message Processing Program mode – Transactions are entered at the terminal, transactions are put in the message queue file, IMS scheduler immediately schedules the appropriate program to process the transaction. Processing output may be in the form of hard copy format or back as a screen message to the original or an alternate terminal. Databases are accessed online.

The Control Region

  • The Control (CTL) region is the address space in the MVS environment that holds the control program that runs continuously in the DB/DC environment.
  • It is responsible for a number of online functions. It holds the IMS control program, which services all communications DL/I calls. It is responsible for Fast Path databases that are accessed by an online program and for Fast Path I/O. It performs all IMS command processing.

The control region also:

  1. supervises processing for message queues
  2. supervises communication traffic for all connected terminals
  3. is responsible for restart and recovery information
  4. is responsible for the operation of the system log

IMS OPERATOR COMMANDS

/ALLOCATE - causes IMS to allocate a conversation to the specified
LUNAME and TPNAME if any output is queued in IMS for
that destination.
/DBRECOVERY - used to prevent transactions or programs
from accessing DL/I databases, DEDBs, or DEDB areas.
/START - makes IMS resources available for reference and use.
/STOP - stops the sending, receiving, or queuing of output messages
to a particular communication line, terminal, user, or logical path
- the scheduling or queuing of messages containing a specific
transaction code
- the execution of a specific program
- the use of a given database
/DISPLAY DATABASE - displays the status of specified databases.

IMS Execution JCL:

//IMS DD - the location of the PSBLIB and the DBDLIB libraries on the system.
//DFSRESLIB DD - Resident Library for IMS Load modules.
//DFSVSAMP DD - Buffer Pool Info for the DL/I Buffer pools
//IEFRDER DD - IMS writes a detailed record Log of the activity to the files defined in this DD.
//DATABASE DD - Unique DD name associated which each Database dataset, that are to be
allocated before any DLI call
//RECON DD - Datasets for recovery, needed by DBRC in batch run. Not needed for BMP or IRC.
//IMSRESLIB DD - the RESLIB containing the HDAM Randomizer and other IMS required programs.
//ACBLIB DD - ACBLIB library. The ACB are to be generated from the
PSB’s generated in the IRC mode.

DATA LANGUAGE/I (DL/I)

  • Command level language used in batch and online programs to access data stored in IMS databases. Application programs use DL/1 calls to request data and DL/1 then uses system access methods like VSAM to handle the physical transfer of data to and from the DB.
  • Connection to IMS is established by using the ENTRY ‘DLITCBL’ statement. IMS gives control to an application program through this entry point. The entry point must refer to the PCBs in the order in which they have been defined in the PSB.

LINKAGE SECTION. PCB MASK FOR THE DATA BASE DEFINED IN THE PSB

01 EMPLOYEE-DB-PCB-MASK. 
     05 PCB1-DBD-NAME PIC X(08).
     05 PCB1-SEG-LEVEL PIC X(02).
     05 PCB1-STATUS-CODE PIC X(02).
     05 PCB1-PROC-OPT PIC X(04).
     05 PCB1-RESV PIC S9(05) COMP.
     05 PCB1-SEG-NAME PIC X(08).
     05 PCB1-LEN-KEY PIC S9(05) COMP.
     05 PCB1-SENS-SG PIC S9(05) COMP.
    05 PCB1-FB-AREA PIC X(08).
01 CUSTOMER-DB-PCB-MASK.
   05 PCB2-DBD-NAME PIC X(08).
   05 PCB2-SEG-LEVEL PIC X(02). ........ ........
   05 PCB2-FB-AREA PIC X(08).
* PROCEDURE DIVISION.
A000-MAIN-PROCESS.
ENTRY 'DLITCBL' USING EMPLOYEE-DB-PCB-MASK,
CUSTOMER-DB-PCB-MASK.

Making DL/I calls

To establish a DL/1 interface from an application program, either the CBLTDLI or PLITDLI procedures are to be used (for COBOL and PL/1 respectively).

CALL 'CBLTDLI' USING DL1-FUNCTION-GN,
EMPLOYEE-PCB,
EMP-IO-AREA,
SSA-EMPLOYEE.

Parameters in a CBLTDLI call:

  • The first parameter is optional and contains a count of the number of parameters being passed.
  • The first parameter passed (second if a count is passed in the first parameter) is a four character field containing the type of database call that is being made. Valid values for this parameter are ‘GU ‘, ‘GHU ‘, ‘GN ‘, ‘GHN ‘,’GNP ‘, ‘GHNP’, ‘ISRT’, ‘DLET’, ‘REPL’, ‘CHKP’, and ‘XRST’ or any other valid call.
  • The next parameter is the PCB mask corresponding to the database to which the call is made.
  • This is then followed by an I/O area to contain the record retrieved from (or to be written to) the database.
  • Then follow a number of optional SSAs (Segment Search Arguments) that identify the record within the database to be accessed.
  • If the program performs a Get Next or other database call that does not fully qualify the record to be retrieved from the database then the information in the PCB area contains the location within the database from which the database call will commence the search for the indicated record.
  • The content of this area after the call gives the information about the current location of the pointer within the database as well as the status of the last call. The status code returned in this field can be checked following the call to ensure that the call was successful.

SSAs:

An unqualified SSA only gives the name of the segment that the call should access. In an unqualified SSA, the segment name field is 8 bytes and must be followed by a 1-byte blank. If the actual segment name is fewer than 8 bytes long, it must be padded to the right with blanks. Examples of an unqualified

SSA are :

01 EMP-SSA PIC X(09) VALUE 'EMPLOYEE '.
01 PATIENT-SSA PIC X(09) VALUE 'PATIENT '.

In a qualified SSA, a qualification statement follows the segment name specifying the key to be accessed. A qualified SSA has the below structure.

01 EMP-SSA.
   05 SEGNAME PIC X(08) VALUE 'EMPLOYEE'.
   05 CMD-CD-DELIMITER PIC X(01) VALUE '*'.
   05 CMD-CD PIC X(01) VALUE '-'.
   05 FILLER PIC X(01) VALUE '('.
   05 KEY-FIELD-NAME PIC X(08) VALUE 'EMPKEY '.
   05 OPERATOR PIC X(02) VALUE 'EQ'.
   05 EMP-KEY PIC X(06) VALUE 'D93821'.
  05 FILLER PIC X(01) VALUE ')'.

Note:
• If the SSA contains only the segment name, byte 9 must contain a blank.
• If the SSA contains one or more command codes:
Byte 9 must contain an asterisk (*). The last command code must be followed by a blank unless the SSA contains a qualification statement in which case, the command code is followed by the left parenthesis of the qualification statement.
• The operator can be one of the following: ‘EQ’,’GT’,’LT’,’LE’,’GE’,’NE’,’= ‘,’ =’,’> ‘, ‘ >’,'< ‘,’ <‘,'<=’,’=<‘,’>=’,’=>’,’^=’,’=^’.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.