PreviousWorkgrouping Navigating Source CodeNext"

Chapter 6: Editing Programs

The Integrated Development Environment includes full editing capabilities, enabling you to edit your COBOL and Assembler source code (as well as other flat text files). These capabilities include the usual text editing features, such as text entry, cut and paste and others that make working with programs easier.

Follow these links for more information:

6.1 Selecting Columns and Lines

You can select text by dragging the mouse across the source. Dragging can:


Note: Even with column selection enabled, you can select whole lines by dragging in the prefix area of the lines you want. You must drag in the prefix area to select whole lines.

If you drag across out of the prefix area into the text area, you select only a rectangle of text. Although this rectangle may include all the text you want, it does not include the whole lines. If you then cut this rectangle, the text is cut but the empty lines remain intact. When you paste the rectangle, it pushes the existing text to the right. It does not push the existing text down onto subsequent lines.


6.1.1 Insert and Overtype Mode

The Insert or Overtype mode does not affect column selection and line selection behavior. The normal behavior inserts the pasted text. However, you can overtype existing text by selecting the text you want to overtype and then pasting the new text on top of it.

6.2 Undoing and Redoing Edits

Every editing change that you make is added to the undo stack. The undo operation takes the most recently performed operation from the undo stack and unexecutes it. For example, if you deleted a line, the undo operation inserts it again.

You can also undo undo operations, known as redoing. This is useful when you undo more edits than you intended.

6.3 Working with Copybooks

Copybooks are an integral part of most COBOL and Assembler programs. Using Mainframe Express, you can select which copybooks you want the editor to display.


Note: There is an option Hide All Copybooks on the View menu which you may want to use if you do not need the automatic display of copybooks. If you use this option, the editor displays a particular file contents only when instructed by debugging or browsing operations. If this option is turned off, the source copybooks are automatically opened and displayed.


A copybook in a program can be in one of three states: shown, hidden or closed.

6.3.1 Showing Copybooks

The editor displays the entire copybook beneath its COPY statement.

When you request Copybook > Show on the File menu, the editor first checks to see if it has information (from the compiler) about the existence of a copy statement at the cursor position. If it does, and that copybook has not already been loaded, the editor opens and displays the file. If the copybook has already been loaded but is just hidden, the editor redisplays the file.

If the program has not been compiled or there is no record of a copybook at that location in the compiler information, the the editor parses the line looking for various copy verbs (depending on the language). If it finds one, it extracts the filename then opens and displays the file.

There is an editor option Lock source files when opening them (Edit > General on the Options menu) which can be on or off:


Note: When loading large files in the source editor, fewer resources are used if you select Lock source files when opening them.


6.3.2 Hiding Copybooks

When you select Copybook > Hide on the File menu, the copybook disappears from the screen. All that is visible of a hidden copybook is its COPY statement. Hide performs different functions, depending on whether or not your program has been compiled:

6.3.3 Closing Copybooks

Close performs the following operations:

6.3.4 Implications when Changing COPY Statements

Supposing that you load a compiled program (when the editor has information about your copybook files). You can either use Show to display your copybook or it is displayed automatically.

If you then use Hide and edit the COPY statement to copy a different file, your next Show instruction displays the original copybook file.

In order to display the new copybook file, you must first close the original copybook, change the copy statement and then display the new copybook using Show.

6.4 Editing with Bookmarks

Bookmarks are a way of enabling you to mark a line in a file so that you can return to it at a later time. Setting a bookmark on a line displays a book icon in that line's prefix area. You can then:

6.5 Compressing and Expanding Source Code

When developing a source program, there are a number of operations that put marks in the prefix area. For example:

If you cannot see these marks, the prefix area may be hidden. To make it visible, right-click in the editing window and click Prefix Area on the popup menu.

As well as moving to the next and previous marked line with a single click, you can also compress the code to show only the marked lines, by clicking.

Compressing a file hides the unmarked code, so that only the marked lines are displayed. If there is more than one type of mark on the program, only the lines marked by the latest operation are shown. The previous marks are not lost but those lines are hidden.

The opposite of compressing lines is expanding them. This returns the display to normal, showing all lines. It keeps the cursor on the marked line it was on when you expanded it.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousWorkgrouping Navigating Source CodeNext"