Exporting a workbook

Once a workbook is created containing all the required code for the modularized function, you can export the workbook in JSON, COBOL, or compressed file format to your local file system.

To export a workbook, complete the following steps:
  1. Go to the Workspaces tab and select a workspace that includes the created workbook.
  2. Select one of the following ways to use the Export function.
    • Select the workbook that you want to export from the Workbooks landing page, click the Actions menu, and select Export from the menu.
      Figure 1. Exporting option on the workbook
      The image shows the Export option on the Workbooks landing page.
    • Open the workbook that you want to export from the Workbooks landing page. In the workbook details pane, click the Actions menu. Then, select Export.
      Figure 2. Workbook details page
      The figure shows the Workbook details page.
    Important: When you slice on a WHEN key condition, Z Refactoring Assistant will comment out the When line and add a period (.) to the end of the last line of the code block to close that code block. For example,
     *      WHEN '01AEND'                                                      
              ADD WS-FULL-ENDOW-LEN TO WS-REQUIRED-CA-LEN                      
              MOVE 'E' TO DB2-POLICYTYPE.

    If you want to make changes and put the code in a EVALUATE/END-EVALUATE code block, you need to uncomment the sliced WHEN key condition and remove the period.

  3. In the Export workbook dialog that is displayed, select which format that you want to export to your local file system, and click Save.
    Figure 3. Export workbook dialog
    The figure shows the Export workbook dialog.
    Exporting a workbook as a JSON file

    After you select JSON to export, the workbook can be saved as a .json file in your Downloads folder.

    This option consumes the workbook data in another downstream processing application.

    Exporting a workbook as a compressed file (ZIP) that includes COBOL and JSON files
    After you select ZIP (COBOL and JSON) to export, the workbook can be saved as a compressed file that includes .cbl and .json files in your Downloads folder. The .cbl file has following features.
    • Syntactic features
      • Create a COBOL file with the identification division, data division, and procedure division.
      • Populate variables that are used in code blocks in the working-storage section of data division. For copybook variables, populate only copybook name.
      • Populate the procedure division with code blocks.
      • Indent variables in the data division and code blocks in the procedure division (program and user-defined).
      • Check for valid Sequence Number Area.
      • Check for indicator area.
      • Indent for Area A that contains items such as Division headers, Section headers, Paragraph names and Level numbers of variables.
      • Indent for Area B that contains items such as statements.
      • Check for System-generated Number Area and remove it.
      • Handle long lines by splitting lines, including comment lines that exceed 72 characters into multiple lines
    • Behavioral features
      • Handle duplicate variables in the working-storage section by renaming the variables in the data division and procedure division.
      • Handle program calls by replacing EXEC CICS LINK calls with PERFORM statements by specifying sdcall tags on the code block that contains the program call statement. For more information, see Handling program calls.
      • Handle duplicate paragraph and section names in the procedure division by renaming paragraph and section names in the calling statement.
      • Check for program-flow control statements such as CONTINUE, GO TO, GOBACK, NEXT SENTENCE, and RETURN.
      • Handle case-insensitive input since COBOL is case-insensitive.
    Exporting a workbook as a compressed file (ZIP) that includes request and response copybooks

    After you select ZIP (Request and Response Copybooks) to export, the workbook can be saved as a compressed file in your Downloads folder.

    Select this option if you want to get the request and response copybooks for the code that is present in the workbook.

    The compressed file contains the following items.
    • The request copybook that provides the suggestion of the input parameters that are needed for the service in the workbook.
    • The response copybook that provides the suggestion of the output that is generated by the code in the workbook.
    • A JSON version of the request and response variables for programmatic consumption.

    You can use the copybooks to design the input and output for the z/OS® Connect APIs that correspond to the code in the workbook of IBM® watsonx Code Assistant™ for Z Refactoring Assistant.