CICS / WebSphere

 

 

Within our function, we create an object called jsonInputMessage. The first three elements define the type of request we’re making and include the uniform resource identifier (URI) we want to make the request against. This corresponds to the URIMAP resource we created when we performed step 3 earlier, and is defined at the time we run DFHLS2JS as part of step 2.

The final part of our jsonInputMessage are the parameters we want to pass to our COBOL service. You will notice that we’ve defined only the first of the two fields that appear in the COBOL copybook. This is possible because the PIPELINE inserts blanks for character fields that aren’t supplied as input; other fields, such as numerics, require you to supply a default value to prevent a conversion error from occurring.

The final line of code causes the Worklight server to invoke our CICS COBOL service, passing in the jsonInputMessage we’ve constructed. This sends the JSON message to CICS where the PIPELINE processes the input data and invokes the COBOL service, passing in the appropriately formatted data to match the copybook we supplied. The result from the CICS application is returned to the Worklight Server in JSON format, which sends the result back to the client application. It really is that simple! If you want to try it for yourself, you can download the Genapp support pack, which has a more complete sample based on an insurance application. In the resource list at the end of this article, you will find a link to a YouTube video of the insurance demo.

Other Things You Can Do With the Feature Pack
In addition to the DFHLS2JS assistant described earlier, a second assistant, DFHJS2LS, allows you to create the language structure from an existing JSON schema. This lets you expose CICS services using a RESTful architectural pattern, or to use an existing JSON format as an interface to CICS applications.

The feature pack also provides a linkable interface, DFHJSON, that lets you transform data from a binary format into JSON, and vice versa. This enables existing applications to start utilizing JSON-based data, converting it into structured binary data, or to create a JSON message from structured data that could be used to call an existing JSON service hosted elsewhere within your organization. To use this feature you need to have an AXIS 2 JVM server running.

Conclusion
The CICS TS Feature Pack for Mobile Extensions V1.0 brings JSON and RESTful capabilities to CICS, building on the powerful Web service technology CICS offers. As we’ve shown, it’s an easy process that will immediately be familiar to those who have used CICS Web services in the past, and for those who are new, it really is simple to get started. 

The feature pack is more than just a mobile enabler, as it offers you a simple, yet powerful, callable interface for transforming language structures into JSON and vice versa, further extending the options available for enhancing your existing enterprise applications.

Resources
• This article on IBM developerWorks describes the basic process for connecting a Worklight application to a JSON service, which could be CICS: https://ibm.biz/BdRzRj.
• The Worklight online documentation has a wealth of useful tutorials and details and is available at www.ibm.com/developerworks/mobile/worklight/getting-started.html.
• CICS Mobile video: www.youtube.com/watch?v=6TkQ9PzeevQ.

4 Pages