Making code changes

IBM Z® Open Editor supports COBOL and PL/I editing. Select a program, copybook, include, or JCL file in the Explorer to open it in the editor.

With the syntax highlighting capability, you can quickly distinguish between COBOL and PL/I reserved words, comments, constants, and variables. With gray lines, which mark the COBOL and PL/I areas, you can better determine correct areas for comments, boundaries for coding in areas A and B, and so on.

The editor provides the following features and capabilities:

Browsing code by using the Outline view

As you view the source, you can use the Outline view to efficiently explore and navigate the code of the program. By looking through the items in this view, you can get an idea of what the program does at a high level.

Illustration of using the Outline view

How to use it

You can use the Outline view only after you have opened a file or program. If the Outline view is not already expanded, you can open it by clicking View > Open view > Outline.

You can use this view to:

  • Expand and collapse sections such as Division Headings, Section Headings, and Variable Group Names in the Outline View.
  • Recognize includes, procedures, loops quickly via the icons located by the various items.
  • Go to a wanted location in the code by clicking that section header in the view.
  • Sort by Position, Name, or Type.
  • Search for identifiers within the outline by pressing Ctrl+Shift+O (Windows), or Cmd+Shift+O (Mac) within the Editor window.

When you move your cursor over the program, outline nodes are automatically selected. To toggle this and other features related to the Outline View, hover over the upper right corner of the Outline View. You can see the option ..., where you can click to find multiple options to organize your outline view such as Follow on Cursor, Filter by Type and Sort by Name, Position, and Type.

Code and variable completion suggestion

When you are typing code, code completion suggestion provides you with a matching list from which you can select commands, defined variable and paragraph names, and code snippets.

Illustration of code and variable completion

How to use it

The code completion suggestion is displayed automatically while you are typing or when you press Ctrl+Space (Windows and Mac) depending on your preferences settings.

Hovering for declaration

You can see the working storage definition or DCL definition and the parent group of a variable or paragraph name by moving your mouse cursor over to the variable or paragraph name.

Illustration of hovering for declaration

How to use it

The declaration hover is enabled by default.

Previewing copybooks and include files

You can preview the contents of a copybook or include file by moving your mouse cursor over the copybook name in a COPY statement in COBOL or the include file in a %INCLUDE statement in PL/I, without having to navigate away from the file you are working in.

Illustration of previewing copybooks and include files

How to use it

You must specify the filepath to the copybooks or include files in your settings to resolve the references. If no filepath is specified or the copybooks or include files are not found in the provided filepath, an error (red squiggle) is shown.

To resolve this, add the filepath to the references in the zopeneditor.propertygroups section of your settings.json settings as follows.

  1. Open your settings:

    • Windows: File > Preferences > Settings
    • Mac: Code > Preferences > Settings
  2. In the left side of the opened Settings interface, expand Extensions from the list of categories, and click IBM Z Open Editor. In the IBM Z Open Editor settings, under Propertygroups, click Edit in settings.json to open the settings.json file.

  3. Edit the settings.json file to specify filepaths to folders that contain copybooks or include files in the syslib field. You can hover over the field names (such as name, type) to view details about what kind of information is expected for each field.

    You can refer to the examples and supported patterns in Setting property groups.

  4. Save the settings.json file by selecting File > Save.

If you have installed Zowe CLI, you can define a search path to resolve copybooks over the network against your remote MVS data sets or even USS directories (COBOL only at the moment).

To open the file in a separate editor, press Ctrl+Click (Windows) or Cmd+Click (Mac).

Operations on variable and paragraph names

When you double-click a variable or paragraph name to highlight the entire name and then right-click it, you can see the available operations.

How to use it

  • Click Change All Occurrences: Ctrl+F2 (Windows) or Cmd+F2 (Mac)

    When you type the new name, all occurrences are changed simultaneously.

    NOTE: In the scroll bar on the right side of the editor, each occurrence is noted with a location bar.

  • Click Find All References: Alt+Shift+F12 (Windows) or Option+Shift+F12(Mac)

    A Results References view for the variable or paragraph is displayed on the left side of the screen. Click any result to go to that location in the file.

  • Click Peek References: Shift+F12 (Windows and Mac)

    This opens a Results References view in the CodeLens box underneath the variable or paragraph. Click any result to go to that location in the file.

    Illustration of peeking references

  • Click Go to Definition: F12 (Windows and Mac)

    Go to the location where the variable or paragraph is defined. It opens the copybook or include file if applicable.

  • Click Go to Symbol: Ctrl+Shift+O (Windows) or Cmd+Shift+O (Mac)

    When you enter an object name in the search bar or you scroll through the items to select the object, the cursor is moved to that location.

  • Click Peek Definition: Alt+F12 (Windows) or Option+F12 (Mac)

    This opens a CodeLens box that shows where the variable or paragraph was defined in the code. If you use the keyboard shortcut Alt+F12 (Windows) or Option+F12 (Mac), the variable or paragraph name is only clicked once before the keyboard shortcuts are pressed. Double-click any result to go to that location in the file.

    Illustration of peeking definition

  • Click Rename Symbol: F2 (Windows and Mac)

    Rename the selected symbol, and the changes are done in the whole program and copybook or include if it is attached to that symbol.

Syntax checking

The syntax checking feature underlines unrecognized statements and expressions in red, which helps you to make quick corrections and reduce compile errors.

Syntax checking also works for misspelled COBOL and PL/I reserved words and unknown variable names.

How to use it

To see all the syntax errors in the open files, open the Problems view through the View menu or by clicking the error and warning icon at the bottom in the status bar. Double-click the list item to directly go to the problem.

Undoing and redoing

Undo your changes by pressing Ctrl+Z (Windows) or Cmd+Z (Mac). Redo your changes by pressing Ctrl+Shift+Z (Windows) or Cmd+Shift+Z (Mac).

Last Updated: 1/20/2020, 4:37:40 PM