IMS DC - Details
IMS DC - Details
IMS DC 1
Objectives
• To answer, what is IMS DC?
IMS DC 2
Online Concepts
Copyright © 2006 Accenture All Rights Reserved. Accenture, its logo, and Accenture
3 High Performance Delivered are trademarks of Accenture.
Online Concepts
Batch and online Differences
Batch Online
IMS DC 4
Online Concepts
Types of Online Programs
• Inquiry Programs
- Programs retrieve appropriate information for display
• Maintenance programs
- Programs add/update/delete information based on the input
• Menu programs
- A navigational system which allows users to choose from a set of multiple
options
IMS DC 5
IMS DC Concepts
Types of DC Programs
Conversational MPP
• It intended specifically for maintaining data between terminal interactions.
• You can store data
* on the terminal screen
* in a database
* in an IMS provided scratch pad area.
Non-conversational MPP
• Entire transaction is completed in one cycle
• Data cannot be transferred from 1 cycle of transaction to another cycle.
• Useful when entire processing is completed based on inputs
IMS DC 6
IMS DC Concepts
Batch Message Processing programs (BMPs)
1. Transaction-orientated
can access the on-line message queues.
Can process input from and output to OS/VS files and databases.
2. Batch-orientated
access on-line database in batch mode
can send messages to the message queue
are scheduled by the operator using JCL
IMS DC 7
IMS DC Concepts
Messages,queueing,Segment,IO-PCB,Input-output
You do have to be concerned with the data that terminal user enters is eventually
passed to your program as input message.
There are three types of input messages:
Transactions
Terminal-to-terminal message switches
IMS commands
You can Identify input message type
If IMS uses the value in 8 bytes characters name in an application
program i.e transaction.(transaction code)
If the first 8 characters contain an LTERM name i.e message
switch (Its used generally when master terminal communicates
with other set of terminals)
If the input message begins with a slash IMS interprets it as a
command. (it’s a message that is directed to Ims itself)
IMS DC 8
IMS DC Concepts
IMS DC 9
IMS DC Concepts
* Message queueing:
When IMS receives a message from a terminal it’s not passed
immediately to the destination, instead they go for either IMS
basic editing or MFS edit.
The entry a terminal user makes to invoke a transaction and the
execution of the application program with which it is associated
are not synchronous.
The IMS stores the transaction temporarily, which is message
queuing and the IMS modules that performs this are collectively
called the queue manager (QPOOL).
* How to retrieve segments:
If an input message consists of just one segment occurrence all
you need to do is issue one GU call to retrieve it.
The MPP issues a DC GU call to retrieve the input message
from the IMS message queue, then it does database processing
based on the input message queue.
IMS DC 10
IMS DC Concepts
* Note:
If you issue another GU call before issuing all the GN calls necessary to retrieve all the
segments of a single message, those remaining segments will be lost.
IMS DC 11
IMS DC Concepts
* IO-PCB in DC call:
A DC call must specify a linkage section PCB mask similar to the way it is
done in a DB call.
This is not a database PCB mask, it’s for the message processing, in
IMS terminology it’s called the I/O PCB
All you have to do is specify the name of the I/O PCB on the ISRT call
that sends an output message.
IMS DC 12
IMS DC Concepts
* Input-output area (I/O AREA):
• How to define i/o area for an input message segment
01 INPUT-MESSAGE-IO-AREA.
05 IM-LL PIC S9(3) COMP. (length of entire input message)
05 IM-ZZ PIC S9(3) COMP. (reserved for IMS for input)
05 IM-TRANS-CODE PIC X(9). (1-8 byte value followed by space)
05 IM-INVOICE-NO PIC X(6). (enough area to hold i/p message)
How to define i/o area for output message segment;
01 OUTPUT-MESSAGE-IO-AREA
05 OM-LL PIC S9(3) COMP VALUE +706. (Can modify in o/p only)
05 OM-ZZ PIC S9(3) COMP VALUE ZERO. (reserved by IMS)
05 OM-TEXT PIC X(702).
Before you issue an ISRT call you need to be sure that the LL field in the i/o area
contains the actual length of the message that’s to be sent including initial 4 bytes.
IMS DC 13
IMS DC Concepts
MESSAGE FORMATTING SERVICE (MFS)
It is a part of IMS TM that uses control blocks that you define to format
messages between a terminal and an MPP.
The MFS control blocks indicate to IMS TM how you want your input and
output messages arranged.
IMS DC 14
IMS DC Concepts
"Processing Messages: MPPs“
IMS DC 15
IMS DC Concepts
"Batch Message Processing: BMPs"
IMS DC 16
MFS Concepts
• The IMS message format service (MFS) is a facility of the IMS Transaction
Manager environment that formats messages to and from terminal devices.
• MFS uses control blocks you specify to indicate to IMS how input and output
messages are arranged.
• For input messages, MFS control blocks define how the message sent by the
device to the application program is arranged in the program's I/O area.
• For output messages, MFS control blocks define how the message sent by the
application program to the device is arranged on the screen or at the printer.
• MFS makes it possible for an MPP to communicate with different types of
terminals without having to change the way it reads and builds msg.
IMS DC 17
MFS Concepts
MFS Control Blocks
There are three types of control statements
* device format control statements
* message descriptor control statements
* compilation control statements
IMS DC 18
MFS Concepts
Advantages of Using MFS
• MFS improves online performance by using control blocks for online processing.
IMS DC 19
MFS Concepts
Types of message formatting
1. Input messages
• The MID defines how the data should be formatted for presentation to the IMS
TM application program and points to the DIF associated with the input device.
• The DIF describes the data as the data is received from the device.
IMS DC 20
MFS Concepts
Types of message formatting
2. Output messages
* Output processed by MFS are formatted based on the contents of two MFS control
blocks:the message output descriptor (MOD) and the device output format (DOF).
* The MOD defines output message content and, optionally, literal data to be considered
part of the output message. Message fields (MFLDs) refer to device field locations via
device field (DFLD) definitions in the DOF.
* The device output format (DOF) specifies the use of hardware features, device field
locations and attributes, and constant data considered part of the format.
IMS DC 21
MFS Concepts
Basic MFS code for any given screen: DOF/DIF
PAYF FMT
DEV TYPE=(3270,2),FEAT=IGNORE,DSCA=X'00A0'
DIV TYPE=INOUT
DPAGE CURSOR=((5,15))
DFLD '**********************',POS=(1,21)
DFLD '* EMPLOYEE PAYROLL *',POS=(2,21)
DFLD '**********************',POS=(3,21)
DFLD 'FIRST NAME:',POS=(5,2)
FNAME DFLD POS=(5,15),LTH=16
DFLD 'LAST NAME:',POS=(5,36)
LNAME DFLD POS=(5,48),LTH=16
DFLD 'EMPLOYEE NO:',POS=(7,2)
EMPNO DFLD POS=(7,16),LTH=6
DFLD 'SOC SEC NO:',POS=(9,2)
SSN DFLD POS=(9,15),LTH=11
DFLD 'RATE OF PAY: $',POS=(11,2)
RATE DFLD POS=(11,17),LTH=9
DFLD 'INPUT:',POS=(16,2)
INPUT DFLD POS=(16,10),LTH=30
FMTEND
IMS DC 22
MFS Concepts
MID
PAYIN MSG TYPE:INPUT,SOR=(PAYF,IGNORE)
SEG
MFLD 'PAYUP ' SUPPLIES TRANCODE
MFLD LNAME,LTH=16
MFLD FNAME,LTH=16
MFLD EMPNO,LTH=6
MFLD SSN,LTH=11
MFLD RATE,LTH=9
MFLD INPUT,LTH=30,JUST=R,FILL=C'0'
MSGEND
MOD
PAYDAY MSG TYPE:OUTPUT,SOR=(PAYF,IGNORE)
SEG
MFLD LNAME,LTH=16,ATTR=YES
MFLD FNAME,LTH=16
MFLD EMPNO,LTH=6
MFLD SSN,LTH=11
MFLD RATE,LTH=9
MFLD INPUT,LTH=30,JUST=R,FILL=C'0'
MSGEND
IMS DC 23
MFS Concepts
PAGING CONCEPT
Paging is a facility that lets messages be broken down into components for
display, for processing or for both.
IMS DC 24
MFS Concepts
PF KEY OPERATIONS
* The PFK parameter specifies a name that can be referred to by the MFLD statement that
defines the input message field that will receive literal data as a result of a PF key
operations,this should not be the name of device field.
* If the PF key you press is specified in the PFK parameter of the DEV statement MFS
moves literal data that you have specified for that PF key to a field in the input message
before it pass to IMS for queuing.
* If the literal data specifies the destination of the message (a program, terminal,IMS
command) then PF key can be used to request programs or IMS functions.
* If the field is embedded in the message the literal data is passed with the rest of the
message to its destination through PF key data as a control information to the application
program.
IMS DC 25
MFS Concepts
Control attributes & cursor positioning
To change attributes dynamically your Cobol program passes control information to
* identify and define fields that eligible for dynamic attribute modification (DAM).
* know the format and content of the control bytes you use for DAM.
* code your Cobol program so it can pass the correct control information to MFS.
suppose a device format includes a six byte field used to display an invoice number,
Note: although 2 byte prefix is not displayed it is a part of the data sent to MFS
*A cursor is mark on the terminal screen that identifies where the next data
the operator enters will be displayed.
* You can specify cursor positioning through MFS on the DPAGE statement
DPAGE CURSOR=(3,17)
IMS DC 26
MFS Concepts
Syntax rules for MFS control statements
• Columns 1-8 : Label field .If you code label value it must begin in column-1and first
character must be alphabetic.The maximum length of label is 8 characters.
• Columns 10-14: Operation field like FMT,DFLD,MSG,DEV these are called operation
codes. After operation field code the operand field, which contains one or more
parameters that indicate what the statement is to do,it must be separated from the
operation field by one or more spaces, if you leave column-15 blank, the operand field
can begin in column-16.
• When the MFS language utility encounters a space after the parameter,it considers the
operand field to have ended, and it ignores any data that follows column 71, as a result
you can code brief comments in this comment field.
• If you need to code a statement that’s too long to fit on a single line you can use
continuation lines, to do so you code a non-blank value in column-72 of all lines that
make up the statement except the last.
IMS DC 27
MFS Concepts
MFS control statement looks like an assembler language.
Continuation
Label Operation Operand/comments
character
(pos 1-8) (pos 10-14) (pos16-71)
(pos 72)
IMS DC 28
MFS Concepts
DEVICE FORMAT CONTROL STATEMENTS
DEV: Identifies the beginning of a series of control statements for a particular device type;
you can code multiple DEV statements within a device format.
DIV: Identifies the beginning of a series of control statements for a particular format type
subordinate to a DEV statements, for 3270 display station, you code only one DIV
statement subordinate to the DEV statement.
DPAGE: Identifies the beginning of a series of control statements for a device page
subordinate to a DIV statement.
IMS DC 29
MFS Concepts
Figure below shows the device format control statements:
FMT
DEV
DIV
DPAGE
DFLD
.
DPAGE
DFLD
.
DFLD
FMTEND
IMS DC 30
MFS Concepts
The DEV control statement
• For each different device type for which you want MFS support for a given application
you code DEV statement
• If three different device types were to be used for the same application you’d code three
DEV statements one for each,subordinate to each of these three DEV statements you’d
code a set of DIV,DPAGE,DFLD statements to define screen format.
• A device statement not only identifies a particular kind of device also specifies its
characteristics as well.
• Figure below shows the format of DEV control statement:
DEV TYPE=(3270,1)
,FEAT=IGNORE
[,PFK=(pfkeyfield,[integer=]{‘literal’} [,….] ) ]
[,DSCA=X’nnnn’]
[,SYSMSG=msgfield]
IMS DC 31
MFS Concepts
The DEV control statement
• TYPE Statement identifies the type of Terminal. For e.g. (3270,2) is 24 X 80, (3270,1) is 12
X 80 etc.
• FEAT = IGNORE -- This is default and it ensures that DIF and DOF generated with this
terminal type will work on all terminals of the same type regardless of the special features
installed on it.
• PFK Parameter -- This is used to define the PF Key actions. This has two parts
PFK=(Fieldname,parameters....). This fieldname is a Pseudo field name that has to be
defined in DIF with a length of 2. And the "parameters" can be positional or keyword.
• DSCA -- means default system control area. DSCA = X'00A0' ==> erase unprotected fields
on screen before new data is written on it. DSCA = X'00C0' ==> clear entire device buffer
before output is written on the screen.
• SYSMSG -- this parameter is used to route any system messages to the screen field
associated to it.
IMS DC 32
MFS Concepts
The DIV Control statement
• After the DEV statement you code a DIV statement, you always code to indicate that
the same device format specifications should be used to generate both a DIF and
DOF.
• You code INOUT for a 3270 display station because an output format becomes the
input format for the next message.
DIV TYPE=INOUT
IMS DC 33
MFS Concepts
The DPAGE statement
The primary function of the DPAGE control statement is to let you specify a device format that
will handle multiple logical pages. You may need to use DPAGE statement for initial cursor
positioning and field Fill.
Label DPAGE
[CURSOR=((line,column,cfield]…..) ]
[, FILL = fill char]
[, MULT=YES]
• It has the CURSOR parameter which identifies the Static Cursor Positioning. For e.g. CURSOR
= ((5,12)).
• It has the FILL parameter that specifies what character should be used to pad device fields
when output data sent to them doesn't fill them.
• FILL = PT is default ==> The program tab character avoids transmitting blanks to fill partially full
fields but at the same time it erases previously displayed data that would otherwise be left in the
unused parts of those fields. .
IMS DC 34
MFS Concepts
THE DFLD CONTROL STATEMENTS
DFLD indicates the Device Field. The Format of the DFLD is as shown below
IMS DC 35
MFS Concepts
The DFLD control statement
IMS DC 36
MFS Concepts
Message descriptor control statements
IMS DC 37
MFS Concepts
The message descriptor control statements are arranged hierarchically
MSG
LPAGE
PASSWORD
MFLD
SEG
MFLD
MFLD
SEG
MFLD…….
MFLD
MSGEND
IMS DC 38
MFS Concepts
Syntax for Message Descriptor
• Unlike the situation for a DIF and DOF you must code separate groups of statements to define
a MID and a MOD.
• Each segment of code that describes a message, whether it’s an input message or an
output message, begins with a MSG statement and ends with a MESGEND statement.
Syntax:
Msgname MSG TYPE = { INPUT/OUTPUT}
, SOR=(dfname, IGNORE)
[ , NXT= nextmsgname}
[ , PAGE = YES]
MSGEND
IMS DC 39
MFS Concepts
• TYPE = INPUT for MID and TYPE = OUTPUT for MOD
• SOR Parameter is used to give the Device Format Name. IGNORE is same as FEAT =
IGNORE in DEV Statement.
• NXT Parameter is used for Performance reasons . FOR MID its MOD and vice versa.
IMS DC 40
MFS Concepts
THE MFLD CONTROL STATEMENT
Syntax:
MFLD { source/destination}
[ , LTH=length]
[ , JUST={L/R} ]
[ ,FILL = fillchar ]
[ , ATTR = (YES) ]
IMS DC 41
MFS Concepts
• The SEG control statement identifies the segment that makes up the message.
• MFLD parameter is for the message field. We can code literals and length OR variable
name and length OR variable name, default value and length OR MFLD (CURDATE
DATE2) which implies MAP the system date DATE2 to the device Field CURDATE.
• When we are using such system referrals there are two points worth noting
– Do not Specify LTH parameter on MFLD statement
– Do not code this field in the Output Message IO Area in the program.
• FILL = C' ' or X'40' for Spaces and FILL = C'0' for numeric fields initialized to Zeroes.
Note : The FILL parameter is coded only in MID and not in MOD.
IMS DC 42
MFS Concepts
HOW TO CODE THE COMPILATION CONTROL STATEMENTS
IMS DC 43
MFS Concepts
• Message Format Service (MFS) uses control blocks that define what a
message should look like to the person at the terminal and to the
application program.
IMS DC 44
MFS Concepts
Using MFS Edit
MFS uses 4 control blocks to format messages between a pgm & terminal.
The two control blocks that describe input messages to IMS are:
• The device input format (DIF) describes to IMS what the input message will look like when
it is entered at the terminal.
• The message input descriptor (MID) tells IMS how the application program expects to
receive the input message in its I/O area.
By using the DIF and the MID, IMS can translate the input message from the way that it is
entered at the terminal to the way it should appear in the program's I/O area.
The two control blocks that describe output messages to IMS are:
• The message output descriptor (MOD) tells IMS what the output message will look like in
the program's I/O area.
• The device output format (DOF) tells IMS how the message should appear on the terminal.
IMS DC 45
MFS Concepts
Using Basic Edit
Basic edit removes the control characters from an input message before the application
program receives it, and inserts the control characters you specify when the application
program sends a message back to the terminal.
To format output messages at a terminal using basic edit, you need to supply the
necessary control characters for the terminal you are using.
If your application will use basic edit, you should describe how you want the data to be
presented at the terminal, and what it will look like in the program's I/O area.
IMS DC 46
MFS Concepts
Editing Considerations in Your Application
• How you want the screen to be presented to the person at the terminal for the person to
enter the input data.
• What the data should look like when the person at the terminal enters the input
message.
• What the input message should look like in the program's I/O area.
• What the data should look like when the program builds the output message in its I/O
area.
• How the output message should be formatted at the terminal.
• The length and type of data that your program and the terminal will be exchanging.
IMS DC 47
MFS Concepts
Gathering Requirements for Conversational Processing
• Conversational processing means that the person at the terminal can converse with the
application program.
• When you use conversational processing, the person at the terminal enters some
information, and an application program processes the information and responds to the
terminal. The person at the terminal then enters more information for an application
program to process.
• Each of these interactions between the person at the terminal and the program is called
a cycle in the conversation.
IMS DC 48
MFS Concepts
What happens in a Conversation
• For a program to continue a conversation, the program must have the necessary
information to continue processing.
• IMS stores data from one step of the conversation to the next in a scratchpad area
(SPA).
• When a program continues the conversation (the same program or a different one),
IMS gives the program the SPA for the conversation associated with that terminal.
In an airlines example, the first program might save the flight number and the names of
the people traveling, then pass control to another application program to reserve seats for
those people on that flight. The program saves this information in the SPA. If the second
application program did not have the flight number and names of the people traveling, it
would not be able to do its processing.
IMS DC 49
MFS Concepts
• Move a blank to the first byte of the transaction code area of the SPA and then return
the SPA to IMS.
• Respond to the terminal and pass control to a non conversational program. This is
also called a deferred switch, but Program A ends the conversation before passing
control to another application program.
IMS DC 50
MFS Concepts
Identifying Output Message Destinations
To send a message to the logical terminal that sent the input message, the program uses
an I/O PCB. IMS puts the name of the logical terminal that sent the message in the I/O
PCB when the program receives the message.
IMS DC 51
MFS Concepts
To Other Programs and Terminals
When you want to send an output message to a terminal other than, or in addition to, the
terminal that sent the input message, you use an alternate PCB. An alternate PCB is a
data communication program communication block (DCPCB) you define to describe output
Message destinations other than the terminal that originated the input message.
You can set the alternate PCB for a specific logical terminal when the program's PSB is
generated, or you can define the alternate PCB as being modifiable. A program can
change the destination of a modifiable alternate PCB while the program is running, so you
can send output messages to several alternate destinations.
IMS DC 52
Programming in IMS DC
Writing Application Programs
Topics to be covered
- Application Programming Interface
- Getting Started with DL/I
- Using DL/I Calls
- Status Codes, Return Codes, and Reason Codes
- How Your Program Processes Messages
- How IMS TM Edits Messages
- DB2 Considerations
IMS DC 53
Programming in IMS DC
Application Program Environments
- DB/DC
- DBCTL
- DCCTL
IMS DC 54
Programming in IMS DC
Messages from terminals and application programs are processed by the IMS control
region. The requested database segments or messages from other parts of the system
(for example, status codes, system messages, or responses from terminals) are also
processed by IMS and returned to the application.
The online environment can be used to access other types of database subsystems using
the External Subsystem Attach facility (ESAF). It permits applications running with IMS to
obtain data from external subsystems, such as DB2.
The transaction management portion of the IMS DB/DC environment can be used
separately to provide transaction management for external subsystems. This is the DCCTL
environment.
IMS DC 55
Programming in IMS DC
The DCCTL Environment
The DCCTL environment functions like IMS TM in a DB/DC environment, except that DCCTL
has no inherent database facilities. Instead, the DCCTL environment is used to access
external subsystems, such as DB2. GSAM databases, which contain sequential non-IMS
data sets, can be accessed by BMPs.
Most DL/I message processing and system service calls are supported in DCCTL. DL/I calls
that require access to IMS databases are not valid. Application programs in the DCCTL
environment can execute in the MPP, BMP, or IFP dependent regions. Except for the
restriction on DL/I calls to databases, application programs in the DCCTL environment are
the same as IMS TM applications.
IMS DC 56
Programming in IMS DC
How IMS TM Schedules Application Programs
IMS TM begins the scheduling process for an application program when a message
generated from a terminal or another application program requires processing. The
transaction manager assigns this input message, or transaction, to an available dependent
region and verifies that the application program is available to process the message. While
The application processes the message, IMS TM controls availability to other requests for
scheduling.
The PSB (defined by the PSBGEN utility) describes an application program to IMS TM and
contains the program control blocks (PCBs) required by the application.
IMS DC 57
Programming in IMS DC
Using DL/I Calls
A DL/I call consists of a call statement and a list of parameters. The parameters for the
call provide information IMS needs to execute the call. This information consists of the call
function, the name of the data structure IMS uses for the call, the data area in the program
into which IMS returns, and any condition the retrieved data must meet.
You can issue calls to perform transaction management functions (message calls) and to
obtain IMS TM system services (system service calls):
IMS DC 58
Programming in IMS DC
The IMS TM message processing calls are:
AUTH Authorization
CHNG Change
CMD Command
GCMD Get Command
GN Get Next
GU Get Unique
ISRT Insert
PURG Purge
SETO Set Options
IMS DC 59
Programming in IMS DC
System Service Call Functions
IMS DC 60
Programming in IMS DC
The additional IMS TM system service calls are:
IMS DC 61
Programming in IMS DC
Status Codes, Return Codes, and Reason Codes
To provide information on the results of each call, IMS TM places a 2-character status code in
the PCB after each IMS TM call your program issues. Your program should check the status
code after every IMS TM call it issues. If it does not, it might continue processing even
though the last call caused an error.
Exceptional Conditions
Some status codes do not mean that your call was successful or unsuccessful; they just give
you information about the results of the call. Your program uses this information to determine
what to do next. The meanings of these status codes depend on the call.
IMS DC 62
Programming in IMS DC
Error Routines
If, after checking for blanks and exceptional conditions in the status code, you find that
there has been an error, your program should branch to an error routine and print as much
information as possible about the error before terminating. Print the status code as well.
Information that is helpful in understanding the error include: which call was being executed
when the error occurred, what were the parameters of the IMS call, and what were the
contents of the PCB.
Two kinds of errors can occur in your program. First, programming errors are usually your
responsibility; they are the ones you can find and fix. These errors are caused by things
like an invalid parameter, an invalid call, or an I/O area that is too long. The other kind of
error is something you cannot usually fix; this is a system or I/O error.
IMS DC 63
Programming in IMS DC
How Your Program Processes Messages
To retrieve and send messages, an IMS TM application program issues calls to IMS TM.
When your program issues a call to retrieve a message, IMS TM places the input
message in the I/O area you name in the call. Before you issue a call to send a
message, you must build the output message in an I/O area in your program.
Message Types
An operator at a terminal can send four kinds of messages to IMS TM. The destination
of an IMS TM message identifies which kind of message is being sent:
* Another terminal.
* An application program.
* IMS TM.
* Message switch service.
IMS DC 64
Programming in IMS DC
What Input Messages Look Like
For the
AIBTDLI
ASMTDLI
CBLTDLI |----|----|--------|----------------|
CEETDLI | LL | ZZ |TRANCODE| Text |
CTDLI and |----|----|--------|----------------|
PASTDLI | 2 | 2 | 8 | variable |
interfaces: |----|----|--------|----------------|
IMS DC 65
Programming in IMS DC
What Output Messages Look Like
The format of the output message that you build to send back to a terminal or to
another program is similar to the format of the input message, but the fields
contain different information.
Output messages contain four fields: the length field, the Z1 field, the Z2 field, and
the text field. Figure shows the format of an output message.
For the
CBLTDLI |---- |---- |--- -|-------------------------|
CEETDLI | LL | Z1 | Z2 | Text |
CTDLI and |----|----|----|-------------------------|
PASTDLI interface | 2 | 1 | 1 | variable |
|----|----|----|-------------------------|
Output Message Format
IMS DC 66
Programming in IMS DC
What Happens When a Message is Processed
What a program does when it receives a message depends on the kind of message it
receives. A transaction code associates a request for information from a terminal with the
application program that can process and respond to that request. IMS TM schedules an
MPP when there are messages to be processed that contain the transaction code
Associated with that MPP.
IMS DC 67
Programming in IMS DC
Results of a Message: I/O PCB
After your program issues a call, IMS TM returns information about the results of the call
in the I/O PCB. To find out about the results of the call, your application program must
check the information that IMS TM returns to the I/O PCB.
When your application program retrieves a message, IMS TM returns the following
information about the message to the I/O PCB:
IMS DC 68
Programming in IMS DC
DB2 Considerations
For the most part, the message processing function of a dependent region that accesses
DB2 databases is similar to that of a dependent region that accesses only DL/I databases.
The method each program uses to retrieve and send messages and back out database
changes is the same.
* DL/I statements are coded differently from SQL statements.
* When an IMS TM application program receives control from IMS TM, IMS has
already acquired the resources the program is able to access.
* When an application issues a successful checkpoint call or a successful message GU
call, DB2 closes any cursors that the program ‘s IMS TM and DB2 work together to
keep data integrity in these ways:
* When your program reaches a commit point, IMS TM makes any changes that the
program has made to DL/I databases permanent,. DB2 then makes any changes that
the program has made to DB2 databases permanent.
IMS DC 69
Programming in IMS DC
Part 6. Understanding Application Program Elements
Your application program must define formatting DL/I calls for language interfaces and
provides language calls information for assembler language, C language, COBOL, Pascal,
and PL/I.
- Formatting DL/I Calls for Language Interfaces
- Relationship of Calls to PCB Types
- Specifying the I/O PCB Mask
- Specifying the Alternate PCB Mask
- Specifying the I/O Areas
- Using the AIBTDLI Interface
- Specifying the Language-Specific Entry Point
- Using Language Environment
- Special DL/I Situations
IMS DC 70
Programming in IMS DC
Formatting DL/I Calls for Language Interfaces
When you use DL/I calls in a programming language supported by IMS (assembler
language, C language, COBOL, Pascal, or PL/I), you must call the DL/I language interface
to initiate the functions specified with the DL/I calls. IMS offers several interfaces for DL/I
calls:
* A language-independent interface for any programs that are Language Environment-
conforming (CEETDLI)
* Language-specific interfaces for all supported languages (xxxTDLI)
* A non-language-specific interface for all supported languages (AIBTDLI)
Because the exact syntax for calling the language interfaces varies among
the programming languages, there are different language-specific formats.
IMS DC 71
Programming in IMS DC
Application Programming for COBOL Format
| >>--CALL--|-'CBLTDLI'--USING | |-parmcount,-|
-|------------|--function-----|
|-,i/o pcb--|-| |
| <A> |
| | |-,alt pcb--|---------|-| | |
| | | <A> |-| ||
| | | <B> |-| |
<A>:
| |--,i/o area--|-----------------------------------||
| |-,mod name-------------------------|
| |-,token----------------------------||
| |-,options list--|----------------||
| |-,feedback area-| |
<B>:
| |--,destination name--||
|-,options list-|----------------|
| |-,feedback area-|
IMS DC 72
Programming in IMS DC
Application Programming for COBOL - Parameters :
parmcount
function
i/o pcb
alternate pcb
aib
i/o area
i/o area length
token
options list
feedback area
mod name
destination name
IMS DC 73
Programming in IMS DC
Example DL/I Call Formats
IMS DC 74
Programming in IMS DC
Specifying the I/O PCB Mask
After your program issues a call with the I/O Program Communications Block (I/O PCB), IMS
returns information about the results of the call to the I/O PCB. To determine the results of
the call, your program must check the information that IMS returns. Issuing a system service
call requires an I/O PCB. Because the I/O PCB resides outside your program, you must
define a mask of the PCB in your program to check the results of IMS calls. The mask must
contain the same fields, in the same order, as the I/O PCB.
Your program can then refer to the fields in the PCB through the PCB mask.
An I/O PCB contains nine fields :
1. Logical Terminal Name 5. Current Time
2. Reserved for IMS 6. Input Message Sequence Number
3. Status Code 7. Message Output Descriptor Name
4. Current Date 8. Userid 9. Group Name
IMS DC 75
Programming in IMS DC
Specifying the Alternate PCB Mask
An alternate PCB mask contains three fields. Table 1 shows these fields, the
field length, and in which environment the field applies.
IMS DC 76
Programming in IMS DC
Specifying the AIB Mask
The AIB is used by your program to communicate with IMS, when your application does not
have a PCB address or the call function does not use a PCB.The AIB mask enables your
program to interpret the control block defined.
1. AIB Identifier (AIBID) 10. Reason Code (AIBREASN)
2. DFSAIB Allocated Length (AIBLEN) 11. Reserved
3. Sub function Code (AIBSFUNC) 12. Resource Address AIBRSA1
4. Resource Name (AIBRSNM1) 13. Reserved
5. Reserved
6. Maximum Output Area Length (AIBOALEN)
7. Used Output Area Length (AIBOAUSE)
8. Reserved
9. Return code (AIBRETRN)
IMS DC 77
Programming in IMS DC
Specifying the I/O Areas
Use an I/O area to pass segments between the application program & IMS TM. What the
I/O area contains depends on the type of call issued :
• When your program retrieves a segment, IMS TM places the segment your program
requested in the I/O area.
• When your program adds a new segment, your program first builds the new segment
in the I/O area.
• Before modifying a segment, your program must first retrieve the segment. When
your program retrieves the segment, IMS TM places the segment in an I/O area.
• The I/O area for transaction management calls must be large enough to hold the
largest message segment your program retrieves from or sends to IMS TM.
IMS DC 78
Programming in IMS DC
Specifying the Language-Specific Entry Point in COBOL
IMS gives control to an application program through an entry point. Your entry point must
refer to the PCBs in the order in which they have been defined in the PSB.
The procedure statement must refer to the I/O PCB first, then to any alternate PCB it
uses, and last to the DB PCBs it uses.
The alternate PCBs and DB PCBs must be listed in the order in which they are defined in
the PSB. Procedure division using the PCB-AME-1 Ö,...,PCB-NAME-NÜ If only IMS is
used, the PCBs can be referenced with the program entry statement.
The entry statement must appear as the first executable statement in the procedure
division. When IMS passes control to your program, it passes the addresses of each of
the PCBs your program uses. The parameters in this statement are the names of the
PCBs.
ENTRY 'anyname' USING pcb-name-1 ...,pcb-name-2....... GOBACK.
IMS DC 79
Programming in IMS DC
Format of a PCB List
PSBs have the following format:
IOPCB
Alternate PCB1 ... Alternate PCB2
DB PCB1 ... DB PCB2
GSAM PCB1 ... GSAM PCB2
Each PSB must contain at least one PCB. An I/O PCB or alternate PCB is required for
transaction management calls, and an I/O PCB is required for most system service calls.
DB PCBs for DL/I databases are used only with the IMS Database Manager, but can be
present even though your program is running under DCCTL. (A DB PCB can be a full-
function PCB, a DEDB PCB, or an MSDB PCB.) GSAM PCBs can be used with DCCTL.
Alternate PCBs are always included in the list of PCBs supplied to the program by IMS
TM. The I/O PCB is always present in the PCB list regardless of the CMPAT options
specified in PSBGEN.
IMS DC 80
Programming in IMS DC
Writing DL/I Calls for Transaction Management
Transaction management calls must use either i/o pcb or aib parameters. The DL/I calls
used for database management are described in IMS/ESA Application Programming:
DCCTL users can issue calls using GSAM database PCBs.
IMS DC 81
Programming in IMS DC
AUTH Call
|-----------|-----------|------------|-----------|-----------|-----------|
| Call Name | DB/DC | DBCTL | DCCTL | DB Batch | TM Batch |
|-----------|-----------|------------|-----------|-----------|-----------|
| AUTH | X | | X | | |
|-----------|-----------|------------|-----------|-----------|-----------|
IMS DC 82
Programming in IMS DC
CHNG Call
The Change (CHNG) call sets the destination of a modifiable alternate PCB to the logical
terminal, LU 6.2 descriptor, or transaction code that you specify. You can also use the
CHNG call with the Spool application Program Interface (Spool API) to specify print data
set characteristics.
|------------------------------------------------------------------------|
| |
| >>--CHNG--|-alternate pcb-|--destination name------------------------> |
| |-aib-----------| |
| |
| >--|---------------------------------|------------------------------>< |
| |-options list--|---------------|-| |
| |-feedback area-| |
| |
|------------------------------------------------------------------------|
|-----------|-----------|------------|-----------|-----------|-----------|
| Call Name | DB/DC | DBCTL | DCCTL | DB Batch | TM Batch |
|-----------|-----------|------------|-----------|-----------|-----------|
| CHNG | X | | X | | |
|-----------|-----------|------------|-----------|-----------|-----------|
IMS DC 83
Programming in IMS DC
GN Call
If an input message contains more than one segment, a Get Unique (GU) call retrieves
the first segment of the message and Get Next (GN) calls retrieve the remaining
segments
Format |------------------------------------------------------------------------|
| |
| >>--GN--|-i/o pcb-|--i/o area--------------------------------------->< |
| |-aib-----| |
| |
|------------------------------------------------------------------------|
|-----------|-----------|------------|-----------|-----------|-----------|
| Call Name | DB/DC | DBCTL | DCCTL | DB Batch | TM Batch |
|-----------|-----------|------------|-----------|-----------|-----------|
| GN | X | | X | | |
|-----------|-----------|------------|-----------|-----------|-----------|
IMS DC 84
Programming in IMS DC
GU Call
The Get Unique (GU) call retrieves the first segment of a message
Format
|------------------------------------------------------------------------|
| |
| >>--GU--|-i/o pcb-|--i/o area--------------------------------------->< |
| |-aib-----| |
| |
|------------------------------------------------------------------------|
|-----------|-----------|------------|-----------|-----------|-----------|
| Call Name | DB/DC | DBCTL | DCCTL | DB Batch | TM Batch |
|-----------|-----------|------------|-----------|-----------|-----------|
| GU | X | | X | | |
|-----------|-----------|------------|-----------|-----------|-----------|
IMS DC 85
Programming in IMS DC
ISRT Call
The Insert (ISRT) call sends one message segment to the destination that you specify in
the call. The destination is represented by the I/O PCB, alternate PCB, or AIB you specify
in the call parameters. For Spool API functions, the ISRT call is also used to write data to
the JES Spool.
Format
|------------------------------------------------------------------------|
| |
| >>--ISRT--|-i/o pcb-------|--i/o area--|----------|----------------->< |
| |-alternate pcb-| |-mod name-| |
| |-aib-----------| |
| |
|------------------------------------------------------------------------|
|-----------|-----------|------------|-----------|-----------|-----------|
| Call Name | DB/DC | DBCTL | DCCTL | DB Batch | TM Batch |
|-----------|-----------|------------|-----------|-----------|-----------|
| ISRT | X | | X | | |
|-----------|-----------|------------|-----------|-----------|-----------|
IMS DC 86
Programming in IMS DC
PURG Call
The Purge (PURG) call allows your application program to send one or more output
message segments (specified with the ISRT call) to the specified destination before the
application program retrieves the next input message or issues a commit point. For Spool
API services, the PURG call can also be used to release a print data set for immediate
printing.
Format
|------------------------------------------------------------------------|
| |
| >>--PURG--|-i/o pcb-------|--|------------------------|------------->< |
| |-alternate pcb-| |-i/o area--|----------|-| |
| |-aib-----------| |-mod name-| |
| |
|------------------------------------------------------------------------|
|-----------|-----------|------------|-----------|-----------|-----------|
| Call Name | DB/DC | DBCTL | DCCTL | DB Batch | TM Batch |
|-----------|-----------|------------|-----------|-----------|-----------|
| PURG | X | | X | | |
|-----------|-----------|------------|-----------|-----------|-----------|
IMS DC 87
Programming in IMS DC
More about Message Processing
3. Backing Out to a Prior Commit Point: The ROLL, ROLB, and ROLS Calls
IMS DC 88
Programming in IMS DC
Sending Messages to Other Terminals and Programs
• If you want to send output messages to one alternate destination, define the alternate PCB
for that destination.
• If you want to send output messages to more than one alternate destination, and you want
to be able to change the destination of the alternate PCB, define the alternate PCB as
modifiable during PSB generation. Then, before you issue the ISRT call, you issue a
change call, or CHNG, to set the destination of the alternate modifiable PCB for the
destination program or terminal.
• The express alternate PCB is a special kind of alternate PCB that is defined during PSB
generation, by specifying EXPRESS=YES.
• A PSBGEN can also specify an alternate PCB as an alternate response PCB defined during PSB
generation.
• If you want to send a message to an LU 6.2 device, you can specify the LU 6.2 descriptor name
that is associated with that device.
IMS DC 89
Programming in IMS DC
Sending Messages to Other Terminals
To reply to a different terminal, also use the ISRT call, but use an alternate PCB instead of
the I/O PCB. Just as the I/O PCB represents the terminal that sent the message, an
alternate PCB represents the terminal to which you want to send the message.
If you are going to send messages to only one alternate terminal, you can define the
alternate PCB for that terminal during PSB generation. When you define an alternate PCB
for a particular destination, you cannot change that destination during program execution.
Each time you issue an ISRT call that references that PCB, the message goes to the logical
terminal whose name was specified for the alternate PCB.
IMS DC 90
Programming in IMS DC
Sending Messages to Other Application Programs
• Create an I/O area large enough to hold the largest segment that you are sending.
• Use an alternate PCB, not the I/O PCB, to send the message.
• Issue a CHNG call before the ISRT call to place the program's transaction code in the
first field of the alternate PCB. If the alternate PCB was set to this transaction code in
the PSBGEN, then you just issue the ISRT call.
• IMS TM must know the transaction code. Define it at system definition.
• A nonconversational program can do a program-to-program message switch to another
nonconversational program, but not to a conversational program.
• A conversational program can do a program-to-program message switch to either
another conversational program or a nonconversational program.
IMS DC 91
Programming in IMS DC
There might be situations in which the application program's processing is changed if the
input message is from a remote terminal, rather than from a local terminal.
|---------| | MPP1 | |----------|
| MASTER | | | | MASTER |
|----|----| | | |-----|----|
| |----|---| |
| | |
| | |
|------|----------------|-------| LINK1 |-----------|-----------|
| |---------->| |
| SYSTEM A |<----------| SYSTEM B |
| | LINK2 | |
|-------------------------------| |-----------------------|
MSC Example
IMS DC 92
Programming in IMS DC
CBLTDLI, |----|----|-----------|---|--------------|
CEETDLI, | LL | ZZ | DESTNAME | b | TEXT |
CTDLI and |----|----|-----------|---|--------------|
PASTDLI interfaces: | 2 | 2 | 1 - 8 | 1 | variable |
|----|----|-----------|---|--------------|
IMS DC 93
Programming in IMS DC
IMS Conversations
IMS DC 94
Programming in IMS DC
A Conversational Example
For this example, suppose that you want to find out if someone can qualify for a car loan.
This inquiry contains two parts.
First, you give the name and address of the person requesting the loan and the number of
years for which the person wants the loan.
After you give this information, IMS TM asks you for the information on the car: model,
year, and cost.
You enter this information, IMS TM invokes the program that processes this information,
and the program tells you whether the loan can be granted.
IMS DC 95
Programming in IMS DC
If you use MFS, this process involves six steps:
IMS DC 96
Programming in IMS DC
Conversational Structure
IMS DC 97
Programming in IMS DC
Replying to the Terminal
For a conversation to continue, the originating terminal must receive a response to each of
its input messages. The person at the terminal cannot enter any more data to be processed
(except IMS TM commands) until the response has been received at the terminal.
To continue the conversation, the program must respond to the originating terminal by
issuing the required ISRT calls to send the output message to the terminal. To send a
message to the originating terminal, the ISRT calls must reference either the I/O PCB or
an alternate response PCB.
Use an alternate response PCB in a conversation when the terminal you are responding
to has two components for example, a printer and a punch and you want to send the output
message to a component that is separate from the component that sent the input message.
IMS DC 98
Programming in IMS DC
If the program references an alternate response PCB, the PCB must be defined for the
same physical terminal as the logical terminal that sent the input message.
The program can send only one output message to the terminal for each input message.
Output messages can contain multiple segments, but the program cannot use the PURG
call to send multiple output messages.
If a conversational program issues a PURG call, IMS TM returns an AZ status code to the
application program and does not process the call.
IMS DC 99
Programming in IMS DC
Using ROLB, ROLL, and ROLS in Conversations
Issuing a ROLB or ROLS in a conversational program causes IMS TM to back out the
messages that the application program has sent.This means that, if the program issues a
ROLB or ROLS and then reaches a commit point without sending the required response
to the originating terminal, IMS TM terminates the conversation and sends the message
If you issue ROLL during a conversation, IMS TM backs out the updates and cancels
output messages, but it also terminates the conversation.
IMS DC 100
Programming in IMS DC
Passing the Conversation to Another Conversational Program
IMS DC 101
Programming in IMS DC
Message Switching in APPC Conversations
With the system service DFSAPPC, you can transfer messages between separate LU 6.2
devices and between an LU 6.2 device and another terminal supported by IMS TM.
Message delivery with DFSAPPC is asynchronous, so messages are held on the IMS TM
message queue until they can be delivered.
To send a message with DFSAPPC, specify the logical terminal name of an IMS TM
terminal or the Transaction Program (TP) name of an LU 6.2 device.
IMS DC 102
Programming in IMS DC
Processing Conversations with APPC
• Modified -- Uses the I/O PCB to communicate with the original input terminal. Uses CPI
Communications calls to allocate new conversations and to send and receive data.
IMS DC 103
Programming in IMS DC
Standard IMS Application Programs
Standard IMS application programs use the existing IMS call interface.
Application programs that use the IMS standard API can take advantage of the LU 6.2
protocols. Standard IMS application programs use a DL/I GU call to get the incoming
transaction. These standard IMS application programs also use DL/I ISRT calls to generate
output messages to the same or different terminals, LU 6.2 or not. (3) Note that the identical
program can work correctly for both LU 6.2 and non-LU 6.2 terminal types. IMS generates
the appropriate calls to MVS/APPC services.
IMS DC 104
Programming in IMS DC
Modified IMS Application Programs
Modified IMS application programs use a DL/I GU call to get the incoming transaction.
These modified IMS application programs also use DL/I ISRT calls to generate output
messages to the same or different terminals, LU 6.2 or not. Unlike standard IMS application
programs, modified IMS application programs use CPI communications calls to allocate new
conversations, and send and receive data.
GU IOPCB
ALLOCATE
SEND
RECEIVE
DEALLOCATE
ISRT IOPCB
Figure 1. General Format of a Modified DL/I Application Program
IMS DC 105
Programming in IMS DC
Coding a Conversational Program
IMS DC 106
Programming in IMS DC
Backing Out to a Prior Commit Point: The ROLL, ROLB, and ROLS Calls
When a program determines that some of its processing is invalid, you can use the following
calls to remove the effects of its incorrect processing:
Roll Back calls ROLL, ROLS using a database PCB, ROLS with no I/O area or token, and
ROLB. When you issue one of these calls, IMS
* Backs out the database updates that the program has made since the program's most
recent commit point.
* Cancels the non-express output messages that the program has created since the
program's most recent commit point.
The main difference among these calls is that ROLB returns control to the program after
backing out updates and canceling output messages, ROLS does not return control to the
application program, and ROLL terminates the program with a user abend code of 0778.
ROLB can return to the program the first message segment since the most recent commit
point, but ROLL and ROLS cannot.
IMS DC 107
Programming in IMS DC
Backing Out to an Intermediate Backout Point: SETS/SETU and ROLS
Figure below SETS and ROLS Calls Working Together
---|--- Program Starts
|
|
| SETS Token=n
|
| GHU
| REPL
| ISRT MSG1-Segment 1 to I/O PCB
|
|-------|--> SETS Token=B
| |
Backs out | | GHU
program to | | DLET
SETS Token=B | | ISRT MSG1-Segment 2 to I/O PCB
| |
|-------|--- ROLS Token=B
|
|
|
v
IMS DC 108
Programming in IMS DC
Writing a Message-Driven Program
A message-driven program is similar to an MPP: it retrieves messages and processes them,
and it can read and update MSDBs, DEDBs, and full-function databases.
IMS DC 109
Programming in IMS DC
Coding DC Calls and Data Areas Your Input
The way you code DC calls and data areas depends on the application programming
language you use. Information you need about your program's design:
• The names of the logical terminals that your program will communicate
• The transaction codes, if any, for the application program's MPP skeleton to which
your program will send messages
• The DC call structure for your program
• The destination for each output message that you send
• The names of any alternate destinations to which your program sends messages
IMS DC 110
Programming in IMS DC
Information you need about input messages:
* The size and layout of the input messages your program will receive
* The format in which your program will receive the input messages
* The editing routine your program uses
* The range of valid data in input messages
* The type of data that input messages will contain
* The maximum and minimum length of input message segments
* The number of segments in a message
IMS DC 111
Programming in IMS DC
Skeleton MPP
1. The program retrieves an input message segment from a terminal by issuing a GU call
to the I/O PCB. This retrieves the first segment of the message. Unless this message
contains only one segment, your program issues GN calls to the I/O PCB to retrieve the
remaining segments of the message. IMS places the input message segment in the
I/O area that you specify in the call. In the examples below, this is MSG-SEG-IO-AREA.
2. The program retrieves a segment from the database by issuing a GU call to the DB
PCB. This call specifies an SSA, SSA-NAME, to qualify the request. IMS places the
database segment in the I/O area specified in the call. In this case, the I/O area is
called DB-SEG-IO-AREA.
IMS DC 112
Programming in IMS DC
IMS DC 113
Programming in IMS DC
Coding Your Program in COBOL
Figure 1 COBOL MPP Skeleton
| | ENVIRONMENT DIVISION.
| | DATA DIVISION.
| | WORKING-STORAGE SECTION.
| 1 | 77 GU-CALL PICTURE XXXX VALUE 'GU '.
|
| | 77 ISRT-CALL PICTURE XXXX VALUE 'ISRT'.
| | 77 CT PICTURE S9(5) COMPUTATIONAL VALUE +4. |
| | 01 SSA-NAME. |
| 2 | 01 MSG-SEG-IO-AREA.
| | 01 DB-SEG-IO-AREA.
| | 01 ALT-MSG-SEG-OUT.
IMS DC 114
Programming in IMS DC
| | LINKAGE SECTION. |
| 3 | 01 IO-PCB. |
| | 01 ALT-PCB. |
| | 01 DB-PCB. |
| | PROCEDURE DIVISION. |
| 4 | ENTRY 'DLITCBL' USING IO-PCB, ALT-PCB, DB-PCB. |
| | .
|
IMS DC 115
Programming in IMS DC
| 5 | CALL 'CBLTDLI' USING GU-CALL, IO-PCB,
| | MSG-SEG-IO-AREA.
|
| 6 | CALL 'CBLTDLI' USING GU-CALL, DB-PCB,
| | DB-SEG-IO-AREA, SSA-NAME.
| | .
| 7 | CALL 'CBLTDLI' USING ISRT-CALL, ALT-PCB, ALT-MSG-SEG-OUT.
| 8 | GOBACK. |
| 9 | COBOL LANGUAGE INTERFACE |
IMS DC 116
Thanks
IMS DC 117