Previous Topic Next topic Print topic


To create a copybook from selected lines in the code

Within the editor, you can select one or more lines in a COBOL program or copybook, use the Extract to Copybook context menu command to move the selected lines into a new copybook file. The selected lines are replaced in the original program with a COPY statement that refers the new copybook.

To create a copybook from lines selected in the editor:

  1. Open a COBOL program in the editor.
  2. Select the lines of code you want to move into a copybook. The entire lines where your selection starts and ends will be moved to a copybook.

    The selection must only include the code of the actual program or a copybook shown in editable expanded copybook view.

    It is not possible to create a new copybook from a selection within a copybook shown in the editor in read-only expanded view or a selection that spans the code of a copybook shown in expanded view and lines of code of the actual program.

  3. Right-click the selection and click Extract to Copybook. This opens the Save As dialog box, prompting you to create a copybook. By default, this offers to create the file in the directory that stores the program in which you made a selection.
  4. Specify a file name and location for the copybook and click Save. This creates a copybook file in the specified location. The file includes the entire lines of code for yous selection in the editor.

    In the editor, the selected code is replaced by a COPY statement that refers the new copybook and shows it in expanded copybook view. The case of the statement is as defined on the Formatting page in Tools > Options > Text Editor > Micro Focus COBOL.

    If you chose to save the copybook in a directory other than the default, this also adds that directory to the list of copybook locations on the Copybooks tab in the project’s properties.

Previous Topic Next topic Print topic