When the COBOL Language Server is enabled, it automatically sets the source format and the COBOL dialect for your source code. If it is not possible to automatically determine these, the Language Server sets a default Fixed source format and a Micro Focus dialect.
If the COBOL Language Server is disabled or stopped, the editor applies the default source format and dialect from the extension setting in Visual Studio Code. However, if a specific source format or dialect has been set for the active document, Visual Studio Code applies those instead.
Insert the code constructs for elements of the PL/I or the COBOL language, for example for classes, methods and delegates in .NET COBOL. Snippets are also available for EXEC CICS and EXEC DLI statements.
To insert a code snippet:
To insert EXEC CICS constructs, start typing cics. For EXEC DLI constructs, start typing dli.
The snippets in the drop-down list are prefixed by a square icon.
To remove the line comments, use the Remove COBOL line comment command from the Command Palette.
Right-click an item in your COBOL and click:
Visual Studio Code uses UTF8 by default when opening or creating files. To change the encoding used for COBOL files you can add the required encoding to the settings.json file as follows:
{ "[cobol]": { "files.encoding": "utf8bom" } }
When utf8bom is set, the Compiler will recognise the file encoding as UTF8.
To apply COBOL formatting to your program:
This applies consistent formatting and indentation to your sources.
You can use .editorConfig files either in the workspace folder or in a folder higher up to specify any required formatting settings for your sources. See Sharing Code Style Settings with an EditorConfig File in the Visual COBOL or the Enterprise Developer docs.
Press CTRL+P and type one of the following symbols in the widget:
Click on sections, paragraphs or methods in the OUTLINE section to navigate easily the code in larger files:
Clicking an item either in the code or in the OUTLINE section shows that item in the breadcrumb at the top of the editor. You can click on items in the breadcrumb to open the navigation panel as well:
To rename a data item:
This renames all occurrences of the symbol across the files in your workspace, including in copybooks.