Viewing Copybooks in Context

When you view or edit a copybook, you need to see it in the context of the program that references it, as its appearance and usage can change depending on the program. For example, data items that are not used in the program are struck through, and horizontal lines indicating the start and end of code lines can show depending on the source format of the program. The Program Outline view can differ between contexts too.

If there is an error in the copybook that does not occur in all contexts, it still indicates an error - no matter which context you view it in.

Showing the context

When focus is on a copybook, the Eclipse window's title bar shows the location of the file and the program currently associated with it.

A breadcrumb trail at the top of the Editor indicates which program and copybooks are the current context - click Toggle Context Breadcrumbs GUID-86E471FC-5040-42D3-B194-10D093318E6E-low.png in the Eclipse toolbar and use the drop-down list to view and open the dependent copybooks.

You can also check what context a copybook is displaying in by hovering over the tab in the COBOL Editor.

Opening in a context

You can choose which context to open a copybook by right-clicking on the file in Application Explorer view and selecting Open In Context. A list is displayed of all the programs that include a COPY statement referencing the copybook. You can also choose to open the copybook in no particular context.

Whichever you choose becomes the copybook's context whenever you right-click the copybook in Application Explorer view and select Open. It also determines which program it is displayed within when you right-click in the copybook source and select Open in Copy View.

Changing the context

When a copybook is open in the COBOL Editor with a particular context, you can change to a different one by right-clicking in the Editor view and selecting Switch Context. A list is displayed of all the programs that include a COPY statement referencing the copybook.

If a copybook is open in a context and you remove the COPY statement in the referring program (or delete the program), you are prompted to switch context.

Viewing copybook dependencies

By expanding a source file node in Application Explorer view, you can see a list of all copybooks referenced in the source code, and nested within them any other copybooks referenced by those copybooks. Double-click a copybook reference in Application Explorer view to open the copybook file.

GUID-97E5F634-B79A-4B63-8AF0-09C3E0FEE150-low.png

Use the Copybook Dependency view to show where in the source file's structure the COPY statements appear, and which copybooks they reference.

GUID-7BD7F0B2-78F5-4A56-83F3-8A0A0427655A-low.png

Click a copybook reference in the Copybook Dependency view to locate the associated COPY statement at the appropriate line in the source code.