Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
H
N
T
A
z
. D
H
N
T
A
CIIIdz
q. DHNTA
. CIIId1 (com
pIeLe)
. CIIIdz (compIeLe)
6
.
C
o
m
p
I
e
L
e
PurenL AcLIvILy
1.The first activation of an activity always fires the 'DFHINITIAL' event.
All other events must be created by the activity that expects to handle
them (completion events, input events and timer events).
2.The activity is activated for the first time, defines a child and runs it
async. This fires a second dfhinitial event on the new activity just
created. The event is dispatched to the new child only when the
current activation commits
3.The child executes and completes (in this case after just a single
activation), and so fires its completion event back in its parent.
4.The completion event of child1 is handled and provokes the
definition and activation of a second child. Again, that child performs
its work and completes in a single async task.
5.The completion of the second child provokes a further activation of
the parent. This time no further activities or events are defined, and so
the parent completes and fires its own completion event.
6.The completion event provokes an activation of the grandparent.
24
Activity State-transition diagram
The normal lifecycle would be to be:
Created in the initial state,
Become active via LINK or RUN SYNC
(a brief dormant phase happens if RUN ASYNC is the first
activation)
If waiting for another event then the activity goes dormant
Any event firing will make it active
When there are no outstanding events left unfired, the activity
is complete
When its own parent completes, the activity is deleted.
A dormant activity can be canceled. A complete activity can be
reset and reused.
25
Process and Activity lifecycle
Creation
EXEC CICS DEFINE PROCESS|ACTIVITY
Initialisation
EXEC CICS RUN|LINK PROCESS|ACTIVITY
Progress
EXEC CICS RETRIEVE REATTACH EVENT
External interaction
EXEC CICS DEFINE INPUT EVENT
EXEC CICS ACQUIRE PROCESS|ACTIVITY
Completion
See next chart...
Process Creation
EXEC CICS DEFINE PROCESS
creates a new process and its root activity
Specifies the attributes of the process
tranid (for activations via RUN)
userid ( " " " " )
programname
Definitional attributes are fixed for the lifetime of the process
static relationship to a program
simplifies the dynamics
one program is responsible for handling the events
Once defined the activity can have data associated with it by the
transaction that creates it.
Activity Creation
EXEC CICS DEFINE ACTIVITY
Dynamically builds the tree of activities in the process
Specifies the attributes of the activity
tranid (for activations via RUN)
userid ( " " " " )
programname
Definitional attributes are fixed for the lifetime of the activity
static relationship to a program
26
Activity Completion
When an activity completes, its completion event fires
activity completion is not (necessarily) task end
having nothing left to do...
no input events expected,no incomplete children,no unexpired timers
or failure (transaction abend or rollback)
even if it abends the completion event is guaranteed to
be fired in the parent
a (patented) extension to the transaction model
completion event awakens the parent
parent examines the state of the completed child
A process completes when the root activity completes
The root has no parent - nothing (within the process) to inform
It is up to the process to signal what this means to the outside
world
The set of updates is complete
enterprise data is consistent and shows the results of the
business transaction
The working storage of the process is discarded
its purpose has been fulfilled
space freed in the repository file
27
Dealing with failure
Complete, abended
Even if it abends the completion event is
guaranteed to be fired in the parent
a (patented) extension to the transaction model
Extends the transaction logging
A failed activation completes the activity
Parent is made aware
Parent finds out the completion status of the
child
EXEC CICS CHECK ACTIVITY
returns failure data from the failing activation
abend code, abend program
parent can examine the childs container data as
normal
Parent is able to decide what to do with the
failure
for example, perform some compensation
Re-activation
Completion does not mean destruction
Parents can examine completed children
completion status
output container contents
Parents can 'reuse' child for another piece of work
EXEC CICS RESET ACTIVITY
prepares activity for work again
can update container contents
activity will get DFHINITIAL event again
Useful for 'server' processes
Cancelation
EXEC CICS CANCEL ACTIVITY (or PROCESS)
Will force a premature completion of the activity or process
Committed updates from past activations remain
may need to compensate
Activity can then be destroyed or reused
Destruction
The state of associated with a child Activity is deleted from the repository
file when the parent completes
cleans up the repository file as the process proceeds
28
Container-based programming
29
Container-based programming
Containers can be used instead of COMMAREAs
Containers do not have 32K limits
Containers provide loose-coupling between business logic
programs
Containers allow a greater structuring of the interface
Containers are garbage-collected by the system
they have a well defined lifetime.
Local LINK can pass containers directly from program to
program
Containers are now widespread in the CICS API, not just in BTS.
Containers can be associated with Channels, Processes and
Activities.
Containers are intended to hold data as it is passed from component
to component within an application.
There is a simple core container API PUT, GET, DELETE, MOVE.
The differences between Process or Activity containers and Channel
containers are due to the lifecycles of the objects to which they
belong.
Processes and Activities are persistent, recoverable and event-driven,
so Process and Activity containers are persistent and recoverable.
Channels are non-persistent and non-recoverable, so Channel
containers are non-persistent and non-recoverable.
30
Container-base programming with BTS
Program PAYR
! get the employee passed into this program
EXEC CICS GET CONTAINER('employee') INTO(emp)
:
:
! return the status to the caller
EXEC CICS PUT CONTAINER('status') FROM('OK')
DEFINE ACTIVITY('payroll') PROGRAM('payact')
! create the employee container on the payroll interface
EXEC CICS PUT CONTAINER('employee') ACTIVITY('payroll') FROM('Fred Smith')
! create the wage container on the payroll interface
EXEC CICS PUT CONTAINER('wage') ACTIVITY('payroll') FROM('10 pounds')
! invoke the payroll service passing the payroll interface
EXEC CICS LINK ACTIVITY('payroll')
! examine the status returned on the payroll interface
EXEC CICS GET CONTAINER('status') ACTIVITY('payroll') INTO(status)
Program PAYACT
EXEC CICS RETRIEVE EVENT(...
WHEN('....
EXEC CICS LINK PROGRAM('payt')
1. Parent activity constructs the
containers and invokes the
child activity.
2. Child activity program handles the events
3. Container-aware business logic performs the function
Separating event-handling from business function, allows easier reuse of the function.
A parent activity can use containers to pass input data to a 'service'
(child) activity.
The service activity, being event-driven, handles the event and links to
a container-based piece of primitive business logic. This piece of logic
expects to receive its input and return its output in containers.
If the activity expects to handle multiple events, then it can use
containers to maintain its own internal state.
31
Container-base programming with BTS
Program PAYR
! get the employee passed into this program
EXEC CICS GET CONTAINER('employee') INTO(emp)
:
:
! return the status to the caller
EXEC CICS PUT CONTAINER('status') FROM('OK')
DEFINE ACTIVITY('payroll') PROGRAM('payact')
! create the employee container on the payroll interface
EXEC CICS PUT CONTAINER('employee') ACTIVITY('payroll') FROM('Fred Smith')
! create the wage container on the payroll interface
EXEC CICS PUT CONTAINER('wage') ACTIVITY('payroll') FROM('10 pounds')
! invoke the payroll service passing the payroll interface
EXEC CICS LINK ACTIVITY('payroll')
! examine the status returned on the payroll interface
EXEC CICS GET CONTAINER('status') ACTIVITY('payroll') INTO(status)
Program PAYACT
EXEC CICS RETRIEVE EVENT(...
WHEN('....
EXEC CICS LINK PROGRAM('payr')
++* **+!OlOOBB! .=<=+!O
+O+Y+ Y++ +OBOl++ +OBY<B+O OB Y++
* .* **=+!+OBOl++!
+O+Y+ Y++ I++ +OBY<B+O OB Y++ OlOO
* .* **=+!I++! *
<B+O+ Y++ OlOOBB A+O+<++ OAA<B+ Y+
* ** **+!OlOOBB!
+'<B+ Y++ AYY4A O+Y4OB++ OB Y++ Ol
* < **=+!AYY4A!
.OO+O .*
* ==* **
**+!
* ** .=<=+
4. Another application has its own events, but can
easily reuse the business logic by
using the same containers.
The same piece of container-based primitive business logic can
equally be reused in other process types. The only contract it has with
its caller is the set of events and the names (and formats) of the
containers.
Equally it can be linked to, having a channel passed to it. The core
container commands it uses will detect whether the containers
referred to belong to the current activity or the current channel of the
task.
32
Constructing applications from container-
based components
Program PAYR
! get the employee passed into this program
EXEC CICS GET CONTAINER('employee') INTO(emp)
:
! return the status to the caller
EXEC CICS PUT CONTAINER('status') FROM('OK')
Program cust
! get the customer passed into this program
EXEC CICS GET CONTAINER('customer-name') INTO(cust)
:
! return the status to the caller
EXEC CICS PUT CONTAINER('status') FROM('OK')
Program stock
! get the stock item passed into this program
EXEC CICS GET CONTAINER('serial-number') INTO(serial)
:
! return the status to the caller
EXEC CICS PUT CONTAINER('status') FROM('OK')
DEFINE ACTIVITY('payroll') PROGRAM('payact')
! create the employee container on the payroll interface
EXEC CICS PUT CONTAINER('employee') ACTIVITY('payroll') FROM('Fred Smith')
! create the wage container on the payroll interface
EXEC CICS PUT CONTAINER('wage') ACTIVITY('payroll') FROM('10 pounds')
! invoke the payroll service passing the payroll interface
EXEC CICS LINK ACTIVITY('payroll')
! examine the status returned on the payroll interface
EXEC CICS GET CONTAINER('status') ACTIVITY('payroll') INTO(status)
Program PAYACT
EXEC CICS RETRIEVE EVENT(...
WHEN('....
EXEC CICS LINK PROGRAM('payr')
DEFINE ACTIVITY('payroll') PROGRAM('payact')
! create the employee container on the payroll interface
EXEC CICS PUT CONTAINER('employee') ACTIVITY('payroll') FROM('Fred Smith')
! create the wage container on the payroll interface
EXEC CICS PUT CONTAINER('wage') ACTIVITY('payroll') FROM('10 pounds')
! invoke the payroll service passing the payroll interface
EXEC CICS LINK ACTIVITY('payroll')
! examine the status returned on the payroll interface
EXEC CICS GET CONTAINER('status') ACTIVITY('payroll') INTO(status)
DEFINE ACTIVITY('payroll') PROGRAM('payact')
! create the employee container on the payroll interface
EXEC CICS PUT CONTAINER('employee') ACTIVITY('payroll') FROM('Fred Smith')
! create the wage container on the payroll interface
EXEC CICS PUT CONTAINER('wage') ACTIVITY('payroll') FROM('10 pounds')
! invoke the payroll service passing the payroll interface
EXEC CICS LINK ACTIVITY('payroll')
! examine the status returned on the payroll interface
EXEC CICS GET CONTAINER('status') ACTIVITY('payroll') INTO(status)
Program CUSTACT
EXEC CICS RETRIEVE EVENT(...
WHEN('....
EXEC CICS LINK PROGRAM('payr')
DEFINE ACTIVITY('payroll') PROGRAM('payact')
! create the employee container on the payroll interface
EXEC CICS PUT CONTAINER('employee') ACTIVITY('payroll') FROM('Fred Smith')
! create the wage container on the payroll interface
EXEC CICS PUT CONTAINER('wage') ACTIVITY('payroll') FROM('10 pounds')
! invoke the payroll service passing the payroll interface
EXEC CICS LINK ACTIVITY('payroll')
! examine the status returned on the payroll interface
EXEC CICS GET CONTAINER('status') ACTIVITY('payroll') INTO(status)
Multitude of event-driven applications
Assembled from core pieces of container-based business logic primatives
Program STOCKACT
EXEC CICS RETRIEVE EVENT(...
WHEN('....
EXEC CICS LINK PROGRAM('payr')
High-level, controlling activity programs Low-level (leaf) activity programs
A suite of programs using BTS would be a mixture of primitive
container-based business logic, and some event-driven 'controllers'
that utilise these primitives in interesting ways.
33
Documentation sources
Manual - CICS Business Transaction Services
document Number SC34-5268
BTS Application Programming Guide material
Sample Application description
BTS API Reference
Redbook - Business Process Model Implementation with CICS
Business Transaction Services
document number SG24-5464 (See www.redbooks.ibm.com)
Descriptions of three complete applications
Application Architecture advice
Setup and System Management advice
Sample Application Source shipped with the product
order-entry type application
SupportPac CA1L
34
Summary
Business Transaction Services provides powerful extensions to
the CICS programming model.
BTS is being exploited by IBM in the provision of major
application transformation enablers
Service Flow Runtime
SOAP for CICS
BTS continues to be enhanced.
Providing unique features
35
New options in CICS TS v2 and v3.1
36
CICS BTS enhancements
Introduced primarily to support the SOAP for CICS
Feature
Included in the base for CICS TS 2.3 and v3.1
Available via PTF for CICS TS 2.2
PTF for APAR PQ76073
Performance optimization for simple container-
based applications
Usability for GET CONTAINER INTO
New MOVE container command
37
NOCHECK on DEFINE PROCESS
Avoids use of repository file for simple, single-task processes
Container-based applications using only LINK or RUN SYNC complete in a
single task.
No need to reserve process-name, no need to harden any container or event
state.
NOCHECK option will delay/eliminate writing to repository file.
Eliminate for the simple case of a process completing normally in a single
task
Delay until syncpoint if the process does not complete normally
Significant pathlength and response time improvements for simple BTS
applications
For example, the SOAP for CICS Feature pipeline.
Unnecessary when using Channel Containers in v3
38
NODATA on GET CONTAINER
Applications are normally required to know the
shape of their containers.
LENGERR raised on GET INTO unless the length
is precisely correct.
NODATA option will return the length of the data in
the container without requiring a buffer and suffering
a LENGERR.
EXEC CICS GET CONTAINER(xml-request) FLENGTH(len) NODATA;
EXEC CICS GETMAIN FLENGTH(len);
EXEC CICS GET CONTAINER(xml-request) INTO(request-data);
39
MOVE container
Passing containers from one activity to another can
be useful, but tiresome and inefficient.
MOVE CONTAINER achieve the same result with
one command and no temporary buffer required.
EXEC CICS GET CONTAINER(xml-request) ACTIVITY(transport) SET(req-pointer);
EXEC CICS PUT CONTAINER(xml-request) ACTIVITY(header-parser) FROM(req);
EXEC CICS DELETE CONTAINER(xml-request) ACTIVITY(transport);
EXEC CICS MOVE CONTAINER(xml-request) FROMACTIVITY(transport)
TOACTIVITY(header-parser) AS(xml-request);
40
Any Questions?
41
Thank You for your Attention
Please fill out a session evaluation form