Data Elements View

The Data Elements view provides a data table to explore data elements within your COBOL or PL/I program files. It supports browse, sort, and filter data elements from both programs and their associated copybook or include files. This is an advanced capability available with an active license.

Opening the Data Elements View

To open a program in the Data Elements view, it must first be successfully parsed by the language servers. This requires the program to be free of critical syntax errors and all referenced copybooks or include files to be properly resolved. Any issues that may impede parsing are reported in the Problems viewopen in new window within VS Code, where users can identify and address them accordingly. If a program that cannot be parsed is opened in the Data Elements View, an error message is displayed.

The Data Elements View can be opened in the following ways:

  • Cmd ⌘/Ctrl + Shift + P to open the command palette and run the command >IBM Z Open Editor: Open Data Elements View while you view a COBOL or PL/I program.
  • Right-click within a COBOL or PL/I program and select Show In > Data Elements View.

Either method is available for local programs or for remote programs accessed through Zowe Explorer or the z/OS Resources Table. The view opens in the VS Code panel by default but can be repositioned to other areas of the editor if required. The view cannot be opened from a copybook or include file.

Layout

'data-elements-view-layout'

Under default settings, all data elements excluding unnamed items and implicit declarations are displayed in rows. Click any column header to sort the table by that column. Click again to toggle between ascending and descending order. Click a row in the table to display and highlight the corresponding data in the program.

Actions

'data-elements-view-search'

Click the magnifying glass icon to open the search input field. As you enter text, the table dynamically updates to show only the rows with matching values. The search supports both text and numeric input. To clear the search and restore the full table, click the “×” icon on the right side of the input field.

With Z Open Editor v5.6.0, you can search for data elements using regular expressions by enabling the Use Regular Expression toggle. This toggle appears after you expand the search input field.

When the toggle is enabled, the search input is interpreted as a regular expression pattern. Enter the pattern directly, without enclosing it in forward slashes. Patterns must follow JavaScript regex syntax, including proper character escaping. Matching is case-insensitive, and other regular expression flags are not supported. For example, enabling the regular expression toggle and entering PIC X\(\d{3}\) returns COBOL data elements with alphanumeric field declarations that specify a three-digit length using the PIC X(...) format.

Filter

Click the Filter button to open a menu that contains check boxes to control the visibility of data elements:

  • Hide Unnamed - filters out unnamed data items. This filter is enabled by default.
  • Hide program labels - filters out program labels.
  • Hide implicit declarations - filters out implicitly defined data items and limits the view to elements the developer defines directly. This filter is enabled by default.
  • Hide all items except program labels - filters out all data items except program labels, such as paragraphs and certain section names.

Enabling or disabling filters does not take effect until the filter is submitted. Click the reset button to restore filters to their default state.

Refresh

The Refresh button is disabled by default. The view refreshes automatically whenever a file open in the Data Elements View is edited and saved. This automatic refresh behavior can be disabled through the Settings menu. When disabled, the Refresh button becomes active and enables manual updates to the Data Elements View. In this mode, click the Refresh button to manually update the view and reflect any changes made to the program.

Export Data to CSV

With Z Open Editor v5.6.0, you can use the Export to CSV action to export data elements from a COBOL or PL/I program to a CSV file. Click the Export to CSV button to open a VS Code quick pick menu that lets you configure the following options:

Setting NameOptions (first is default)Description
Data FormatHeader and Data, Key and Value, Data OnlyControls how data is structured in the CSV output.
CSV DelimiterComma (,), Caret (^), Colon (😃, Semicolon (😉, Space ( ), Tab (\t)Specifies the character used to separate fields in the CSV.
Surround fields with quotes (")Yes, NoDetermines whether each field in the CSV is enclosed in double quotes.
OutputExport to file, Open in new text editorSpecifies whether the CSV content is saved to a file or opened in a new editor window.

Select Submit to export the data elements with the chosen settings.

Settings

The Settings menu in the Data Elements View provides control over automatic refresh behavior and column visibility.

As mentioned earlier, the Data Elements View automatically updates whenever a file is edited and saved. Disabling Refresh Automatically activates the Refresh button and enables manual updates to the view as required.

Column visibility in the Data Elements View can be customized. By default, all columns are visible:

  • Data item name
  • Declared level
  • Top-level structure name
  • Declaration data
  • Declaration location
  • Declaration line number
  • Number of references to the data item
  • Length of the data item
  • Offset of the data item
  • Item type

To hide a column, select its header in the Settings menu. An eye icon indicates visible columns, while a slashed-eye icon denotes hidden columns.

Changes to refresh behavior or column visibility do not take effect until Submit is selected. After submission, settings are saved and persist across VS Code sessions.

Limitations

  • The Data Elements View cannot be opened from a copybook or include file.
  • Data elements defined within user-defined functions are not supported.

Length and offset of PL/I data items

The length and offset can be calculated for the following types of PL/I data elements: BINARY, BIT, CHARACTER, COMPLEX, DECIMAL, DIMENSION, FIXED, FLOAT, GRAPHIC, HANDLE, NONVARYING, PICTURE, POINTER, REAL, SIGNED, UNSIGNED, UNION, VARYING, VARYING4, VERYINGZ, WIDECHAR, WIDEPIC.

The following information can be displayed in the Length and Offset columns of the Data Elements view:

ContentExplanation
A non-negative integerThe Length or Offset of the data item, measured in 1-byte increments. Offset origins start at 1, unlike in other languages where offsets often begin at 0.
Blank or empty- The table item is not a data item, but a different type of string, such as a program label or paragraph name.
- The source language is not supported by the table view.
Ellipsis (...)- The source file contains more than one program, and the data item is located within the program unit that is not the first in the file.
- The data item contains no relevant data to display, such as when it is a FILLER or an unnamed item.
- The data item is a LEVEL 88, which contains no relevant data to display.
***The following data element types are out of scope because they are created through dynamic allocation. Their length and offset values are returned as 0 in the API:
  • Controlled and based variables
  • TYPE, LIKE, and UNALIGNED attributes
  • AREA variable

Length and offset of COBOL data items

The following information can be displayed in the Length and Offset columns of the Data Elements view.

ContentExplanation
A non-negative integer- The Length or Offset of the data item, measured in 1-byte increments. Offset origins start at 1, unlike in other languages where offsets often begin at 0.
- For an element declared with OCCURS DEPENDING ON and for succeeding elements, the offset values are based on the maximum length of the OCCURS DEPENDING ON element.
Blank or empty- The table item is not a data item, but a different type of string, such as a program label or paragraph name.
- The source language is not supported by the table view.
Ellipsis (...)- The source file contains more than one program, and the data item is located within the program unit that is not the first in the file.
- The data item contains no relevant data to display, such as when it is a FILLER or an unnamed item.
- The data item is a LEVEL 88, which contains no relevant data to display.
Last Updated:
Contributors: Benjamin Santos, Esther M