Making High Level Assembler code changes

In addition to COBOL and PL/I, IBM Z® Open Editor supports IBM Z High Level Assembler (HLASM) editing. You can use the following features to program in HLASM effectively.

With the syntax highlighting capability, you can quickly distinguish between labels, operations, operands, and comments in a HLASM program. With vertical rulers, which mark different areas, you can better determine correct areas for symbols, operations, operands, continuation line indicators, and sequence numbers.

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 and easily navigate to relevant CSECT, DSECT, MACRO instructions as well as branch labels. We purposely chose to not include every symbol because, in large assembler programs, the outline view would often become extremely cluttered. See here for instruction for how to customize what is shown in the Outline as well.

HLASM Outline

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:

  • Recognize CSECT, DSECT, and MACRO instructions quickly via the icons in the outline view.
  • 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 completion

When you are typing code, code completion suggestion provides you with a matching list from which you can select operations and labels. Currently, code completion for symbols only works within a single file. Work is in progress to extend this feature to multiple files.

Code Completion

How to use it

The code completion suggestion is displayed automatically while you are typing in an appropriate context.

Hovering for declaration

You can see hovers for operations and operands by moving your mouse curosr over the operation or operand.

HLASM Hover

How to use it

Operation and operand hovers are enabled by default. Simply move your mouse over an operation or operand. If the operand or operation is defined, a hover will appear.

Previewing copybooks

To preview the contents of a COPY statement move your mouse cursor over the copybook name. If the copybook cannot be resolved, a yellow warning underline will appear on the copybook name. To resolve copybooks, you must set special settings. Specifically, the zopeneditor.propertygroups section of you settings.json file must be set. Please see the section below to learn how to set this setting.

HLASM Copy File Preview

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 symbols

When you double-click a symbol 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.

    HLASM PEEK 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.

    HLASM PEEK DEFINITION

Remote Macros

Macros in SYS1.MACLIB are available for code completion. In addition, if you configured Zowe Explorer to a z/OS MVS system that has a SYS1.MACLIB data set with a valid user z/OSMF or RSE API profile, you can preview remote macros in rich hovers. The tools will follow the same rules as for include file resolution, although no property groups need to be defined.

HLASM REMOTE MACRO

To enable the automatic lookup with your default Zowe CLI profile, go to Preferences > Settings, expand Extensions > IBM Z Open Editor and check the option Hlasm: Enable Resolving Macros. Additionally, you can adjust the lookup to use the z/OS 2.4 or 2.5 version of SYS1.MACLIB using Hlasm: Zos Macros Version. This will ensure proper hover and code completion support for the macro set that you are using. See Setting preferences for more details on managing preferences.

If you do not have any connectivity, we recommend keeping this feature switched off; otherwise the editor will continue trying to resolve the file via your Zowe CLI profile.

If you want to use a different Zowe CLI profile than the default RSE API or z/OSMF profiles, specify the name of a different profile in the "zopeneditor.zowe" user setting. See the details in Setting up and using RSE profiles in IBM Z Open Editor.

Syntax checking

The syntax checking feature underlines unrecognized statements and expressions in red, which helps you to make quick corrections and reduce compile errors. Currently, there are syntax errors for improper spaces in a continuation line and unresolved copy statements.

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:
Contributors: Peter Haumer, kdbeall, Saile, Keng-Hui Beall, Keng-Hui D Beall, Shi Kun Li, Min Huang, Peter Haumer