COBOL Language Support
COBOL Language Support enhances the COBOL programming experience on your IDE. The extension leverages the language server protocol to provide autocomplete, syntax highlighting and coloring, and diagnostic features for COBOL code and copybooks. The COBOL Language Support extension can also connect to a mainframe using the Zowe Explorer extension to automatically retrieve copybooks used in your programs and store them in your workspace. COBOL Language Support also supports COBOL programs which interact with Datacom, CICS, and DB2 SQL. An add-on extension which adds support for the IDMS dialect is available on the VS Code Marketplace.
COBOL Language Support recognizes files with the extensions
This extension is a part of the Che4z open-source project. Feel free to contribute right here.
COBOL Language Support is also part of Code4z, an all-round package that offers a modern experience for mainframe application developers, including extensions for language support, data editing, testing, and source code management.
There are no client or server-side prerequisites for COBOL Language Support.
The COBOL Language Support extension is supported on Visual Studio Code and Github Codespaces.
This extension is not compatible with other extensions that provide COBOL support except COBOL Control Flow and the dialect add-ons published by Broadcom. We recommend that you disable all other COBOL-related extensions to ensure that COBOL Language Support functions correctly.
The COBOL Language Support extension only supports IBM Enterprise COBOL. Other versions of COBOL are not supported.
Integration with Zowe Explorer
Integrating COBOL Language Support with Zowe Explorer lets you:
To enable these features, install the Zowe Explorer extension and configure a Zowe Explorer
COBOL Language Support provides the following COBOL syntax awareness features:
Autocomplete speeds up the coding process by intuitively suggesting the most likely variables or paragraphs to follow existing code. The extension provides live suggestions while you type for:
The autocomplete feature is only available in the main COBOL file, not in copybooks.
Syntax and Semantic Check for Code
This feature checks for mistakes and errors in COBOL code. The syntax check feature reviews the whole content of the code and suggests fixes, through syntax and semantic analysis which returns diagnostics on the entire context of the code, not just keywords.
This feature is also enabled for Datacom, CICS, and DB2 SQL keywords and variables.
The extension enables syntax highlighting for COBOL code.
Contrasting colors are used in displayed code for ease of identifying and distinguishing keywords, variables, paragraphs and sections.
Outline View and Breadcrumb View
The extension enables outline view and breadcrumb view, which show the structure of elements within the program and allow easy navigation between them.
Before you write your COBOL code from scratch, search the snippet library for useful templates.
You can also insert a code snippet by typing the name of the snippet in your code and clicking on the autocomplete text.
The COBOL Language Support extension also supports user snippets. Add your custom snippets to the
Configure the smart tab function in your
To configure the smart tab feature, open your
Tip: You can open your
Many companies have their own COBOL preprocessors which complement or modify standard IBM enterprise COBOL with custom statements and keywords. In our documentation, we refer to these preprocessors as "dialects".
Dialect add-ons are available to add support for specific language analysis in your COBOL files. Currently an add-on for the IDMS dialect is available on the Visual Studio Code Marketplace.
Dialect add-ons must be enabled in the COBOL Language Support extension settings. To enable dialect add-ons that you install, complete the following tasks:
COBOL Language Support processes dialects in the order you list them in the Cobol-lsp: dialects setting or within the
SQL Backend Server
Set the SQL backend server as either DB2 or Datacom to ensure you use the correct version of the implicit
The COBOL Language Support extension supports subroutines specified in CALL statements if the called program is stored in a local folder in your workspace. The Go To Definition and Find All References functionalities, as well as autocomplete, are extended to work for names of subroutines.
To enable subroutine support, specify the paths of folders containing subroutine files in your workspace extension settings.
If you specify your subroutine folders using absolute paths or paths containing
The COBOL Language Support extension supports copybooks used in your source code that are stored in a local folder in your workspace. If you have copybooks stored in mainframe data sets or USS directories, you can use a Zowe Explorer profile to automatically download them from the mainframe to your workspace.
To enable copybook support, you specify the folders and data sets that contain copybooks used in your project in the workspace settings. When a copybook is used in the program, the folders and data sets are searched in the order they are listed for files and members that match the name of the copybook. If a copybook with the same file name is located in both a local folder and a remote location, the one in the local folder is used.
Copybook support features are disabled for files stored in the folder .c4z/.extsrcs in your workspace. If you also use the Debugger for Mainframe extension to debug your COBOL programs, you might have some files stored in this folder.
Configuring copybook support on COBOL Language Support also enables copybook support features of the COBOL Control Flow extension.
Supported Copybook Types
COBOL Language Support supports the following copybook types:
Storing Copybooks Locally
You can store your copybooks locally in folders in your workspace and specify those folder paths in your workspace extension settings.
If you specify your copybook folders using absolute paths or paths containing
To resolve copybook names manually, hover over the copybook name with the error underline, select Quick Fix... and Resolve copybook.
Retrieving Copybooks from the Mainframe
You can also set up automatic copybook retrieval from the mainframe to download copybooks from mainframe data sets and USS directories to your workspace.
Copybooks that you retrieve from mainframe data sets are stored in the .c4z/.copybooks directory within the workspace, which is created automatically.
We recommend that you refresh your copybooks from time to time. To refresh your copybooks, press F1 and run the command Clear downloaded copybooks. This command clears the .c4z/.copybooks directory so that copybooks are downloaded again from the mainframe.
Copybook Support Features
The extension includes the following copybook support features:
Syntax and Semantic Check
Syntax and semantic analysis are enabled for keywords, variables, and paragraphs across all copybooks used in the COBOL file, to ensure and maintain compatibility of copybooks called in code.
The semantic analysis feature takes into account
Syntax coloring is automatically enabled for copybook files with the extension
Go To Definition and Find All References
The Find All References and Go To Definition functionalities are extended to work for occurrences of copybook names, variables and paragraphs in the main COBOL file.
Use processor groups to link programs with specific dialects, SQL backend settings, and local folders containing copybooks. You define processor groups in a
Use the following format:
The program name can be wildcarded.
The two examples above use copybooks from libraries LIB1 and LIB2 for PROGRAM1, and copybooks from libraries LIB3, LIB4, LIB5 and LIB6 for PROGRAM2. The processor groups file also enables the DB2 SQL server for PROGRAM2, and enables the IDMS dialect for LIB3 and LIB4 for PROGRAM2.
Specify libraries as absolute or relative local paths in the
To generate a troubleshooting log for the LSP server, specify a value for the parameter cobol-lsp.logging.level.root in the extension settings. Specify one of the following values:
These values are ordered from returning the least information ("ERROR"; errors only) to the most information ("ALL"; all details).
Troubleshooting logs are stored in the subfolder \LSPCobol\logs within your user home directory.
Technical Assistance and Support for COBOL Language Support
The COBOL Language Support extension is made available to customers on the Visual Studio Code Marketplace in accordance with the terms and conditions contained in the provided End-User License Agreement (EULA).
If you are on active support for Brightside, you get technical assistance and support in accordance with the terms, guidelines, details, and parameters that are located within the Broadcom Working with Support guide.
This support generally includes:
Note: To receive technical assistance and support, you must remain compliant with “Working with Support”, be current on all applicable licensing and maintenance requirements, and maintain an environment in which all computer hardware, operating systems, and third party software associated with the affected Broadcom software are on the releases and version levels from the manufacturer that Broadcom designates as compatible with the software. Changes you elect to make to your operating environment could detrimentally affect the performance of Broadcom software and Broadcom shall not be responsible for these effects or any resulting degradation in performance of the Broadcom software. Severity 1 cases must be opened via telephone and elevations of lower severity incidents to Severity 1 status must be requested via telephone.
The extensions for Visual Studio Code developed by Broadcom Inc., including its corporate affiliates and subsidiaries, ("Broadcom") are provided free of charge, but in order to better understand and meet its users’ needs, Broadcom may collect, use, analyze and retain anonymous users’ metadata and interaction data, (collectively, “Usage Data”) and aggregate such Usage Data with similar Usage Data of other Broadcom customers. Please find more detailed information in License and Service Terms & Repository.
This data collection uses built-in Microsoft VS Code Telemetry, which can be disabled, at your sole discretion, if you do not want to send Usage Data.
The current release of COBOL Language Support collects anonymous data for the following events:
Each such event is logged with the following information: