The new Debug Profile Service introduced in IBM z/OS Debugger v14.2 lets you manage debug profiles for both CICS and non-CICS applications with a set of REST API. Using a REST API, it is now possible to integrate debug profile management into your DevOps pipeline.
For more information on the API, please refer to the following IBM Knowledge Center link:
Managing Debug Profiles
Here are some examples on how you would use the API to manipulate debug profiles. There are many tools available for interacting with a REST API, but in the following examples, we will use the UNIX cURL command line tool to call the API to setup a debug profile.
To query if there’s an existing CICS debug profile belonging to user ekwok in region S07CICPW:
curl -u ekwok “http://tlba07me:8180/api/v1/profile/dtcn/ekwok?region=s07cicpw”
The use of the json.tool python module is optional. In these examples it is only used to “pretty print” the JSON output.
To replace the profile with a new one, you would first delete it with:
curl -u ekwok -X DELETE http://tlba07me:8180/api/v1/profile/dtcn/ekwok?region=s07cicpw
then recreate the profile by sending a well-formed JSON text using the API. With cURL, this is easier done by putting the JSON in a text file:
curl -u ekwok -X POST “http://tlba07me:8180/api/v1/profile/dtcn/ekwok?region=s07cicpw” -d @cics.json -H “Content-type: application/json”
Generating code coverage for CICS transactions
Let’s say you want to capture code coverage data for your CICS transaction, but don’t want to use the DTCN transaction or the Remote CICS Application debug launch configuration in IDz to set up a profile, you can now use the Debug Profile Service API to do that.
First you will need to start the headless code coverage collector on your workstation:
codecov -startdaemon -port=8006 -savesource -zipresult
In this example the collector is listening for connections on port 8006. To turn the debug profile setup in the previous example to capture code coverage, update the profile with the right EQA_STARTUP_KEY and port number:
curl -u ekwok -X PUT “http://tlba07me:8180/api/v1/profile/dtcn/ekwok?region=s07cicpw” -d @cc.json -H “Content-type: application/json”
Run the transaction as you normally would and the result will be saved on your workstation: