CICS Transaction Server V5.1 introduced the capability to combine and manage multiple disparate application resources as a single entity, which can be versioned and moved rapidly through the development, test, and production lifecycle. Dependency management is handled, and you can measure entire applications for resource use and internal billing. You can also dynamically manage applications by applying policies during run time.
CICS Transaction Server V5.2 builds on this functionality by introducing the concept of application multi-versioning. While user requests are being routed to the old version, a new version of the application can be installed. Once the new version of the application has been confirmed as being properly ENABLED, i.e. all dependencies satisfied, resources enabled and entry points declared across all the regions on the platform; then user requests can be routed to the new version by changing the state of the application to AVAILABLE.
For more information on the lifecycle around applications, check out Matthew Webster's blog articles on the topic:
Making an Application AVAILABLE
To move an enabled application into the AVAILABLE state, open up the Cloud Explorer view in the CICS Explorer application and use the GUI menu options to "Make Available" the installed application resource. For more information on the procedure used, see the "Working With Applications" section in the IBM Knowledge Center:
Note there's a tip in the Knowledge Center which states the following:
Tip: The availability status of a CICS bundle is not restored if you start or restart a CICS region in the platform after the time when you make available the CICS bundle, or the application containing it. When you have verified that the application has been installed and enabled correctly in the started or restarted CICS region, select the appropriate version and make it available in the CICS region.
This can pose a problem in automated environments where a human operator may not be present to manually make applications available when a CICS region restarts. Fortunately we can use the CPSM API to perform the same task by running a simple CICS program - a task which is easily automated.
Sample COBOL Program
We are exploiting CICS TS V5.2 functionality in this program, so the application should be compiled using CICS TS V5.2 libraries. The program runs within the CICS environment and if you are using the integrated translator, should have the CICS('CPSM') option enabled in the compiler, with your SEYUCOB dataset defined in the SYSLIB concat.
To linkedit, you should include both SDFHLOAD and SEYULOAD datasets in the SYSLIB concat, with the following SYSLIN definitions in place:
MODE AMODE(31) RMODE(ANY)
The resulting program should then be made available to CICS in the DFHRPL concat, or a separate library, and appropriate transaction and program resources defined. The APPLACTV program is only required to be defined in one region within the CICSplex.
The example COBOL program has the following logic:
Establish a connection to CPSM
Query CPSM to provide a result set containing all applications installed in the CICSplex
Fetch each of the applications in turn, and perform the SET AVAILABLE action on them
Prior to running the application, we have the following display in the CICS Explorer:
Note that we have three applications installed and ENABLED, but are all in the UNAVAILABLE state.
Now we can run the sample application, which produces the following output:
Connecting to CPSM...
Get The APPLCTN resource table...
Fetching 3 APPLCTN Entries...
After the program has completed execution, we can refresh the view in Explorer, to find the applications are all now AVAILABLE:
During CICS initialization, bundles are installed after the majority of the startup processing takes place: this means that we cannot add our program to the PLT (either first phase or second phase) as a simple solution.
As an alternative, if we define a transaction which runs the application, and the appropriate CICS console definitions, then we can invoke the transaction from an MVS console using your standard automation techniques. For example, we could define the CICS transaction APPL which will run the program APPLACTV. By issuing the MVS command:
we can then execute the program, and hence automate the processing from start to finish.
For simplicity, in the sample code all of the applications installed in the CICSplex are queried, and the SET AVAILABLE action is performed on them without any checking. In a more robust application, you may wish to extend the processing to:
filter the applications to limit the scope of the operation
verify each application is fully enabled before attempting to make the application available
provide some wait and retry logic to cope with a CICS region which takes longer to start than expected
The CICS Explorer provides a high-level, easy-to-use environment for the administration of CICS and cloud applications. Using a very small amount of application code, we have seen how we can programmatically make a set of applications available and open for business in situations where use of the Explorer is not appropriate.
This programmatic interface can be invoked as a CICS transaction from an MVS console, and therefore allows for CICS applications to be made AVAILABLE in a completely automated way, as part of your regular CICS region startup processing.
You can find the source of the sample application here: https://www.ibm.com/developerworks/community/blogs/cicsdev/resource/Application_AVAILABLE_Sample_Code.zip