Writing a program to supply Atom entry data
You can write a service routine to provide an Atom feed from any data that can be accessed by a CICS program, such as records from a DB2 database, records in a file, or a COMMAREA. These instructions tell you how to write a program that responds to HTTP GET requests for an Atom feed.
About this task
Web clients might request a number of Atom entries from a feed, or request a specific entry. CICS receives the requests from web clients, and links to the program with information about each client request. CICS links to the program once for each Atom entry that the client requests, and the program returns a single entry each time.
The program supplies the Atom entry using data that it has extracted from a record in the resource, such as a database or file, that holds the data for the Atom entries for this feed. For an overview of this process, see Data processing for Atom feeds from CICS.
CICS uses a container interface to communicate with the service routine. Use the EXEC CICS GET CONTAINER and EXEC CICS PUT CONTAINER commands to interact with the containers. The C language sample service routine DFH$W2S1 shows you how to use the containers to respond to HTTP GET requests. The COBOL sample service routine DFH0W2F1 also shows you how to use the containers, but be aware that the DFH0W2F1 sample is more complex because it responds to HTTP PUT, POST, and DELETE requests as well as GET requests.
Because the web client request is an HTTP request, you can also interact with it using the CICS web API commands, such as the WEB READ HTTPHEADER and WEB READ QUERYPARM commands. If you know how to use these commands, you may use them in the service routine to obtain information directly from the web client request, including any information that CICS does not provide in the DFHATOMPARMS container.
If you can create an XML binding for the resource that contains the data for your Atom entries, you can pass information from CICS to the program in the DFHATOMPARMS container about the name and length of fields in the resource records that contain data for the Atom entries. Your program can use this information to locate the metadata fields in the resource records. By using these resource handling parameters, you can create a generic service routine that can handle multiple resources. However, you do not have to use the resource handling parameters; if you prefer, you can code information about the resource structure directly in the program.
To respond to a GET request, your service routine must perform these tasks:
Procedure
What to do next
When you have written your service routine, create and install a suitable PROGRAM resource definition in CICS to describe the service routine. In your PROGRAM resource definition, use the EXECKEY(USER) attribute. The PROGRAM resource must be defined locally. You will need to name this PROGRAM resource in the ATOMSERVICE resource definition for your Atom feed.
When you have set up CICS definitions that use your service routine to provide data for an Atom feed, you can use the CEDX transaction to monitor and debug your service routine as it responds to HTTP requests. CW2A is the default alias transaction for Atom feeds, and your service routine runs under this transaction unless you set up an alternative alias transaction. CEDX monitors the next instance of the transaction that you specify, so if other users are working with Atom feeds in this CICS region using the same alias transaction, set up an alternative alias transaction to use while you are debugging your service routine.