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:
To show all copybooks referenced in a source file:
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:
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) 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:
To navigate to the end of a copybook shown in the editor in the expanded copybook view:
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:
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:
- The expanded copybook view displays bookmarks in copybooks and commands for bookmarks such as enable or disable are supported.
However, using Next/Previous and the Bookmark window will open the standalone copybook file rather than inline view.
- 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
.NET COBOL 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.