Cobos Tutorial : How to edit a COBOL program with Cobos
In this step-by-step tutorial, you will learn how to use essential features of Cobos to edit a COBOL program: . For this post, we assume that you successfully installed Cobos (if not, read the installation tutorial). Cobos is the most advanced open source COBOL IDE dedicated to Mainframe application development. Based on Eclipse, it combines the best of both worlds by leveraging Mainframe best practices and the Open Source community innovation.
- Open the program “Custload.cob” from COBOS_SAMPLE project with the COBOL Editor by right-clicking on it in the “Navigator” view and by choosing “Open With ► COBOL Editor”
Custload.cob shows off in the Editor.
- Activate the Outline View on the right side. Click on the word PROCEDURE in Outline View.
- In the editor, put your mouse above the word CNTR-INPUT-FILE on line 99
You can see line definition of the variable under the mouse pointer.
- Click on variable CNTR-INPUT-FILE on line 99 and hit F3.
Focus is given to the actual line definition in the program (or in a Copy as well).
Double clicking on an occurrence in the Search View will position the editor on this occurrence, of course.
- Let’s insert a statement: place the cursor at the end of line 94 and hit enter. Key ‘di’ and hit Ctrl + Space.
Variables and labels along with their definition line are shown first, then COBOL keywords with or without pattern.
- Double Click on DISPLAY statement pattern
- Now, replace identifier by any string you want…e.g.: ‘Hello world!’
- Finally, save the file (press Ctrl + S or click on the disk icon from the toolbar).
Useful keyboard shortcuts
The main additional keyboard shortcuts are:
- Ctrl + Space: invoke auto-completion.
- Ctrl + Shift + Y: change selected characters to lowercase
- Ctrl + Shift + X: change selected characters to uppercase
- Ctrl + Shift + Z: set CAPS ON (like in ISPF Editor)
- Ctrl + L: go to the N line in a source file
- Alt + Shift + A: Toggle Block Selection (useful for block indentation updating)
- Ctrl + Q: return to the last edition in a file
- Ctrl + E: go to another opened editor. A pop-up window appears with the choice of opened editors
- F3: go to the definition of the variable
- Ctrl + Shift +V: check syntax of the code (shortcut for menu “Cobos ► Check Syntax”)
- Ctrl + Shift + C: remote compilation (shortcut for menu “Cobos ► Compilation”)
Congratulation! You’re now ready to write your first COBOL program with Cobos. In the next tutorial, we’ll show how to check the syntax of a COBOL program. Stay tuned!
If you recently joined reading our Cobos tutorial serie, don’t forget to read our previous posts, which will help you handling the tool: