Previous Topic Next topic Print topic


Expanded Copybook View

The COBOL editor supports showing the contents of copybooks inline at the place where they are referenced in a program or a copybook. Features include:

Showing copybooks

To show a single copybook:

  • Right-click the line for the COPY statement in the editor, and click Show "CpyFileName.cpy".

    This shows the copybook inline in edit mode.

To show all copybooks referenced in a source file:

  • When the file is opened in the editor, click Show all copybooks in the current source file in the COBOL toolbar or, alternatively, right-click in the code, and click Show All Copybooks.

    This also shows any copybooks the expanded copybook includes.

Note:
  • Copybooks for which you do not have write access are displayed in read-only mode. This also includes the system copybooks in the case when you are running Visual Studio without administrator's rights.
  • Using Go To Definition on a line that has a COPY statement shows the contents of the copybook inline.
  • For copybooks referenced using COPY... REPLACING, the Show all copybooks command, Go To Definition, navigating to an error from the Error List window, Find All References and navigation using the drop-down types and members show the items inside the read-only expanded copybook view with replaced values unless the copybook is already shown in the original content.

Showing copybooks with replaced values

For copybooks referenced using a COPY... REPLACING statement you can either show the original contents, or the contents with replaced values:

  • Right-click the line for the COPY... REPLACING statement in the editor, and click Show "CpyFileName.cpy" with replaced values.

    This shows the copybook with replaced values in read-only mode.

To switch to edit mode, right-click the COPY view or right-click in the read-only view, and click Show "CpyFileName.cpy" for editing.

Hiding copybooks

For a single copybook:

  • Right-click the COPY statement or inside the expanded copybook view in the editor, and click Hide "CpyFileName.cpy".

To hide all copybooks in the current file:

  • Click Hide all copybooks (Hide all copybooks) in the COBOL toolbar or, alternatively, right-click in the source file in the editor, and click Hide all copybooks.

Moving to the start or the end of a copybook

To navigate to the start of a copybook shown in the editor in the expanded copybook view:

  • Right-click in the code of the expanded copybook and click Go To Start Of "CpyFileName.cpy".

    This moves the cursor to the first line of the copybook immediately after the line for the COPY statement.

To navigate to the end of a copybook shown in the editor in the expanded copybook view:

  • Right-click in the code of the expanded copybook and click Go To End Of "CpyFileName.cpy".

    This moves the cursor to the end of the copybook.

Editing copybooks in the expanded copybook view

You can edit copybooks in the expanded copybook view. To keep the changes, you must save the file in which you edited a copybook in the expanded copybook view. This saves the changes even if the copybook was hidden after making the changes.

Editing a copybook, whether in the expanded copybook view or when opened in a standalone tab in the editor, results in the changes being shown automatically in any other place the copybook is visible.

If, after making a change to a copybook in the expanded copybook view, you close the source program, you are prompted to save the changes in the copybook file itself.

Note: In the expanded copybook view, it is not possible to edit copybooks referenced using a COPY... REPLACING statement that are shown with replaced value as, in this case, the expanded view is read-only. You can open them for editing by right-clicking the line for the COPY... REPLACING statement, and clicking Show "CpyFileName.cpy" for editing.

Editing copybooks in a standalone tab in the editor

To open a copybook from within the COBOL source in a standalone tab in the editor:

  • Right-click the line in the source code that contains the COPY statement, and click Open "CopybookName" in New Window.

    This opens the copybook in the editor in a standalone tab for editing.

Closing a copybook opened in a standalone tab in the editor hides the expanded copybook view of that copybook in all source files in which it was displayed. If you need to see the expanded copybook view again, you need to reopen it manually.

Debugging support in the expanded copybook view

By default, the debugger steps inline in the expanded copybook view while debugging. You can change this behavior from Tools > Options > Debugging > COBOL.

The debugging support in the expanded copybook view provides the following functionality:

  • You can set breakpoints and COBOL watchpoints in copybook files directly in the expanded copybook view using the normal methods.
  • When debugging, you can step inside the expanded copybook view. The IDE automatically expands the copybook when stepped into or when a breakpoint in the copybook is hit.
  • You can display Pinned Data Tips inside the expanded copybook view.
  • You can use the Quickwatch and Add Watch commands inside the expanded copybook view.
  • You can execute some debugger commands such as Show Next Statement, Run To Cursor and Set Next Statement from the context menu in the expanded copybook view.
Note: The following limitations apply to the expanded copybook view:
  • Bookmarks are not supported in the expanded copybook view. You can add bookmarks in copybooks that are opened as standalone files.
  • It is not possible to edit copybooks referenced through a COPY... REPLACING statement in expanded copybook view when the view shows the replaced values. In this case, the expanded copybook view is read-only.
  • The read-only status of expanded copybooks is not preserved when you close the project. Next time you open the project, the copybook is shown in the Expanded Copybook view but not as read-only.
  • If you used the OF or IN phrases with a COPY statement, it is not possible to show the corresponding copybook in the Expanded Copybook view or open it using the Open "CopybookName" in New Window command if the copybook is stored in a library file (where you have used the COPYLBR Compiler directive).
  • Navigating to items in the expanded copybook view is not supported from the Class View or using the Navigate To command.
  • References to file locations in the output windows such as pointing to the build output, or in the results received by Find in Files, do not point to items in the expanded copybook view.
  • Selecting the currently selected statement in the call stack in an expanded copybook may show the actual copybook. You can use the Show Next Statement command of the debugger to return the actual expanded copybook position.
  • The Breakpoints window always shows the line number of a breakpoint within the file containing it, not the line number within expanded copybook view.
  • The Call Stack, Threads and IntelliTrace windows all display line numbers corresponding to the file containing the statement, not the line number within expanded copybook view.
  • If you move the caret to an invalid position in the expanded copybook view, the Set Next Statement command will display an ‘Unable to set the next statement to this location’ error message and the copybook will be opened as a separate document.
  • When stepping through managed code, if the next statement to step onto is within the same class or program, and on the same line number, but in a different source file, the debugger steps over that statement. For example, if you try to step from line 10 of Program1.cbl to line 10 of Copybook1.cpy, the debugger steps over the statement in the copybook.
Previous Topic Next topic Print topic