Previous Topic Next topic Print topic


Editing COBOL

Here are some tips on editing COBOL code in the Visual Studio IDE:

Bookmark Window
Shows the bookmarks added to source code in your solution. Choose View > Bookmark Window to display the window.
Bookmarks
To add a bookmark, position the cursor on a line in the code and choose Edit > Bookmarks > Toggle Bookmark. View > Bookmark Window.
Background Syntax Checking
The COBOL code is checked in the background, as you type it. Any errors are underlined with wavy red lines. You can turn this setting off or on the Miscellaneous page in Tools > Options > Text Editor > COBOL. Generally, we recommend that you leave Background Syntax Checking turned on. You might consider turning it off only when editing exceptionally large files.
Class View Window
Shows an outline of the classes used in your solution and their members. To display the window choose View > Class View. This applies to managed projects only.
COBOL Reserved Words
To configure the case of the COBOL reserved words used in the code snippets for COBOL choose Tools > Options > Text Editor > COBOL > Miscellaneous and set the case in the Case Format for Reserved Words field.
Code Definition Window
If you position the cursor on an object in the source code, the Code Definition Window automatically displays the section of the code implementing the objects referenced on that line. To display the window choose View > Code Definition Window.
Code Snippets
Insert the code constructs for elements of the .NET COBOL language, for example for classes, methods, delegates. To insert a snippet choose Edit > IntelliSense > Insert Snippet, or right-click in the editor and select Insert Snippet, or type the shortcut for the particular snippet (for example, class-id, method-id) and press Tab. This inserts an outline of the syntax for you to fill in. Available in managed code only.
To configure the case in which the code snippets are displayed choose Tools > Options > Text Editor > COBOL > Miscellaneous and set the case in the Case Format for Identifiers field.
Comments
Start end-of-line comments in the code using *>. For fixed or variable source format of code, enter * in column 7 to comment out an entire line.
Errors Window
Shows the errors, warning and messages created when editing or compiling. Double-click on an item in the errors list to position the cursor on the line of code that causes the error. You can get help on the error by pointing to the relevant error number and pressing F1.
Go To Definition (F12)
Pointing to a variable in the editor and pressing F12 positions the cursor on the definition of that variable.
Performing Go To Definition on a copybook name opens the copybook in the editor.
IntelliSense
Displays lists of the namespaces, types, members and parameters that are available when you type an object name followed by a space, dot, double colon or an opening bracket. The IntelliSense information is updated as you type.
Navigation Bar
The navigation bar at the top of the COBOL editor displays lists of the objects and procedures used in the current program and enables you to position the cursor on any of them. This is available for managed code only.
Outlining
Enables you to hide portions of the code. Choose Edit > Outlining > Toggle Outlining Expansion.
References
Enable you to add references to .NET assemblies, COM objects, projects and files. To add a reference choose Project > projectProperties, open the References tab and click Add > Reference or Add > Web Reference. This applies to managed projects only.
Syntax Colorizing
Colorizes the members of the COBOL language, for example data items, statements, comments, level 78 words, in different colors. To configure the colors for the COBOL language, choose Tools > Options > Environment and click Fonts and Colors. The items related to COBOL are prefixed with "COBOL".
Syntax Help
In the editor, point to a COBOL reserved word and press F1 to display the syntax Help for that word.
XML Documentation Comments
Insert XML documentation comments immediately before all your classes and methods to provide a description of what they do. Start each line of the documentation comment with *>>. When you type code IntelliSense shows the classes and methods you can use, the definitions are displayed as tool-tips for your classes and methods.
Previous Topic Next topic Print topic