Analyze the invkRevJ.cbl Program

Walks you through the process of analyzing the code in the generated invkRevJ.cbl program.

The supplied invkRevJ.cbl program already contains the functionality that is required to invoke the reverseJ service. Any JSON application that uses a linkable interface, including invkRevJ.cbl, is required to do the following:

  • Populate the request structure.
  • PUT that data into a CONTAINER named DFHJSON-DATA.
  • PUT the name of the JSONTRANSFRM resource used to transform the COBOL request data to JSON into a CONTAINER named DFHJSON-TRANSFRM.
  • LINK to DFHJSON, which includes:
    • Locating the appropriate JSBIND file by using the JSONTRANSFRM resource named in the DFHJSON-TRANSFRM CONTAINER.
    • Transforming the content of the DFHJSON-DATA CONTAINER into JSON using the JSBIND file and placing it into the DFHJSON-JSON CONTAINER.
  • SEND the request and RECEIVE the response, which includes:
    • Using WEB OPEN to open a connection to the server hosting the service.
    • Using WEB CONVERSE to SEND the request to the server and RECEIVE the response. This is done by supplying the request message via the DFHJSON CONTAINER and receiving the response message into the same CONTAINER.
    • Using WEB CLOSE to close the connection to the server.
  • PUT the name of the JSONTRANSFRM resource used to transform the JSON response message to COBOL into a CONTAINER named DFHJSON-TRANSFRM.
  • LINK to DFHJSON, which repeats the same procedure as before.
  • Populates the response structure by GETting the content of the DFHJSON-DATA CONTAINER.