Scenario 3: Coordinating Resources
The following scenario shows how an assembler program can make updates to three files using a protected conversation.
The application, CRREXMP1, running in Virtual Machine 1, has access to two files, CHILDS LIST and TOYSTORE ORDERS. These files are located in two different SFS directories, CRRDIR1 and CRRDIR2, respectively. The application, CRREXMP2, running on Virtual Machine 2, has access to one file, SANTAS SACK, which is located in the SFS directory CRRDIR3.
Imagine that one virtual machine is operated by a child entering a Christmas list at a local toy store. The other virtual machine are handled by one of Santa's elves at the North Pole. As the child enters the toys, CRREXMP1 updates its two files, CHILDS LIST and TOYSTORE ORDER. CRREXMP1 then establishes a protected conversation to CRREXMP2 (at the North Pole). CRREXMP1 will send the list of toys to be added to the list Santa will bring the child (SANTA SACK). If CRREXMP2 is successful in updating its file (it will first have to see if the child has been naughty or nice), it will request that the updates be committed. Otherwise, it will request that the updates be rolled back.
- z/VM: CMS Macros and Functions Reference for CMSIUCV and HNDIUCV macros
- z/VM: CP Programming Services for APPCVM and IUCV macros in z/VM®.
Sequence of Instructions for Updating Multiple Files
CRREXMP1 CRREXMP2
1 HNDIUCV SET 1 HNDIUCV SET
2 DMSSSPTO
3 DMSSETAG
4 DMSOPEN CHILDS LIST
5 DMSWRITE CHILDS LIST
6 DMSCLOSE CHILDS LIST
7 DMSOPEN TOYSTORE ORDERS
8 DMSWRITE TOYSTORE ORDERS
9 DMSCLOSE TOYSTORE ORDERS
10 APPCVM CONNECT SYNCLVL=SYNCPT, MF=L
11 CMSIUCV CONNECT
12 IUCV ACCEPT (MF=L)
13 CMSIUCV ACCEPT
14 APPCVM SENDCNF
15 APPCVM RECEIVE
16 APPCVM SENDCNFD
17 APPCVM SENDDATA
18 APPCVM RECEIVE TYPE=RECEIVE
19 APPCVM RECEIVE
20 APPCVM SENDCNFD
21 DMSSPTO
22 DMSSETAG
23 DMSOPEN SANTAS SACK
24 DMSWRITE SANTAS SACK
25 DMSCLOSE SANTAS SACK
26 CMSIUCV QCMSWID 26 CMSIUCV QCMSWID
*************************************************************
* One of three things can happen at this point: *
* 1. Both applications roll back the updates (steps 27-35).*
* 2. Both applications commit the updates (steps 36-42). *
* 3. One application tries to commit the updates but the *
* other one rolls back (steps 43-52). *
*************************************************************
Both CRREXMP1 and CRRECXP2 roll back updates
27 DMSROLLB
28 APPCVM RECEIVE
29 DMSROLLB
30 APPCVM SEVER MF=L
31 CMSIUCV SEVER
32 APPCVM RECEIVE
33 APPCVM SEVER MF=L
34 CMSIUCV SEVER
35 HNDIUCV CLR 35 HNDIUCV CLR
Both CRREXMP1 and CRREXMP2 commit updates
36 APPCVM SETMODFY TYPE=SEVER
37 DMSCOMM
38 APPCVM RECEIVE
39 DMSCOMM
40 APPCVM SEVER MF=L 40 APPCVM SEVER MF=L
41 CMSIUCV SEVER 41 CMSIUCV SEVER
42 HNDIUCV CLR 42 HNDIUCV CLR
CRREXMP2 commits updates and then CRREXMP1 rolls back the updates
43 APPCVM SETMODFY TYPE=SEVER
44 DMSCOMM
45 APPCVM RECEIVE
46 DMSROLLB
47 APPCVM SEVER MF=L
48 CMSIUCV SEVER
49 APPCVM RECEIVE
50 APPCVM SEVER MF=L
51 CMSIUCV SEVER
52 HNDIUCV CLR 52 HNDIUCV CLR
The following list explains the outline of instructions shown in Sequence of Instructions for Updating Multiple Files.
- Both CRREXMP1 and CRREXMP2 assembler programs identify the program name to CMS with HNDIUCV SET.
- DMSSSPTO sets the synchronization point options.
- DMSSETAG sets the transaction tag.
- DMSOPEN opens the CHILDS LIST file in the SFS directory, CRRDIR1.
- DMSWRITE writes to the CHILDS LIST file.
- DMSCLOSE with NOCOMMIT option closes the CHILDS LIST file.
- DMSOPEN opens the TOYSTORE ORDERS file in the SFS directory, CRRDIR2.
- DMSWRITE writes to the TOYSTORE ORDERS.
- DMSCLOSE with NOCOMMIT option closes the TOYSTORE ORDERS file.
- APPCVM CONNECT MF=L formats APPC/VM parameter list for connect.
- CMSIUCV CONNECT connects to CRREXMP2 with the APPC/VM parameter list
- IUCV ACCEPT MF=L formats the IUCV parameter list for ACCEPT.
- CMSIUCV ACCEPT accepts CRREXMP1's connection.
- APPCVM SENDCNF ensures that CRREXMP2 has received allocation.
- APPCVM RECEIVE gets confirmation request.
- APPCVM SENDCNFD responds to the confirmation request.
- APPCVM SENDDATA sends the data record to CRREXMP2.
- APPCVM RECEIVE TYPE=RECEIVE to confirm and enter receive state.
- APPCVM RECEIVE receives the data record and CRREXMP's request to enter receive state.
- APPCVM SENDCNFD confirms CRREXMP1's state request.
- DMSSSPTO sets synchronization point options.
- DMSSETAG sets the transaction tag.
- DMSOPEN opens SANTAS SACK file in the SFS directory, CRRDIR3.
- DMSWRITE writes to SANTAS SACK.
- DMSCLOSE with NOCOMMIT option closes SANTAS SACK.
- CMSIUCV QCMSWID determines workunitid for APPC/VM paths.*
************************************************************** * One of three things can happen at this point: * * 1. Both applications roll back the updates (steps 27-35). * * 2. Both applications commit the updates (steps 36-42). * * 3. One application tries to commit the updates but the * * other one rolls back (steps 43-52). * **************************************************************
- Both CRREXMP1 and CRREXMP2 roll back updates
- DMSROLLB initiates rollback processing for returned workunitid.
- APPCVM RECEIVE receives the rollback indication.
- DMSROLLB performs rollback processing for returned work.
- APPCVM SEVER MF=L formats APPC/VM parameter list for sever abend.
- CMSIUCV SEVER severs the protected conversation with the partner.
- APPCVM RECEIVE gets the sever indication.
- APPCVM SEVER MF=L formats the APPC/VM parameter list for normal sever
- CMSIUCV SEVER severs local path for protected conversation.
- Both CRREXMP1 and CRREXMP2 assembler programs notify CMS that
the program is complete with HNDIUCV CLR.
- Both CRREXMP1 and CRREXMP2 commit updates
- APPCVM SETMODFY TYPE=SEVER severs the conversation after a successful sync point.
- DMSCOMM initiates commit processing for the returned workunitid.
- APPCVM RECEIVE receives the commit request indication.
- DMSCOMM performs commit processing for returned workunitid.
- APPCVM SEVER MF=L formats the APPC/VM parameter list for normal sever.
- CMSIUCV SEVER severs the local path for the protected conversation.
- Both CRREXMP1 and CRREXMP2 assembler programs notify CMS that
the program is complete with HNDIUCV CLR.
- CRREXMP2 commits the updates and then CRREXMP1 rolls back the updates
- APPCVM SETMODFY TYPE=SEVER severs the conversation after a successful sync point.
- DMSCOMM initiates commit processing for returned workunitid.
- APPCVM RECEIVE receives the commit request indication.
- DMSROLLB performs rollback processing for returned workunitid. This causes the updates made by CRREXMP1 and CRREXMP2 to be rolled back.
- APPCVM SEVER MF=L formats the APPC/VM parameter list for sever abend.
- CMSIUCV SEVER severs the protected conversation with CRREXMP1.
- APPCVM RECEIVE gets the sever indication.
- APPCVM SEVER MF=L formats the APPCVM parameter list for normal sever.
- CMSIUCV SEVER severs the local path for the protected conversation.
- Both CRREXMP1 and CRREXMP2 assembler programs notify CMS that the program is complete with HNDIUCV CLR.