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 a Zowe CLI z/OSMF profile to automatically retrieve copybooks used in your programs and store them in your workspace.
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 HLASM Language Support, Explorer for Endevor, Zowe Explorer and Debugger for Mainframe extensions.
The COBOL Language Support extension is supported on Visual Studio Code and Eclipse Che.
This extension is not compatible with other extensions that provide COBOL support. 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.
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 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, and paragraphs.
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.
Follow these steps:
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
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.
Follow these steps:
The COBOL Language Support extension supports copybooks used in your source code that are stored in a local folder in your workspace. If your copybooks are stored in mainframe data sets, you can use a Zowe CLI z/OSMF profile to automatically download them from the mainframe to your workspace.
You can use copybooks stored in local folders, mainframe data sets or both. 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 mainframe data set, 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.
Storing Copybooks Locally
You can store your copybooks locally in folders in your workspace and specify those folder paths in your workspace extension settings.
Follow these steps:
Retrieving Copybooks from the Mainframe
You can also set up automatic copybook retrieval from the mainframe to download copybooks from mainframe data sets to your workspace.
Follow these steps:
Copybooks that you retrieve from mainframe data sets are stored in the .c4z/.copybooks directory within the workspace, which is created automatically.
Because copybooks that are downloaded to the .copybooks folder might change on the mainframe, we recommend that you refresh your copybooks from time to time. To refresh your copybooks, manually delete the .copybooks folder in your workspace. The copybooks are then re-downloaded from the mainframe the next time you open a file that references each copybook.
Copybooks downloaded from the mainframe using an older version of COBOL Language Support might also be found in a .copybooks directory in the workspace root. We recommend that you delete this folder so that all files are downloaded again to the .c4z/.copybooks folder.
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.
To generate a troubleshooting log for the LSP server, specify a value for the parameter broadcom-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.
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: