Cobos Tutorial: How to unfold a COBOL program

 In Tutorials

In this tutorial, we’ll show how to unfold a COBOL program with Cobos (COBOL Eclipse-based IDE for Mainframe application development). This function displays the original program including source code, copybooks and SQL includes which are used by the program. The expanded file (Unfolded) is opened in a new tab in read-only mode. The expanded copybooks are displayed on a yellow background, indicating their path on the start line beginning with “++SCCOPY” and ending with “–SCCOPY”.

Reminder: Before following this step-by-step tutorial, you will need to use the Cobos dedicated workspace. This workspace comes with Cobos when you download it from this page.If you recently joined reading our Cobos tutorial serie, don’t forget to read our previous posts, which will help you handling the tool:

  • Let’s go! First, check that the program “cf00p.cob” is active in the COBOL Editor, select menu “Cobos ► Unfold COBOL source”

    or click on the “unfold” button placed in the toolbar

  • After Unfold, you will get a new tab with the name “cf00p.cob (Unfolded)”.

    You can browse through the source code by clicking on the yellow markers on the right.

    Tip

    To view the list of copybooks, position the cursor over SCCOPY and select menu “Search ► Text ► File”.

  • GESCOM program

    OK, now let’s see how we manage to make it with mainframe COBOL programs. For successful Check syntax, Unfold, Auto-completion, etc… we need to access copybooks used by the programs we are working on.

    One solution is to replicate the copybooks in a network place, and configure the .cobos file.

    Note: if you want to understand how copybooks paths are specified, open the .cobos file. For more information, select menu “Help ► Help Contents ► Cobos ► Chapter 5 Viewing and … ► Configuring a project”.

    One another very simple solution is to retrieve copybooks from a compilation sysout. Let’s run this scenario with a COBOL program we have compiled from Cobos (and sysout is still available).

    • 1. Open the program “gescom.cob” from mxwuser.jeu230.cobol project with the COBOL Editor.
    • 2. Unfold (select menu “Cobos ► Unfold COBOL source” or click on button).
    • 3. After Unfold, you will get a new tab with the name “gescom.cob (Unfolded)” but a popup shows off because copybooks are not available according to the paths specified in .cobos file:

    • 4. Close the “gescom.cob (Unfolded)”.
    • 5. If you want to look at the sysout content, you can retrieve the sysout in the Navigator View in mxwuser.jeu230.cobol/SYSOUT and double click on it.

      The sysout is opened in the Text Editor.

      If you encounter “resource is out of sync …”, you have to press Refresh key (F5)
    • 6. Give back focus to “gescom.cob” and launch the Cobos command “1. FTP access ► A. Generating local Copies” from the Command view.

    • 7. Select the sysout and click OK.

      Note #1: in this example, we exclude CICS and DB2 copybooks.
      Note #2 (new in Cobos 3.1): You can select the output folder where you want to store the generated copies – in this case, don’t forget to modify the .cobos file – . By default, the copies will be stored with the main program.
    • 8. A pop-up is displayed showing the list of copybooks and the generated JCL.

    • 9. The copies and the JCL are stored along with the source file.

      Note: Cobos DO NOT looks for copybooks systematically first in the directory of the program (if you want to explore this directory, you MUST specify it in the .cobos file). You can of course store the copybooks in another place

    • 10. Now, we can unfold the source file.

Leave a Comment

0