CICS Online Transaction Processing Overview
CICS Online Transaction Processing Overview
CICS What is it ?
1
Introduction to OLTP System
Online Transaction Processing Systems is accepting data from a terminal,
manipulating that data and then sending a message back to the user. All
these usually can be done in a matter of seconds in a well-designed CICS
Systems.
2
Difference Between Online & Batch System
BATCH –
Transactions are accumulated into groups (batches) before processing.
ONLINE – Interactive
Transactions entered one at a time via terminals and processed while you
wait.
3
Batch & Online : differences
4
Introduction to On-Line
5
Online System Considerations
• Ease of Use
• Performance
• File Integrity
• Security
6
Online System Considerations
Ease of Use
Common User Access (CUA)
• Entry Model (Dumb Terminals)
Mainframe CICS, etc.
• Graphical Model (Workstations, PC’s)
Windows, OS/2, etc.
7
Online System Considerations
Performance
Response Time (Measurement)
• Time for screen update to occur
• Factors affecting response time
System load (Number of programs running)
Communication traffic load
Data traffic (Number of I/O operations required)
File activity (Number of files accessed/updated)
8
Online System Considerations
File Integrity
1. Simultaneous file activity
2. Shared files (Batch program ‘owns’ file)
3. Multiple users with conflicting needs
4. File (Record/Block) locking
9
Online System Considerations
Security
Logon Procedure (Name/Password)
Multi-level Security
• RACF Security profile
• Alternate Logon’s (Supervisor, etc)
10
Introduction to CICS
Customer Information Control System
IBM Product of the 70’s (Intro in 1969)
490 of Fortune 500 use CICS
Over 1 billion lines of CICS (COBOL) code
Nearly 15 million CICS terminals
Nearly 1 million CICS programmers
Allows BATCH O/S to handle ONLINE
11
Introduction to CICS
CICS is interface between O/S & program
CICS acts like an Operating System
Manages its own storage
Provides its own file and D/B management
Has its own TASK manager
Runs in its own ADDRESS SPACE
12
CICS Interface
Disk storage
Operating system
Application
programs Data access
(VSAM,DB2,IMS)
CICS
Communication
access
(VTAM, SNA,
TCP/IP)
User interface
CICS
CICS production Batch TSO
test
region Job user
region
More than one CICS system (or region) can run on the
same computer at the same time.
14
CICS Programming Languages
Language Description
COBOL The most used programming language for both batch and online
applications in a mainframe environment.
PL/I You probably won’t find any new program development being done
in PL/I.
Java The newest language for writing CICS applications, Java can also be
used for developing object-oriented classes that access CICS
services.
15
Terminal Networks
16
3270 Information Display system
3270 display
IBM 3x74
controller
3270 display
S/390
mainframe
LAN/
WAN
Internet/
3270 display Intranet
PC 3270 PC 3270
emulation emulation
17
CICS Fundamentals
18
How Multitasking works
Within CICS, two or more tasks can execute at the same time using a CICS
feature called multitasking
19
How Multithreading works
CICS address space
User 1
Working
storage
User 5
User 1
User 5
Working
storage
With multithreading, two or more users can access the same copy of a
program at the same time. CICS accomplishes this by providing a
separate copy of working storage for each user running the program
20
CICS Fundamentals (contd.)
21
How conversational programming works
A conversational program is an online
program that sits idle while it waits for user Start
input
Send
first
While a conversational program waits for map
Receive
map
Process
data
Send
map
22
How pseudo-conversational programming works
Wait
A pseudo-conversational program ends Start for Start
input
after it sends data to a terminal, and
some of the resources used by the Send
End?
Yes
first End
program are released map
No
Receive
End
CICS restarts the program when the user map
A pseudo-conversational program
Send
map
23
How CICS invokes an application program
PCT
Transaction Program
CICS locates DM01 DMPGM01
trans-id ORD1 DM01 DMPGM02
in the Program MMA1 MMAPGM1
Control Table ORD1 ORDPGM1
ORD2 ORDPGM2
PPT
Program Location
CICS locates
program DMPGM01 In storage
ORDPGM1 in the DMPGM02 On disk
Processing MMAPGM1 In storage CICS address space
Program Table ORDPGM1 On disk
ORDPGM2 On disk
DMPGM01
24
CICS Services
Three main categories of CICS Services:
Data Communications Services
Data Management Services
CICS Management Services
25
CICS Services (contd.)
Data Communication Services
Basic mapping Support (BMS)
• Assembler program to handle screen formats.
Terminal Control
• Interface with VTAM
• Send/Receive text to/from terminal
26
Basic Mapping Support-Objectives
To simplify the development and maintenance of terminal oriented
application systems.
Using Formatted Screens
• Field justification
• Field padding
• Provide Attributes for fields
27
Formatted Screens
28
Physical Maps
Physical map contains the display format for the map, for a given terminal,
available as a load library member.
Length and location
Attributes
Constants
Device characteristics
29
Symbolic Maps
Symbolic map contains all variable data which is copied into programs
working storage section, available as copy library member.
30
MAP & MAPSET
MAP
is a single screen format
MAPSET
is a collection of maps link edited together to create a load module.
should have a PPT entry.
Naming
1 to 7 chars of generic name for maps and map sets
1 char added by CICS.
31
BMS Assembly Language Program
32
BMS Macros
DFHMSD (Mapset definition)
DFHMDI (Map definition)
DFHMDF (Map Field definition)
33
DFHMSD Parameters (to define a MAPSET)
TYPE=DSECT/MAP/&&SYSPARM/FINAL
MODE=IN/OUT/INOUT
LANG=ASM/COBOL/PL1
STORAGE=AUTO/BASE=name
CTRL=(PRINT,FREEKB,ALARM,FRSET)
TERM=terminal type, SUFFIX=n
TIOAPFX=YES/NO
MAPATTS=(COLOR,HIGHLIGHT,.......)
DSATTS=(COLOR,HIGHLIGHT,.......)
COLOR=DEFAULT/ colour
HIGHLIGHT=OFF/BLINK/REVERSE/UNDERLINE
34
Example of DFHMSD
DFHMSD TYPE=&&SYSPARM, X
CTRL=(FREEKB,FRSET), X
LANG=COBOL, X
STORAGE=AUTO, X
TIOAPFX=YES, X
MODE=INOUT, X
TERM=3270
DFHMSD TYPE=FINAL
END
35
DFHMDI Parameters
SIZE=(LINE,COLUMN)
LINE=line-number
COLUMN=column-number
JUSTIFY=left/right
36
Example of DFHMDI
37
DFHMDF Parameters
POS=(line, column)
LENGTH=number
INITIAL=‘text’
JUSTIFY=(LEFT/RIGHT,BLANK/ZERO)
ATTRB=(ASKIP/PROT/UNPROT, NUM, BRT/NORM/
DRK, IC, FSET)
COLOR=DEFAULT/colour
HIGHLIGHT=OFF/BLINK/REVERSE/UNDERLINE
PICIN=‘value’
PICOUT=‘value’
OCCURS=n
38
Example of DFHMDF
39
MDT - Modified Data Tag
Used to know whether the field is modified by the user or not. The field is
only receivable if it has been modified.
40
FORMAT OF SYMBOLIC MAP
When performing INPUT functions fields suffixed with ‘L’, ’F’ and ‘I’ are
meaningful
When performing OUTPUT functions fields suffixed with ‘A’, and ‘O’ are
meaningful
41
Data Management
The core portion or Nucleus of CICS consists of IBM supplied control
programs and corresponding user defined CICS control tables.
CICS control programs perform their primary task based on the entries in the
corresponding user defined CICS control tables.
Programmers can modify the control table entries depending on requirement.
42
Control Programs Control Tables
43
CICS Control Programs and Tables
PPT = Processing Program Table
List of all valid program names
Used by CICS to determine if in storage.
IF not in storage, CICS loads NEW COPY
Tables created by programmer with CEDA
RDO = Resource Definition Online – CEDA
Files defined in FCT
FCT = File Control Table
List of available files, status, type, security
44
Basic CICS Commands
General Structure:
EXEC CICS
CICS COMMAND
OPTION (value) …
(Parameters as needed)
END-EXEC
45
Program Control Commands
EXEC CICS
LINK PROGRAM(name)
[ COMMAREA (data-area) ]
[ LENGTH (data-value) ]
END-EXEC
NOTE: Program name must be in PPT.
Works like COBOL PERFORM statement.
46
Program Control Commands
EXEC CICS
XCTL PROGRAM(name)
[ COMMAREA (data-area) ]
[ LENGTH (data-value) ]
END-EXEC
NOTE: Program name must be in PPT.
47
Program Control Commands
EXEC CICS
RETURN [ TRANSID (name) ]
[ COMMAREA (data-area) ]
[ LENGTH (data-value) ]
END-EXEC
48
XCTL Vs LINK
XCTL does not expect • LINK expects control back and hence
control back and hence less the overhead is more in this case on
overhead on system memory etc.
resources like memory etc.
49
CALL Vs XCTL/LINK
Link edited along with the • Separately compiled and
main module.
link edited.
Higher module size and
higher memory •Single copy be shared.
requirement.
Dynamic loading may slow
Single copy can not be down execution speed.
used.
• Changes in this will not
Any changes in this require
compiling of all other effect other modules using
modules using this. this.
A Called program remains • A LINKed or XCTLed
in the last used state after it
returns control. program always brings a
NEW copy.
50
COBOL Considerations
Identification Division.
No differences
Environment Division
MUST be EMPTY in CICS Program!
No SELECT statements allowed!
Data Division
No FILE SECTION – (No SELECTS)
51
COBOL Considerations (More)
Data Division
WORKING-STORAGE SECTION.
• Switches, Flags, Variables, Records, etc.
• You get ‘fresh’ copy each time program loaded!
LINKAGE SECTION (New Item!!)
• DFHCOMMAREA defined or CICS will!
• Used to receive data from CICS.
• CICS also inserts EIB Block definition
52
COBOL Considerations (More)
Procedure Division
Uses most COBOL statements
• OPEN, CLOSE, and non-CICS READ & WRITE statements are not permitted.
File management is handled by CICS
• Many COBOL features should be avoided like internal sorts, using special registers,
ACCEPT, DISPLAY, EXHIBIT, TRACE, STOP RUN, & GOBACK. (STOP RUN &
GOBACK are sometimes included in order to eliminate a compiler diagnostic but never
executed
53
LINKAGE SECTION
Used to access data left by previous execution of a program
Data should be moved to your W/S!
Each execution starts with initial W/S
Define COMMAREA in Working-Storage
DEFINE DFHCOMMAREA in Linkage
RETURN references Working-Storage
54
Fields in the EXEC Interface Block (not all)
01 DFHEIBLK.
.
.
02 EIBCALEN PIC S9(4) COMP.
02 EIBAID PIC X(1).
.
.
Description
The Execute Interface Block (EIB) is a CICS area that contains information related
to the current task. The definition of this area is inserted into the Linkage Section of
the program when the program is prepared for execution
The EIBCALEN field contains the length of the data passed to the program through
its communication area (DFHCOMMAREA)
The EIBAID field indicates the AID key the user pressed to restart the program
55
EXEC Interface Block
56
EIB Useful Fields
57
DEBUGGING EIB FIELDS
EIBFN Last CICS Command
EIBRESP Completion Status
EIBRESP2 More Completion Status
EIBRCODE Response Code (OLD)
EIBRSRCE Recent Resource Name
MAP Map Name
PRG CTL Program Name
FILE CTL Data Set Name
58
Basic CICS Commands
EXEC CICS
RETURN [ TRANSID (name) ]
[ COMMAREA (data-area) ]
[ LENGTH (data-value) ]
END-EXEC
Length – PIC S9(4) COMP or Literal
59
Basic CICS Commands
EXEC CICS
SEND MAP (name)
[ MAPSET (name) ]
[ FROM (data-area) ]
[ MAPONLY | DATAONLY ]
[ ERASE | ERASEUP ]
[ CURSOR [ (value) ] ]
END-EXEC
60
Basic CICS Commands
EXEC CICS
SEND MAP (name)
[ MAPSET (name) ]
[ FROM (data-area) ]
[ MAPONLY | DATAONLY ]
[ ERASE | ERASEUP ]
[ CURSOR [ (value) ] ]
END-EXEC
61
Basic CICS Commands
EXEC CICS
RECEIVE MAP (map-name)
[ MAPSET (mapset-name) ]
INTO (data-area)
END-EXEC
62
Basic CICS Commands
EXEC CICS
READ DATASET (filename)
INTO (data-area)
RIDFLD (data-area)
[ RRN | RBA ]
[ UPDATE ]
END-EXEC
63
Basic CICS Commands
EXEC CICS
WRITE DATASET (filename)
FROM (data-area)
RIDFLD (data-area)
[ RRN | RBA ]
END-EXEC
64
Basic CICS Commands
EXEC CICS
REWRITE DATASET (filename)
FROM (data-area)
END-EXEC
NOTES:
Record MUST be READ with UPDATE!
data-area - NOT have to match Read
65
Basic CICS Commands
EXEC CICS
DELETE DATASET (filename)
[ RIDFLD (data-area) ]
[ RRN | RBA ]
END-EXEC
66
Basic CICS Commands
EXEC CICS
UNLOCK DATASET (filename)
END-EXEC
67
Some useful CICS commands
ASKTIME updates the EIBDATE and EIBTIME which initially contained the
information about when the task started as well as populates the data_area
with the current date and time.
68
Some useful CICS commands
FORMATTIME converts the absolute date and time normally produced for
CICS ASKTIME into any one of a number of the optional formats using the
ABSTIME data_area.
69
Exception Conditions
70
Checking for Exceptions
ALL CICS Commands allow RESP Parm
01 RESP-CODE PIC S9(8) COMP.
IF RESP-CODE = DFHRESP(NORMAL)
MOVE ‘Y’ TO OK-COMMAND
ELSE
IF RESP-CODE = DFHRESP(NOTFND)
MOVE ‘N’ TO REC-NOT-FOUND
ELSE
PERFORM DISPLAY-MISC-ERROR
END-IF
END-IF
71
Preventing File Corruption
PREVENT
Add ‘busy’ flag in record (Special Maint)
All programs MUST follow procedure
Extra I/O required (to Set/Reset flag)
DETECT
Save copy and compare before updating
OR – Add Maint -Timestamp and check it
Notify User to get latest version of data
72
Avoiding Deadlock
Sometimes called ‘Deadly Embrace’
73
CICS Program Design
Event-driven design
Structure Chart - Consider All Functions
Identify Events and Context
Any action that starts program
List All (Valid) Possible User Actions
Design Appropriate Response
Processing required for an event
Managing user interaction
74
An chart for, customer inquiry program event/response
Event Response
76
CICS Program Design
COMMAREA usually stores ‘context’
Get Key
Add Customer
Change Customer
Delete Customer
77
Sample CICS COBOL Program
WORKING-STORAGE SECTION.
Switches, Flags, and Misc Variables
COMMUNICATION-AREA (Your copy!)
RESPONSE-CODE PIC S9(08) COMP.
RECORD Descriptions
COPY Library for MAP
Other COPY Members as needed
78
Sample CICS COBOL Program
LINKAGE SECTION.
DFHCOMMAREA PIC X(nnn).
If you don’t code it, CICS Will!
The commarea (if any) placed here!
EIBCALEN gives length of commarea
0 (ZERO) means there is NO commarea
79
Sample CICS COBOL Program
Sample CICS COBOL Program
PROCEDURE DIVISION
IF first-time
SEND Initial-Map
ELSE
IF <ENTER>
Process Screen
ELSE
Process Function-Key
END-IF
END-IF
SEND MAP
80
Sample CICS COBOL Program
PROCEDURE DIVISION
EVALUATE TRUE
WHEN EIBCALEN = 0
First time in Program
WHEN EIBAID = DFHENTER
Process Screen
WHEN EIBAID = DFHPF3 or DFHPF12
Exit Program
WHEN OTHER
Invalid key
END-EVALUATE
81
HANDLE CONDITION
• Common CONDITIONS
EXEC CICS
HANDLE CONDITION
MAPFAIL(500-NO-DATA)
DUPREC(600-DUPLICATE)
NOTOPEN
END-EXEC
NOTE: Condition by itself will nullify it!
83
RESPONSE CHECKING (NEW!)
84
HANDLE CONDITION (Notes)
Not an executable command
Establishes paragraph to correct error
Can issue multiple times
Last one executed is in effect
Causes ‘GO TO’ to paragraph named
Done BEFORE CICS Command executed
85
Strange Exception - MAPFAIL
MAPFAIL Condition
Raised by RECEIVE MAP with no data
• User entered no data but pressed AID key
• User pressed CLEAR key or PA key
86
Eight-step procedure for developing a CICS program
Implementation
3. Prepare the BMS map set
4. Code the program
5. Prepare the program for execution
6. Create the necessary CICS table entries
7. Test the program under CICS
Documentation
8. Document the program
87
Program Preparation
Before you compile a CICS program, you
must translate it Source program
Load module
88
Write CICS Program Using VSAM
89
Types of VSAM Files
90
How to Use ?
Create a VSAM cluster using JCL.
Enter data into it. (Using REPRO)
Make FCT entry with a symbolic file name for the file created.
Use symbolic file name in the program.
91
READ
92
READ Continues...
93
WRITE
94
REWRITE
95
DELETE
Read the record with UPDATE option and then delete it with the following
command.
EXEC CICS DELETE
FILE(‘EMPFILE’)
END-EXEC.
Use the following command to delete the record directly.
MOVE ‘12345’ TO EMP-REC-KEY.
EXEC CICS DELETE
FILE(‘EMPFILE’)
RIDFLD (EMP-REC-KEY)
END-EXEC.
96
GROUP DELETE
MOVE ‘11’ TO WS-EMP-REC-KEY.
MOVE 2 TO WS-EMP-KEY-LEN.
EXEC CICS DELETE
FILE (‘EMPFILE’)
RIDFLD (WS-EMP-REC-KEY)
KEYLENGTH (WS-EMP-KEY-LEN)
GENERIC
NUMREC (WS-NUM-REC-DEL)
END-EXEC.
97
Some important bullets
Exclusive control on CI.
98
Browsing
» STARTBR
» READNEXT
» READPREV
» RESETBR
» ENDBR
99
STARTBR
This establishes a browse session.
EXEC CICS STARTBR
FILE (‘EMPFILE’)
RIDFLD (EMP-REC-KEY)
KEYLENGTH(KEY-LEN)
GTEQ/EQUAL/GENERIC
END-EXEC.
100
READNEXT/READPREV
EXEC CICS READNEXT/READPREV
FILE (‘EMPFILE’)
INTO (EMP-REC)
LENGTH (EMP-REC-LEN)
RIDFLD (EMP-REC-KEY)
END-EXEC.
101
RESETBR
102
ENDBR
End browse operation
103
Temporary Storage
COMMAREA (Communication Area)
CWA (Common Work Area)
TWA (Transaction Work Area)
TSQ (Temporary Storage Queue)
TDQ (Transient Data Queue)
104
Temporary Storage Continues...
COMMAREA
It can be used to transfer data from one program to another in a
transaction or from one transaction to another in an application.
CWA
There is only one CWA in a system. Any transaction in the system can
access this area, and hence the format and use of it must be agreed
upon by all transactions in the system.
105
Temporary Storage Continues...
TWA
The TWA exists only for the duration of a transaction. Hence it
can be used to for forwarding data among programs in a
transaction.
TSQ
It can be created and removed dynamically in a program.
It can be read and written sequentially or randomly.
Records can be added or modified.
Can be kept in Main memory for faster access. In this case
recovery is not possible.
106
Temporary Storage Continues...
107
TSQ Commands (Write)
WRITEQ TS
EXEC CICS WRITEQ TS
QUEUE (‘TRG4321A’)
FROM (TSQ-REC)
LENGTH (TSQ-LENGTH)
ITEM (TSQ-REC-NUM)
END-EXEC.
108
TSQ Commands (Read)
READQ TS
EXEC CICS READQ TS
QUEUE (‘TRG4321A’)
INTO (TSQ-REC)
LENGTH (TSQ-LENGTH)
ITEM (TSQ-REC-NUM)
END-EXEC
109
TSQ Commands (delete)
DELETEQ TS
EXEC CICS DELETEQ TS
QUEUE (‘TRG4321A’)
END-EXEC.
110
TDQ Command (Write)
WRITEQ TD
EXEC CICS WRITEQ TD
QUEUE (‘XXXX’)
FROM (TDQ-REC)
LENGTH (TDQ-LENGTH)
RESP(WS-RESP)
END-EXEC.
111
Difference between TSQ and TDQ
TDQ •TSQ
TDQ is read destructive. • TSQ is not read destructive
• TSQ can be created dynamically.
TDQ cannot be created
dynamically. • TSQ is temporary in nature (i.e. it
will be deleted when the program
finishes execution, unless it is made
TDQ is not temporary in permanent by making a entry in the
nature. Temporary Storage Table).
Can be intra / extra partitioned.
• Only intra-partitioned
Can be used for input or output • Can be used for input / output
and not both
112
Thanks
Question ?
113