Skip to main content

 

If you have installed Enterprise Developer for Visual Studio 2010 IDE, please proceed by accessing the smart editing capabilities for Visual Studio 2010

 

Smart Editing   

Smart editing with background COBOL parsing is provided. This is effectively doing syntax checking as you type. This allows you to be in continuous control of the validity of your COBOL code.

Examples

  • If you start to type a line and have not defined a data item you are about to use, this will prompt you to define it.
  • If you have forgotten a data name then you are prompted for the correct one.
  • If you write a PERFORM and have forgotten the  paragraph name you are prompted for that.

To illustrate this more:

1.       Move down to line 25000 in the code and start typing the following (but just 1 character at a time) and watch what is happening in the editor window: MOVE  W  TO

2.       You will see that once a word is recognised as a reserved word it changes color. So when you were typing the 'MOVE' the word turned color as you completed it.

3.       Once a word is recognised as a data item it also changes color

4.       If a line is invalid COBOL syntax, a red cross appears to the left of the line and the offending part of the line is underlined in red.

5.       Hover your mouse over the red cross to see what the error is.

6.       Alter the line to: MOVE 'my message' TO WS-

7.       Now let's say you have forgotten the data name, so right click on the WS- and select Content Assist. (You may prefer to use Ctrl/Spaceinstead) This will give you a list of potential data names to pick from.

If you have made a number of syntax errors while editing, there are red marks placed alongside the right-hand edge of the editor window. These correspond to the location of the errors with respect to the total size of the file. Clicking on these will take you to each error in turn.

Content Assist Use

We just saw the Content Assist function used to determine what data name to use. But Content Assist has many more uses.

Using Content Assist gives you a set of options to choose from, depending on your current context. So it provides data name selection as we have already seen. It also provides syntax support. The following are some examples:

1.       Place your cursor on a blank line in data division (say inside ZBNKPRT1.cbl on line 008600).

2.       Start to type 05 FRED PI and press Ctrl/space. This will give you a PIC to choose

3.       Choose PIC by double clicking (or cursor key and enter key).

4.       Type X(20) VA and press Ctrl/Space. Use your cursor key and enter key to select VALUE

5.       Type SP and Ctrl/Space and choose SPACES

6.       Place your cursor on a blank line of procedure division (say line 25000)

7.       Start to type EV and press Ctrl/Space and select EVALUATE

8.       Press Return to move onto next line and start to type ENand Ctrl/Space and choose END

9.       Press Return to move onto next line and start to type IFand Ctrl/Space and choose IF ELSE statement

10.   Press Return to move onto next line and start to type Iand Ctrl/Space

11.   Continue in this way and try a few experiments of your own.

Once you get used to using Context Assist, you will be able to type program code much more quickly than you have in the past.

Adding your own code template

In addition to the supplied code templates, you can add your own to suit your requirements.

1.       Select Window, Preferences and then Templates as shown below

2.       Select one of the existing Templates to see how they are formed.

3.       In there you can add a new Template by clicking the Newbutton and adding the required details.

Last Edit location

Often, when you are editing, you move around the file looking for some other piece of code. When you want to go back to the last edit position you can do this by selecting Ctrl/Q.

Find Procedure References

If you want to find  all places that a particular procedure name is used, you use the same method you used for finding data references by first clicking your mouse on a procedure name.

 

Next: Editing JCL in Eclipse


#EnterpriseDeveloper
#MFDS
#Eclpsesmarteditor