Add Operation Logic to filmREST.cbl

Guides you through the process of adding logic to the filmREST.cbl program to process POST and GET requests.

The generated skeleton program, filmREST.cbl, contains some basic functionality that is common to any CICS Web service that uses the Channel interface, such as:

  • It retrieves the type of request being made from the DFHHTTPMETHOD container, and evaluates it.
  • For a GET request, it populates the DFHWS-DATA container with the content of the response data structure (in film01.cpy).
  • For a POST request, it populates the request data structure (in film01.cpy) with the contents of the DFHWS-DATA container.

To provide the required operation logic, you must code it manually by editing the program.

  1. From the Application Explorer view, double-click filmREST.cbl to open it in the COBOL editor.
  2. Within the when "GET" statement, just before the exec cics put container statement, replace the comment code (******* ...) with:
    perform GET-logic
  3. Within the when "PUT" statement, just after the exec cics get container statement, , replace the comment code with:
    perform POST-logic
  4. Scroll down to the bottom of the program, and add the following copy statement at the very end of the program:
    copy "RESTLogic.cpy".
  5. Click File > Save to save your changes.
  6. Close the COBOL editor.

Eclipse automatically builds the project to include your changes.