PreviousDirectory Facility GNT AnalyzerNext

Chapter 7: Editor

The Server Express Editor is a very powerful yet easy-to-use utility for developing and editing COBOL source code. It enables you to edit COBOL programs, but you can also use it to create and edit other types of files.

7.1 Introduction

The Server Express Editor is referred to as "the Editor" for brevity.

The Server Express Editor has a hierarchical menu system that enables you to easily access each function with a simple keystroke.

When you use the Editor with Server Express, you can syntax-check and or debug your program from the Editor using simple keystrokes. When the syntax-check has finished, or you finish debugging, the COBOL system returns you to the Editor so that you can immediately resume work on your program.

In addition to features specific to COBOL program development, the Editor includes general text editing features for use on plain ASCII text files. You should not use the Editor on files produced by word processors, as formatting information embedded in the text by these word processors as control characters could be lost.

The Editor writes line sequential files, in which any characters with a value of less than ASCII 32 (space) are preceded by a null byte. Unexpected results sometimes occur if you load a file created or edited with the Editor into a non-Micro Focus tool which might not use null padding of ASCII control characters. You can disable this null padding by setting the N run-time switch to off (-N).

Throughout this chapter, references to pressing keys such as function or status keys imply the logical pressing and releasing of these keys rather than the physical keystrokes. Some keys are symbolic key names, which might not be present on your keyboard. See the appendix UNIX Key Usage Chart for details of the actual keystrokes required to achieve the documented function.

7.1.1 General Editing Features

The Editor provides these general editing features:

7.1.2 COBOL Program Editing Features

The Editor provides these features for editing COBOL programs:

7.2 Invoking the Editor

You can invoke the Editor from the Server Express Development Environment, or from the command line. To invoke it from the Development Environment, see the chapter Development Environment Menu System.

If you invoke the Editor from the command line, you can specify a file for editing; the Editor will start and open the specified file ready for editing. To invoke Editor, enter the command line:

editor [[pathname/]base-name[.ext]]

where the parameters are:

pathname/ The pathname for the file you want to edit if you choose to specify a file when you invoke Editor. If you do specify pathname/, it must consist of a valid operating system pathname which can include environment variables prefixed with a dollar sign ($). These environment variables are expanded by the shell. For example, /tmp/file, $HOME/tmp/file, and /tmp/$ABCD/file are all valid operating system pathnames provided that the environment variables are first set to valid operating system values.

Default: current drive

base-name The name of the file you want to load.
.ext The extension of the file you want to edit. By default Editor searches for and loads the first found extension to pathname/base-name in the order .cbl, .cpy, .cob, .bak, .CBL, .CPY, .COB, .BAK and spaces (no extension).

The total length of the name, including the extension and path, must not be more than 1024 characters. The following list shows the maximum length of pathname, filename and .ext.

Filename Component
Maximum Length
pathname < 1024 characters (including filename and extension)
filename < 256 (including any extension)

These limits are imposed by the run-time system. The operating system might have different limits.

If you do not specify a file, Editor opens a new file, and the prompt "workfile empty" appears on the screen.

As Editor is loaded, copyright notices and software version numbers are displayed. Then the initial Editor screen appears.

7.3 Exiting from the Editor

You can exit from Editor in any of the following three ways:

In all cases, the Editor first checks to see if there are any files or blocks which have been modified but not saved. If there are, the Editor displays a message of the form:

unsaved files exist - exit without saving Y/N ?

Where only a single file is loaded, the message is shortened to:

exit without saving Y/N ?

Pressing Y(Yes) tells the Editor to continue to exit and discard any unsaved modifications. Pressing N(No) abandons the exit, enabling you to save your changes. If you have many files open, you might find the facilities offered by the save file list boxes helpful in saving a number of modified files in one go. See the section The Save-file List Boxes for further details.

7.4 The Editor Screen

The screen that appears when you first invoke Editor displays a work area in which you can create a new file (or edit an old one), and three lines of text at the bottom of the screen: an Information Line and two lines displaying the options on the current menu. A fourth line is reserved for displaying messages such as reminders or errors; this is the message line and is initially blank. Each of these components of the Editor screen is described below.

7.4.1 The Work Area

The work area initially contains a single window in which all editing operations are performed.

If you invoke the Editor to create a new file, the message:

 . . . workfile empty. . .

appears at the top of the window.

If you are working with an old file, the line:

------------------------top of text-----------------------

marks the beginning of the text file, and:

------------------------end of text-----------------------

marks the end of all text entered in the file.

Since the Editor is designed for the development of COBOL programs, the work area by default is initially divided into three sections that conform to COBOL programming standards, although you can easily configure this. Using this default setting, each time you invoke the Editor the cursor is positioned in column 8, the first column in which you can enter COBOL code. You can enter text and other characters in columns 8 through 72 inclusive. Columns 8 through 72 correspond to areas A and B in a COBOL program.

You can enter text such as sequence numbers or indicators in columns 1 through 7. (Note, however, that these numbers are not mandatory and are only checked if you use the SEQCHK Compiler directive. See the chapter Directives for Compiler in your Server Express User's Guide for details.)

You can also use columns 73 onwards for comments you want to include in your program. Since the default margin settings are 7 and 73, you use the cursor keys (<left-arrow>, <up-arrow>, <right-arrow> and <down-arrow>) or Home and End keys to move into these two areas. You can change the default settings of the right and left margins so that you can use the Editor to create and view other types of files; this is described in the sections Entering Text and Configuring the Editor. Text lines of up to 250 characters can be created and viewed in an edit window.

7.4.2 The Information Line

The Information Line is the first line displayed by the Editor at the bottom section of the screen. Although the contents of this line vary, it appears on every screen invoked by the Editor. An example is shown in Figure 7-1.



Figure 7-1: The Information Line

The Information Line displays the following information:

7.4.3 The Menu

The menu always appears below the Information Line. It displays the options that you can access from the current menu. The number of options displayed varies according to the menu. When you first invoke Editor, the screen displays the main menu . You access two other menus - the Alternate menu and the Control menu - by pressing and holding down the Alt and Ctrl keys, respectively. The Alternate and Control menus display further options available in the Editor. See the appendix UNIX Key Usage Chart for details of the actual keystrokes required to emulate the Alt and Ctrl keys.

Help

The role of function keys can vary according to the particular menu displayed. However, one function key carries the same function throughout the Editor system. This is the F1=help option. When you press F1 from any menu, you access an on-line help system which displays information about the current function as well as defining the options available from that function. If there is more than one screen of help text, pressing F1 again displays the next screen. To return to the current function from the help screen, press F1 (from the last screen) or the Space bar.

Escape

The Escape option, though not present on every Editor menu and submenu, is consistent in its use where available: when you press Escape, you return to the previously displayed screen or function. Pressing Escape from certain menus causes a reminder to appear on the message line (the last line on the screen). For example, if you press Escape from the main menu without saving your file, the Editor prompts you to make sure you want to do this. When you are editing a single file and you press Escape at the main menu, you exit from the Editor. If you have loaded more than one file for editing, you are presented with the next file to edit.

7.4.4 The Message Line

The message line is the bottom line of the screen. This line is reserved for system messages such as error messages and reminders.

7.4.5 Multiple Files and Views

It is possible to edit more than one file at a time, or to open windows on different parts of the same file, as detailed below. The procedures for doing these things are explained in the section Using Edit Windows.

You can load a program and its copyfiles into one window, and bring any one of them to the front to view and edit. The others are temporarily hidden.

You can also open more than one window, and load one or more files into each of them. This enables you to see several files at once if you want. As with a single window, you can bring any file you want to the front of a window. There is still only one menu, since you can only edit one thing at a time: the menu applies to the window which you have selected.

If you load the same file into two or more windows, you can see two or more views of the file at once. This does not create multiple copies of the file - changes you make to a file in one window are reflected in any other window containing that file as soon as you select the window.

7.5 Functions

This section explains how to perform editing procedures. The section Using Edit Windows explains how you can edit more than one file at a time.

7.5.1 Loading a File

If you are creating a file or files from scratch, you do not need to load anything: you can just start typing in the window which is present when the Editor starts up. See the next section for details of the functions available for entering new text.

Editor provides two ways in which to load files for editing. You can either specify a filename at a file prompt or you can select the filename from the Directory Facility. This next section briefly describes these two methods. For details on how to access files which have already been loaded into the Editor, see the section Accessing Files in a Window later in this chapter.

You access the Load-file menu by pressing F3 in the Editor's Alternate menu. The Information Line and menu shown in Figure 7-2 appear on your screen.



Figure 7-2: The Load-file Menu

The load-file function inserts the specified file at the current cursor location. This makes it easy to build a program from individual pieces of code stored as separate files. For each segment, just move the cursor to the insertion point and use Alt+F3.

7.5.1.1 Using the File Prompt

The file prompt appears below the Load-file menu. It displays the current path by default. You can change to another drive and directory by typing over the current one. You can use Backspace to delete the characters at the file prompt.

You enter the name of the file you want to edit at the cursor position. If you do not specify a filename extension, the Editor searches for that filename using a default extension list. You can change this default configuration to the extensions you want Editor to search for. See the section Defining File Search Extensions later in this chapter for details on the search order used in your given environment and on how to change these defaults.

After you type the filename, press Enter. The system loads the file for editing: the Editor main menu appears, with the file displayed in the work area of the screen.

7.5.1.2 Using the Directory Facility

You use the Directory Facility to display the names of all files available for editing. You select the filename of the file you want to edit from this listing.

To access the default Directory, press F2=directory on the Load-file menu. The default directory displays those filenames with the extensions defined in the extension list (see the section Defining File Search Extensions later in this chapter for details). If you have configured the Editor to search for either additional or different extensions, the directory displays files with those extensions. If you want to load a filename with another file extension, type the extension at the file prompt. Then when you press F2=directory, the listing of all files with that extension is displayed.

To select a filename from the directory listing, use the <up-arrow> or <down-arrow> keys to place the cursor on the desired filename and press Enter. The selected filename appears at the file prompt on the Load-file menu, and you can press Enter again to load the file into Editor.

7.5.1.3 File Access Considerations

If a file is specified for loading, either at the File prompt on the Load-file menu or as a parameter if the Editor is started from the command line, the following search method is used to locate the file:

  1. The file requested is compared with all files currently loaded in the Editor - if a match is found, the Editor presents the already loaded file for editing.

    The Editor matches files requested or already loaded without a path description to those specified with a path description. It does not match filenames specified with different paths. For example, /programs/myapp.cbl matches myapp.cbl; /programs/newapp.cbl does not match /demo/newapp.cbl.

    To edit two or more files with the same name from different paths, you must ensure that when you specify each file for loading, you specify the full path. If you do not, the Editor presents the same file each time you load.

  2. If no match is found among files already loaded, the Editor searches for the file on disk. If a path is specified, the Editor looks only in the specified path. If no path is specified, the Editor looks only in the current directory. If you do not specify a filename extension, the Editor searches for that filename using a default extension list. You can change this default configuration to the extension you want Editor to search for. See the section Defining File Search Extensions later in this chapter for details on the search order used in your given environment and on how to change these defaults.

  3. If the file is not found either with a specific name or using the search extensions, the following message is displayed:
    file not found with defined extensions

If a file is located on disk, the Editor seeks to prevent multiple attempts to update the file when used in an environment with file locking capability (for example a multi-threading environment, or a multi-user environment using networking software). When a file is opened to be loaded into Editor one of the following conditions is true:

7.5.2 Entering Text

This section describes the keys used to enter text in a window. It shows you how to change margin settings and turn on and off the word-wrap feature of the Editor.

As you enter text, the Editor beeps when the cursor approaches the right-hand margin. This is a reminder that you are nearing the end of the line.

The current line (that is, the one on which the cursor is positioned) is always highlighted.

7.5.2.1 Caps Lock

The Editor accepts text entry in either upper- or lower-case alphabetic characters. To set text entry to upper-case characters, you press Caps Lock. This is a toggle which you press to turn the key on and off. The status of the Caps Lock key is displayed by the change in appearance of the Caps indicator on the Information Line. To set entry to lower-case characters, press Caps Lock again.

7.5.2.2 Num Lock

The Num Lock key is a toggle key similar to the Caps Lock key. You press Num Lock to lock the numeric keyboard so that it produces numbers rather than cursor movement key functions. The status of the Num Lock key also appears on the Information Line; the Num indicator is highlighted when Num Lock is on.

7.5.2.3 Word-wrap

When you reach the end of the line, the word-wrap feature (on by default) moves the last word to the next line if the number of characters in the word exceeds the available character positions on the current line. If word-wrap is off, the word splits over the two lines. When word-wrap is on, the indicator Wrap is displayed on the Information Line.

The word-wrap option is located on the Control menu. You first press Ctrl to access the Control menu. Then, while holding down Ctrl, you press F8 which toggles word-wrap on and off. The default setting of the word-wrap option is configurable. See the section Configuring the Editor for more details.


7.5.2.4 File Lock Indicator

If you are using the Editor in an environment which supports file locking, whenever you load a file to which you have exclusive access, the file lock indicator (Lck) is displayed on the Information Line immediately before the word-wrap indicator. If you are running in an environment that does not support file locking or a lock could not be obtained, the indicator is not displayed. Further details of when file locks are granted or refused can be found in the section File Access Considerations.

7.5.2.5 The Enter Key

The Enter key has three functions in the Editor:

This section discusses the Enter key in its role as the carriage return key.

When you are entering text and have not reached the end of the current line, you use Enter to position the cursor on the next line. The first time you press Enter, the cursor returns to the same column in which the previous line began.

For example, the current line is indented 4 spaces from the left margin and begins in column 12. When you press Enter once, the cursor moves to column 12 on the next line. If you press Enter again, the cursor returns to the beginning of the next line (column 8).

When you are working with a file you have already created, pressing Enter from any character position on the current line places the cursor at the first character entered on the next line. However, if Insert mode is "on" (set by the Ins key), pressing Enter inserts a new line below the current line and moves all characters to the right (including the character at the current cursor position) to this new line.

7.5.2.6 Margins

The default margin settings for standard COBOL files (.cbl, .cob, .cpy, .bak, or spaces) conform to COBOL program development standards. The left margin is set at column 7, the right margin at 73, enabling you to enter your source code between those columns. You can use the remaining columns (1 through 7 and 73 through 250) for sequence numbers and comments. For HTML source files (.htm, .html, .shtml, .HTM, .HTML, .SHTML), the margins default to 0 through 251.

The section Configuring the Editor describes how to set up new margins or adjust the defaults. For example, you can configure the Editor to set different margins when loading files with specific extensions. The remainder of this section describes margin handling and functions in terms of the default COBOL margin settings.

If a file loaded into the Editor does not have one of the standard COBOL extensions, the margins by default are set to 0 and 81 (again, you can configure this).

If margins other than the COBOL margins are selected, tabbing includes tabs at columns 4, 76, 80 and every 4 columns up to column 248 (with COBOL margins, the tab keys skip these positions).

You can change the margins to settings between columns 1 and 250, as well as take advantage of the full window, by using the F5=margins option on the Control menu. This option consists of a Margins menu which displays various ways to change margin settings.

From the Editor main menu, use the appropriate key to access the Control menu (shown in Figure 7-3).



Figure 7-3: The Control Menu

Press F5=margins. The Margins menu appears on the screen as shown in Figure 7-4. Two vertical bars might also appear in the window, displaying the boundaries of the current margin settings. You see them if they are in the region of text enclosed by the window.



Figure 7-4: The Margins Menu

There are various ways to change the margin settings depending on the results desired. These are listed below:


Note: You can enter text outside of the margin boundaries by using the cursor movement keys (<left-arrow> and <right-arrow>) Home, or End keys to position the cursor in these areas. However, when you press Enter, the cursor remains in the current area. You must use the cursor movement keys to reposition the cursor inside the margins.


If you change the margin settings for a window, they remain set until you close the window. A new window has its margins set to those defined by the INIT-MARGINS configuration command (see the section Configuring the Editor for more details). If no INIT-MARGINS command has been specified, the Editor defaults to using COBOL margins (7 and 73) for each new window. If a file is subsequently loaded into the window, the margins are reset to the values defined for the particular file's extension. If no margins are defined for the extension, the margins used when the window was created are retained.

Press Escape to continue editing with the currently set margins.

7.5.3 Inserting, Deleting and Restoring Text

This section describes the keys and function key options that you use to insert and delete text. It also describes how to restore text that you have deleted in the same editing session. This section is divided into three subsections:

Some of the keys you use to insert and delete characters can also be used to insert and delete words. Those procedures you use to insert and delete words, in turn, can be applied to inserting and deleting lines of text. However, each of the above categories also has its own specific function key to provide the fastest and easiest way of executing the procedure.

7.5.3.1 Characters

This section describes how to insert and delete individual characters from your text. You can restore in sequence up to 250 characters deleted at a time during the current editing session.

Inserting Characters

You can insert text between characters, words and lines by turning on Insert mode. The Ins key is a toggle key that turns this mode on and off. When Insert mode is on, the Ins indicator on the Information Line appears highlighted. The shape of the cursor also changes.

To insert a character on a line, move the cursor to the character position before which you want to insert text. Insertion is always made at the cursor position with the current text moved one character position to the right. Then type the character.

Remember that when you press Enter while Insert mode is on, all the characters to the right and including the current cursor position move to the next line in the window.

Deleting and Restoring Characters

You can use three different keys to delete characters from the screen. These are Space (with Insert mode off), Del and Backspace.

Pressing Space when Insert mode is off overtypes the character at the current cursor position with a space.

Del erases the character at the current cursor position and causes the text following the deleted character to move one character space to the left.

The Backspace key functions differently according to the setting of Insert mode. When Insert mode is on, Backspace behaves similarly to Del: it deletes the character to the left of the cursor position and causes all text to the right to move one character position to the left.

When Insert mode is off, pressing Backspace deletes the character to the left of the cursor position and restores any characters that were previously overtyped.

7.5.3.2 Words

This section describes how to insert and delete entire words from your file. You recover deleted words using the same method to recover deleted characters.

Inserting Words

Inserting entire words into your text is the same as inserting characters. You place the cursor at the position at which you want to insert text. Then, with Insert mode on, you begin typing the inserted material; the characters to the right, including the cursor, position move further to the right.

Deleting and Restoring Words

The Editor enables you to delete entire words with one keystroke. The options to do this are located on the Alternate menu and are defined by F9=untype-word-left and F10=delete-word-right.


Note: Editor defines a word as a string of characters immediately preceded and followed by one or more spaces.

If the cursor is positioned on a non-space character, deleting a word left/right means deleting all characters left or right until a space is encountered.

If the cursor is positioned on a space character and the adjacent characters left or right are spaces, deleting a word means deleting all spaces left or right until a non-space character is encountered.


The behavior of the F9=untype-word-left option depends on the setting of Insert mode. If Insert mode is off, F9 replaces the word with spaces, and text after the word does not move. If insert mode is on, F9 erases the word and drags the text after the word to the left.

You can recover the deleted word by pressing F7=retype-char on the main menu.

Press F10=delete-word-right on the Alt menu to delete the word to the right of the cursor position. You can recover the deleted word by pressing F8=restore-char on the main menu.

7.5.3.3 Lines

The Editor offers various ways to insert and delete entire lines of text. All of the menu options for these functions are located on the main menu.

Inserting Lines

You can insert entire lines of text in your file using either Insert mode or the F3=insert-line option on the main menu.

Using Insert mode (by pressing the Ins key), you insert a blank line below the current line by positioning the cursor at the end of the current line and pressing Enter. The cursor moves to the beginning of the blank line.

To insert a blank line above the current line in Insert mode, place the cursor in the first column of the current line and press Enter. The blank line is inserted, but this time the cursor remains with the current line.

A faster way to insert lines is to use the F3=insert-line option. This inserts a line above the current line. Position the cursor anywhere on the current line and press F3=insert-line. The existing text moves down one line while the cursor remains in place.

Deleting and Restoring Lines

You can delete an entire line of text using one keystroke. Place the cursor on the line you want to delete and press F4=delete-line. The line is deleted and the text below moves up one line.

Any lines that you delete in an editing session remain in a buffer so that you can restore them to the file. The system restores the most recently deleted line first. The buffer is used by all windows, enabling deleted lines to be restored in any window.

Restored lines are inserted on the line above the cursor. To restore the deleted lines, place the cursor on the line below the one where you want the insertion. Then press F6=restore-line. You can press F6=restore-line again to insert the next line or move the cursor to another location to restore the next line in the buffer. You can use the combination of F4=delete-line and F6=restore-line to move lines of text from one location in your file to another. The action of restoring a line removes that line from the buffer. When all of the deleted lines held in the buffer have been restored, the Editor beeps at further attempts to restore.

Repeating Lines

The Editor also enables you to repeat the current line. It inserts this line above the current one. You do this by using the F5=repeat-line option.


Note: You can copy multiple consecutive lines to another location in your file. To first store them in the buffer, alternately press F5=repeat-line and F4=delete-line for each consecutive line you want to copy. Then move the cursor to the desired location and repeatedly press F6=restore-line until all the lines have been copied to the new location.


Splitting and Joining Lines

Other features of the Editor enable you to split a line of text and, optionally, join it back together. You can then insert text at a specific character position or eliminate unnecessary gaps in your file. The Alt+F5=split-line and Alt+F6=join-line options are located on the Alternate menu.

Pressing Alt+F5=split-line splits a line at the current cursor position. All text from the cursor to the end of the line moves to the next line, causing the following lines of text to move down one line. The columns occupied by the text remain the same.

Pressing Alt+F6=join-line joins lines at the current cursor position. To join lines, place the cursor on the first of the split lines. Press Alt+F6=join-line. The text on the line below appears to the right of the word on the line containing the cursor. If the number of characters on the second line exceeds the available space on the line above, the Alt+F6=join-line feature moves as many whole words as possible and then places the cursor on the second line with the remaining text. The join-line option is particularly useful for formatting paragraphs. To do this, position the cursor on the first character of a paragraph and press Alt+F6=join-line until the paragraph is formatted.

7.5.4 Moving Through a File

You can move the cursor to any location in your file by using special keyboard keys, key combinations and function keys defined on the Main and Control Menus. This section lists the different ways you can move through a file and describes the use of the keys associated with the particular operation.

You use the cursor movement keys (<right-arrow>, <down-arrow>, <left-arrow> and <up-arrow>) to place the cursor anywhere in the file. However, there are quicker ways to position it at specific locations.

7.5.4.1 Moving Across a Line

You move the cursor back and forth across a line using Home, End and Tab, and the F9=word-left and F10=word-right function keys defined on the main menu.

Home and End Keys

The effect of using the Home and End keys depends on the current cursor position and whether text exists in each region of the line. The following sequence for the Home and End keys assumes that the current cursor position is between the margins, not at the beginning of a line, and that text only exists in the text area between the margins.

Pressing Home once positions the cursor at the left margin on the current line. Pressing Home again then places the cursor in column 1 of your window, regardless of the margin setting. If you press Home a third time, the cursor moves to column 1 of the first line in the window.

The function of the End key is opposite to that of the Home key. You press End to position the cursor after the last character on the line. Pressing End a second time moves the cursor just outside the right margin. Pressing End again moves the cursor to column 250. If you press End one more time, the cursor moves to the column 250 of the last line in the window.

If the cursor is in the left or right margin areas, pressing End first positions the cursor after the last character in the area, and pressing End again moves the cursor just outside the area.

If you were editing a non-COBOL file, you would probably not press these keys more than twice in succession. However, for COBOL program development, you might use these keys to position the cursor inside columns 1 through 7 and 73 onwards for entering comments.

Tab Keys

You can use Backtab and Tab to move the cursor four positions to the left or right. To indent an existing line of text, place the cursor at the beginning of the first word on the line. Then press Ins to turn on Insert mode, and press Tab. The entire line moves four character positions to the right.

Moving to the Next or Previous Word

The Editor also enables you to move word by word through the screen using the F9=word-left and F10=word-right options on the main menu. It is important to remember that Editor defines a word as a string of characters preceded and followed by a space, as well as two or more contiguous spaces.

Press F9=word-left to move the cursor to the first character of the word to the left of the current cursor position. If the cursor encounters two or more spaces, it moves to the first of these spaces.

Using the F10=word-right option moves the cursor to the beginning of the next word to the right. Again, if it encounters two or more spaces, it stops on the first of these spaces.

7.5.4.2 Moving to the Next/Previous Line

As you reach the end of a line, pressing Tab or F10=word-right (described above) positions the cursor on the first tab position or word on the next line. Pressing F9=word-left eventually moves the cursor to the first word encountered on the previous line. However, a more expedient way to move the cursor to the next line is to press <down-arrow> or Enter (with Insert mode off). Simply press <up-arrow> to position the cursor on the previous line.

When you are entering text, you press the Enter key to position the cursor at the first character position on the next line. However, if word-wrap is on, when you reach the end of the line the text you are typing automatically wraps to the following line. If you are working with a previously created file, pressing Enter places the cursor on the first character of the following line.

7.5.4.3 Moving to the Beginning/End of a File

When used with Ctrl, the Home and End keys place the cursor at the beginning and end of a file. These two functions are defined on the Control menu.

Press and hold down Ctrl to display the Control menu. The Home/End (of text) option is displayed on the second line. Continue to hold down the Ctrl key and press Home to position the cursor at the top of the file, the cursor moving to the first column to the right of the left margin. Pressing Ctrl+End places the cursor at the end of the file (on the "end of text" indicator) the cursor retaining the same column position from which it moved.

7.5.4.4 Moving Up/Down Through a File

You use specific keys or combinations of keys to view parts of your file not visible in the window. You can also scroll through the file to position the cursor at another location.

Page-up and Page-down Keys

The Page-up and Page-down keys display the previous or following page of text not currently visible on the screen. You simply press Page-up to view the previous page, or Page-down to display the following page.

The height of a window determines the size, in lines, of a page. The page height is the number of text lines available in a window minus 1. For example, if a window is 19 lines high, excluding the border, the page height is 18 lines.

Page-up and Page-down behave differently when used with the Ctrl key. These two keys are defined on the Control menu. Press Ctrl to view the Page-up/Page-down option.

Press Ctrl+Page-up to move the cursor up 200 lines of text. Press Ctrl+Page-down to move the cursor down the same number of lines.

Scrolling

There are three different ways to scroll through a file. These are described below.

7.5.5 Tagging Text Lines

You can use the tag facility of the Editor to tag a text line so that it can be selected by other keystrokes while editing the file. Any number of text lines can be tagged while editing the file.

To access the tag facility, press F7=tags in the Control menu. The Tags menu shown in Figure 7-6 appears.



Figure 7-6: The Tags Menu

Setting a Tag

A tag is set by pressing F2=set-file-tag. The tag is set on the current text line. The tagged line is displayed using an alternative screen attribute to distinguish the tagged lines from other lines in the displayed file. Any text line in a file or block can be tagged.

Clearing a Tag

A tag is cleared from the current text line by pressing F3=clear-tag. All the tags are cleared from a file or block if F4=clear-all-tags is pressed. Tags are only maintained while the file is being edited. If a file is saved and escaped from, the file tags are lost. Deleting a tagged text line also clears the tag. If you insert or restore blocks that included tagged text, the tags are lost.

Locating a Tag

A tag can be located by pressing F7=prev-tag or F8=next-tag. The search is made from the current text line. If, when searching, the start or end of the file is reached, searching wraps to the end or start of the file, depending upon the search direction. When a tag is located, the Editor positions the cursor on the tagged line. The column number is unchanged.

7.5.6 Finding and Replacing Text

You can use the Find facility of Editor to locate a string of text in a file and optionally replace it with another string. You can either replace individual occurrences of a string of text or globally replace all of them. As you use this facility, you can edit the file but you cannot use those editing functions that require the use of function keys. This section describes all of the features of the Find facility.

The Find facility of the Editor is region-orientated with the search area being defined by the cursor position in relation to the current margins when the search is begun. Depending on the particular margins you are using, a line can consist of up to three different regions : the region before the left margin, the region between the left and right margins, and the region beyond the right margin. Taking COBOL margins as an example, if the cursor is in column 5 when the search is started, only columns 1 through 7 of each line are searched. Similarly, if the cursor is in column 25, the search region is columns 8 through 72. This means that if a word you are searching for overlaps a two regions, the Find facility does not recognize the word, since it is not wholly in the search region. To find the word, you must adjust the margin settings so that the word does not cross regions.

To access the Find facility, press F2=find in the Control menu. The Find menu (including the Information Line) appears as shown in Figure 7-7.



Figure 7-7: The Find Menu

As there is a variety of functions provided by the Find facility, the functions have been split between two menus. A Control menu is accessible from the Find menu; this is the Find Options menu, shown in Figure 7-8.



Figure 7-8: The Find Options Menu

Refer to these two menus as you read through this next section.

7.5.6.1 Entering the Text String

You use the Find and Replace fields below the Find menu to enter the string of text you want to locate and optionally replace in your file. When you first select the Find option, the cursor appears in the Find field.

There are a number of ways in which you can enter the text string to be found and replaced, in the Find facility:

7.5.6.2 Moving Through the Find and Replace Fields

Pressing F2=set cycles you through the Find and Replace fields and then back to the window. You can use Tab and Backtab to move backwards and forwards between the two fields.

7.5.6.3 Clearing the Find and Replace Fields

Pressing Ctrl+F4=clear enables you to clear the Find and Replace fields so that you can enter another text string. All characters from the cursor position to the right are deleted.

You can use Space, Backspace, or Del to erase characters from the Find and Replace fields. However, you should be careful using Space in the Replace field - you could add unexpected trailing spaces.

7.5.6.4 Locating the Text String

Once you have entered the text string in the Find field you can search backwards and forwards through the file to find each occurrence of the string. To search forward through the file, you press F10=FIND-fwd.

Each time the cursor locates the text string, the following message appears at the bottom of your screen:

"F8=forward" to replace, "F10=forward" to find next

You have the option of either continuing with the search or replacing the text string at this time (see the section Replacing the Text String below). If you use F8 and there is nothing in the Replace field, the find text string is deleted.

You can move backward through the file to locate the previous occurrence of the text string by pressing F9. Each time the Editor finds an occurrence of the text string, the message:

"F7=back" to replace, "F9=back" to find previous

appears at the bottom of the screen. You can continue to locate each previous occurrence, or you can choose to replace the text string with the text string in the Replace field (see below).


Note: If you press Enter when the cursor is in the Find or Replace field, the Editor finds only the first occurrence of the string.


There are two other options which you can specify to further define the text you want to locate. By default, the cursor searches for a text string without attention to case. You can specify a case-sensitive search by pressing Ctrl+F6=case. This causes the Editor to find only those occurrences that match the case specified in the Find field. When you specify case, the word "case" appears on the Information Line. For example, if case is turned off and you specify "Abc" as the find string, the Editor finds both "abc" and "ABC", If case is turned on it finds only "Abc". To turn off case-sensitivity, press Ctrl+F6=case again.

The three punctuation characters comma (,), period (.) and semicolon (;) are, by default, treated as spaces during a search. However, you can include these characters in the search by pressing Ctrl+F5=punc. The abbreviation "punc" appears on the Information line. Pressing Ctrl+F5=punc a second time turns "punc" off.

7.5.6.5 Moving to a Specific Line

You can also move to a particular line of text by specifying its line number. You do this by pressing F3 (line). The word "Line" replaces the word "Find" in the Find field. A message appears at the bottom of the screen prompting you to enter the line number at the cursor position. Then press Enter. The specified line becomes the current line on the screen.

7.5.6.6 Replacing the Text String

You can replace each occurrence of a text string either individually or globally.

Individual or "Step" Replacement

When you first access the Find menu, the Information Line displays the indicator "stp" (for "Step"). This means that the replacement mode is set to step to each occurrence of the text string specified in the Find field. The first time you press F8=REPLACE-fwd to locate the next text string, the cursor moves to that text string. The same message that appears when you use press F10=FIND/fwd also appears when you press F8=REPLACE-fwd:

"F8=forward" to replace, "F10=forward" to find next

If the cursor is not currently on an occurrence of the text string, it moves to the next occurrence the first time you press F8. Pressing F8 a second time confirms that you do indeed want to change the text string and makes the replacement.

You use F7=REPLACE-back to replace the previous text string in the file. If the cursor is not currently on an occurrence of the text string, it moves back to the previous occurrence the first time you press F7. Pressing F7 a second time confirms that you do indeed want to change the text string and makes the replacement.

The difference between the F7/F8=REPLACE-back/fwd function and the F9/10=FIND-back/fwd function is that the former replaces the text string while the latter simply finds the next or previous occurrence. You can use them in conjunction with each other depending on the desired results.

Global Replacement

You can choose to replace all occurrences of a text string with another, using global replacement. The cursor moves either forward or backward from the current cursor position through the file making all changes.

To change to global replacement mode, press Ctrl+F9=repl-mode. The indicator "all" replaces "stp" on the Information Line.

To go forward through the file, press F8=REPLACE-fwd. The following message appears:

WARNING: next "F8=forward" will replace ALL remaining occurrences

This warning message reminds you that global replacement mode is active.

When you press F8=REPLACE-fwd a second time, the cursor begins its movement through the file, changing each occurrence of the text string on its way. The cursor stops to the right of the last change made. The number of occurrences replaced appears on the Message Line at the bottom of the screen.


Note: You can interrupt the search or replace process at any time by pressing Ctrl+Break


7.5.7 Moving and Copying Text

You can move or copy text from one part of a file to another using the Editor's Block function. You first copy or move the block of text to a temporary buffer in which you can edit it. You then insert it anywhere in your current file or into any other file loaded into an Editor window. You can define and use multiple blocks in the same Block session. Even entire files can be loaded as a block into the current file.

These features are displayed on the Block menu, available from the Control menu. This section describes all of the functions available to move or copy blocks of text.

To access the Block menu, press F3=block in the Control menu. The word "Block" appears on the Information Line above the menu shown in Figure 7-9.



Figure 7-9: The Block Menu

7.5.7.1 Defining Blocks of Text

You must first define the block of text you want to copy or move to another location in the file. Press F4=define-block to begin this process. The submenu shown in see Figure 7-10 appears displaying further options.



Figure 7-10: The Block Definition Menu

The instruction on the Message Line at the bottom of the screen tells you to use the cursor movement keys (<down-arrow> and <up-arrow>) to mark the block of text. As you press <down-arrow>, the marked text appears highlighted. You press <up-arrow> to unmark the text. You can also use Page-up, Page-down, Home and End keys to mark a larger block of text.

You can use the F2=find option on this menu to locate the string of text you want to include in the block. This enables you to access the Find facility of the Editor (described above). When you press F9=FIND-back or F10=FIND-fwd, all text from the current cursor position to the first occurrence of the text string specified in the Find field becomes part of the block. When you exit the Find facility, you return to the Block menu shown above.

You can define multiple blocks of text for insertion elsewhere in your file. To do this, you simply define one block of text at a time, which is then placed in a buffer.

7.5.7.2 Moving/Copying Blocks of Text

You now have the option of copying the marked text or removing it entirely from its current location. If you want to simply copy it to another location in your file, press F3=copy-to-block. If you want to move it to another location, press F4=remove-to-block. You can also exit from this Block submenu without defining a block by pressing Escape.

When you press F3=copy-to-block or F4=remove-to-block, the initial Block menu reappears. You can now move to any location to insert the defined block of text.

Place the cursor on the line before which you want to insert the block of text. Press F3=insert-block to place the entire block of text in this location. You can continue to insert a copy of this block of text anywhere in your file.

If you defined multiple blocks of text, you can use F6=restore-block to restore the blocks in the reverse order in which you defined them. First, place the cursor on the line above which you want the last-defined block to appear. Then press F6=restore-block. Then move the cursor to the location where you want the next block in the buffer to appear and press F6=restore-block again.


Note: When you move or copy a block of text, the Editor places the block in a stack. When you define multiple blocks to be moved or copied, they are located in the stack in the reverse order in which you selected them. For example, the second block selected sits on top of the first selected block.

When you press F3=insert-block, a copy of the block at the top of the stack is inserted at the desired location. You can then insert this same block at other locations in your file.

Pressing F6=restore-block removes the block from the top of the stack and inserts it at the desired location.


7.5.7.3 Editing Blocks of Text

If you want to edit a block of text before you insert it in a file, press F2=edit-block on the initial Block menu. The block appears alone in the work area of a screen below which is the Editor main menu. All of the Editor functions are available from this menu. Notice that the filename on the Information Line is "Block".

The cursor is positioned at the left margin if this is the first time the block has been edited or at the previous cursor position if the block has been edited before. This cursor positioning can be useful if a particular string is to be edited before each insertion (when the block is to be inserted in many places).

Once you have finished editing the block of text, press Escape to return to the current file. Then, to return to the Block menu, press Ctrl+F3=block. Move the cursor to where you want to insert the block, then press F3=insert-block or F6=restore-block.

As part of the function of block editing, you can load an entire file into a block (see the section Loading a File). The file is opened and copied into the block. The file is then closed. You can also save the block as a file (see the section Saving a File). Each save operation is performed as if a new file is being created. If a file had been loaded into a block which was now being saved to the same filename, the Editor warns you that this file already exists on starting the save operation.


Note: If you exit Editor while there are still modified blocks of text in the buffer, the following warning message is displayed on the Message Line below the Editor main menu:

unsaved blocks outstanding in Editor - exit without saving? Y/N 

Saving the file does not automatically save blocks of text. If you want to save the blocks of text remaining in the buffer, press N (No) in response to this message. Then press Ctrl+F3=block to return to the Block menu.

Now press F2=edit-block to display the last block you defined. (To save all blocks, you must combine them into one block - see below.) The Editor main menu appears at the bottom of the screen. You can now save this block by pressing Alt+F4=save-file. During your next editing session, you can load this file into any location in your current working file.

7.5.7.4 Combining Blocks of Text

If you have multiple blocks in the stack, you can combine these blocks into one block and then save this block as one file or insert it in your current file.

To do this, press F2=edit from the Block menu (Ctrl+F3=block). The first block on the stack appears on the screen. The Editor main menu is also displayed.

Now press Ctrl+F3=block to invoke the Block menu again. Then press F6=restore-block. The second block appears on the screen on the current line. You can now either save the combined block as you would save any other file or insert it into your current file. To insert this block into your current file, press Escape twice. Your main file appears on the screen. Once again, press Ctrl+F3=block. Then from the Block menu, press either F6=restore-block or F3=insert-block. The combined block now appears on the current line.

7.5.8 Saving a File

The procedure for saving a file is similar to that for loading a file. You invoke the Save-file option by pressing F4=save-file in the Editor Alternate menu. The Information Line and menu shown in Figure 7-11 appear on the screen.

The Information Line is the same as that for the Load-file option except for the name of the function. The Save-file menu displays the same options as the Load-file menu: F1=help, F2=directory. Two list box functions are also accessible from this menu. These list boxes give you the ability to save one or more files at a time and are described in the section The Save-file List Boxes.



Figure 7-11: The Save-file Menu

The F3=backup-file option enables you to have a backup file automatically created when you save a file. Pressing F3=backup-file alternately selects and deselects the option. When selected, "Backup" appears on the status line. The backup-file option renames the original file with a file extension of .bak and gives the edited file the original filename and extension. The default setting of this toggle is configurable. See the section Configuring the Editor for more details.

Additional information is displayed at the file prompt the first time you are saving a file. The system supplies the extension .cbl as the default filename extension for the new file although this is configurable. See the section Configuring the Editor. You enter the name you want the file to have. If you want to change the default filename extension to any other extension, just enter the filename followed by a period (.) and the new extension.

If you are saving a file that already has a name, its filename appears by default at the file prompt. You can retain this or enter another one. Once the desired filename is shown at the file prompt, you press Enter to save the file. For details on how to save multiple files with their current names, see the section The Save-file List Boxes.

7.5.8.1 The Save-file List Boxes

The Save-file list boxes are used to specify one or more files that you want to save in one operation. They contain the names and details of files you are editing. You bring up one of the lists, mark those files you want saved, then give the go-ahead to save them.

F7=files-in-window brings up a list of all the files which can currently be viewed in the selected window, for instance a program and its copyfiles.

F8=list-all brings up a list of all the files which have been loaded into the Editor, regardless of which window they can be seen in.

The steps are as follows:

  1. Ensure that the window you want to work in is selected. From the main menu, select the Save-file menu (press F4=save-file in the Alternate menu) and press F7=files-in-window or F8=list-all as appropriate.

    The appropriate list box is displayed. Figure 7-12 shows the "list-all" list box for the Save-file menu.



    Figure 7-12: The List-all (Save) Listbox

    For each file, the length in lines is shown, together with an "m" indicator in the Mod column if the file has been modified. A third indicator shows whether the file is marked for saving, and if so, whether a backup is to be kept.

  2. Mark a file which you want to be saved, by moving the highlight over its entry using the up and down cursor keys. (If there are too many entries in the list to be shown in the box, they scroll when the highlight comes to the top or bottom of the box. If the entry is too wide to fit in the box, use the left and right cursor keys to scroll it.)

  3. Press F2=toggle-save to rotate between selections in the Save column. If the column entry is blank the file is not saved. Save means the file is to be saved. Bak+Save means the existing file on disk is to be renamed with a .bak extension and the file saved. The setting of the "Backup" toggle on the Load and Save-file menus is not connected with the Bak+Save setting of this toggle.

  4. Use the cursor keys and F2=toggle-save key until you are happy with your selections, then press Enter to perform the save. Only those files marked Save or Bak+Save are included.

In some circumstances the Editor might not be able to save a file you have marked. In this case, it pauses and tells you so, and invites you to press Space to continue. One likely cause is that the file has not been saved before, and so has no name. In this case, the message:

no name active on file, save from menu - press space bar to go to next file

is displayed. In this case you must save the file manually using the File prompt on the Save-file menu. Once the file has a name and exists on disk you are able to subsequently save it using the list boxes.

When the save operation is complete, the list box is removed leaving the workspace as it was.

If you want to escape from the list and return to the Save-file menu without performing a save, press Escape rather than Enter.

7.5.8.2 File Access Considerations

When saving a file the Editor displays messages dependent on the conditions controlling file access.

file access not exclusive, no save permitted
file access read only, no save permitted.
file already exists and is locked, no save permitted
file access not exclusive, saved to filename.$$$ - press space to continue

7.5.9 Using Edit Windows

This section describes the creation and use of edit windows.

Initially the Editor has one window which is used to contain a textual view of the line sequential file being created or updated. The line sequential file can contain up to 999,999 records and each record can contain up to 250 characters. Navigation of the file is presented through the window, the window appearing to scroll vertically or horizontally over the underlying file contents.

7.5.9.1 Creating a New Window

The initial window created when the Editor is started fills the available work area and includes a border. The border can be turned off if the full work area is required for Editor operation.

Each new window is created half the size of the work area including a border, the border providing a visual indication of the extent of the window. Once the window has been created, you can either load an existing file into it or you can create a new file.

When a file is specified for loading into a window, the Editor checks to see if the file has already been loaded, either in the current window (for example, as a copyfile) or in a different window. If the file is already loaded in the current window, the Editor re-presents that view in the window. If the specified file is already loaded in another window, the Editor informs you of this and opens another view onto the file, in the current window. The file can then be edited in any of the windows which have a view onto it, although changes are displayed only in the current window. Any changes made are reflected in the other windows when they are selected.

The active window has a highlighted border and contains the cursor. When a new window is created, it becomes the active window.

The window functions are available in the Control menu. Access the Control menu (shown in Figure 7-13) using the appropriate keys on your system.



Figure 7-13: The Control Menu

Press F9=window in the Control menu. The Window Control menu appears as shown in Figure 7-14.



Figure 7-14: The Window Control Menu

A new window can be created using the open window function F5=open-window. Windows can also be created using the window list box - see the section The Window Navigation List Box for more details.

The border of a window can be removed or added using the border on/off function (F2=border-on/off).

7.5.9.2 Selecting a Window

When a new window is created it overlays previously created windows and becomes the active window.

A previously created window can be selected as the active window using the F7=previous-window and F8=next-window functions. The previous window function enables you to select windows created before the current active window. When the current window is the first window created, this function wraps and selects the last window that was created. Similarly the next window function selects windows created after the current one. If the most recent window to be created is current when the next window function is used, the command wraps and selects the first window to be created.

In addition to being able to cycle between windows in terms of creation time, it is also possible to select windows you want to work with directly using the window list box. See the section The Window Navigation List Box for more details.

7.5.9.3 Sizing a Window

When using multiple windows you might want to vary the size of the windows and position them to enable a number of windows to be viewed simultaneously. The minimum window size is four characters high by four characters wide.

To size a window using the keyboard, press F3=size on the Window Control menu. The Window Control menu is updated to provide resizing using the cursor control keys as shown in Figure 7-15.



Figure 7-15: The Window Size Menu

You size a window by first selecting one border. The first cursor control key pressed selects the border of the window corresponding to the cursor control key: Cursor-left (<left-arrow>) selects the left border, Cursor-up ( <up-arrow> ) selects the top border, Cursor-down (<down-arrow>) selects the bottom border, and Cursor-right (<right-arrow>) selects the right border.

When a border is selected, the screen attribute of the border line is changed to indicate that it is selected. If the top or bottom border is selected, the Cursor-up/down keys move the selected border up/down. If the left or right border is selected, the Cursor-left/right keys move the selected border left/right.

If the border is at the edge of the work area, further attempts to move in this direction cause the Editor to beep.

You can select an additional border by pressing a cursor-control key again; if you have already selected one of the horizontal borders, you can select a vertical border by pressing Cursor-left (<left-arrow>) to select the left border or Cursor-right (<right-arrow>) to select the right border. If you have already selected one of the vertical borders, you can select a horizontal border by pressing Cursor-up ( <up-arrow> ) to select the top border, or Cursor-down (<down-arrow>) to select the bottom border.

To deselect the active borders and to re-enable the Window Control menu functions press Escape. Alternative borders can then be selected by pressing F3=size to re-enable the sizing functions.

As the window sizing operates on the border of a window, it is advisable to have the border switched on. The keyboard sizing functions operate in the same way with the border switched off but it is not apparent from the window display which borders are selected.

A window can be resized to the complete work area by pressing F9=max/restore-window. Other windows are then hidden as the active window overlays the complete work area. As other windows are selected, they each in turn become the active window overlaying the inactive windows. To restore the window to its pre-maximized size, press F9=max/restore-window again. This key toggles a window between its maximized and previous, non-maximized size.

An indicator in the upper right corner of the window's border displays which of these two states the window is currently in. If the indicator is an upward-pointing triangle, the window can be maximized. If the indicator is a diamond, the window is already maximized and can be restored to its pre-maximized state.

The actual character used for these indicators might vary on different UNIX terminals. The character used is defined in terminfo. See the chapter Terminfo Database and Terminal Devices in your Server Express User's Guide for information on terminfo.

7.5.9.4 Moving a Window

A window can be moved anywhere in the work area. To move a window using the keyboard press F4=move on the Window Control menu. The Window Control menu is updated to provide window movement using the cursor control keys as shown in Figure 7-16.



Figure 7-16: The Window Move Menu

The cursor movement keys now move the window in the work area. The Cursor-up ( <up-arrow> ) and Cursor-down (<down-arrow>) keys move the window up and down respectively in the work area, and Cursor-left (<left-arrow>) and Cursor-right (<right-arrow>) move the window left and right respectively in the work area. If the window is at the edge of the work area, further attempts to move in this direction cause the Editor to beep.

As with sizing a window, the keyboard controls for moving a window operate regardless of whether the window's border is on or off.

To re-enable the Window Control menu functions press the Escape key.

7.5.9.5 Closing a Window

A window remains open until you explicitly close it using the close window function (F10) or you exit from the last file contained in the window which automatically closes the window.

When you close a window using either method, the Editor checks to see if any of the files loaded into the window have been modified and are not loaded in any other window. If such files exist you are informed and asked if you want to "exit without saving?". Replying no cancels the close function. If you reply yes, the modifications are discarded and the window closed. The first available window is then selected as the active window. If no open windows remain, you exit from the Editor.

If a modified file is being viewed from more than one window, the "exit without saving?" message is displayed only on exit from the last window with access to the file.

7.5.9.6 The Window Navigation List Box

The Window Navigation list box (known as the window list box) is a facility to enable you to open new windows and select existing windows for editing. It is useful for quickly accessing a window that is completely hidden behind others. The list box is accessed using the show windows function (F6).

When accessed, the window list box displays a list of all open windows detailing the file currently being viewed in each, together with the file's size (in lines) and an indicator showing whether the file has been modified but the changes not saved. The first entry in the list is always "-- Open New Window --" . Selecting this item opens a new window, just as if you had used the open window function (F5) on the window control menu. The current selection in the list is shown in highlighted text.

A window is selected or created by moving the highlight to the appropriate entry and pressing Enter. The highlight is moved using the cursor keys - <up-arrow> and <down-arrow> move the highlight up and down the list, while <left-arrow> and <right-arrow> scroll the text of the entries right and left respectively. If the list box contains more entries than can be displayed, a vertical scroll bar is displayed on the extreme right of the list box. As the highlight reaches the top and bottom extents of the displayed items, the list box contents scroll revealing further entries, one at a time. If you try to move beyond the first or last item in the list, the Editor beeps.

If you select an existing window, that window is made active with the cursor placed at the same position it was at when the window was last accessed. Additionally, if any modifications have been made to the file in another window, the display is updated to show these changes.

If you select the "Open New Window" entry, a new window is created and the cursor placed at the left margin column in the window.

You can exit from the list box without changing the current active window by pressing Escape. This removes the list box and places the cursor back in the current window. On making a selection, the list box is automatically removed.

7.5.9.7 Accessing Files in a Window

From the Load-files menu (Alt+F3=load-files from the main menu), you can access files which are already loaded, but are either hidden behind others in the same window, or were originally loaded into another window.

F7=files-in-window brings up a list of all the files which can currently be viewed in the selected window. Selecting one brings it to the front, with the cursor where it was last time you edited it. The previous view is hidden behind it.

This facility is useful for switching between a program (previously loaded using Alt+F3=load-file), and its copyfiles (previously loaded using Alt+F2=library).

F8=list-all brings up a list of all the files which have been loaded into the Editor, regardless of which window they can be seen in. Selecting one adds it to the files which you can view in the selected window, and brings it to the front.

This is useful if you want to see two or more parts of one file at the same time.

The steps are as follows:

  1. Ensure that the window you want to work in is selected. From the main menu, select the Load-files menu (press Alt+F3=load-file) and press F7=files-in-window or F8=list-all as appropriate.

    The appropriate list box is displayed; they are very similar, and each contains a list of files. For each file, the length in lines is shown, together with an "m" indicator in the Mod column if the file has been modified.

  2. To select a file to view, move the highlight over its entry and press Enter.

    The <up-arrow> and <down-arrow> keys move the highlight up and down the list, while <left-arrow> and <right-arrow> scroll the text of the entries right and left respectively. If the list box contains more entries than can be displayed, a vertical scroll bar is displayed on the extreme right of the list box. As the highlight reaches the top and bottom extents of the displayed items the list box contents scroll revealing further entries, one at a time. If you try to move beyond the first or last item in the list, the Editor beeps. When an entry has been selected, the list box is removed leaving the selected file displayed in the window. The previous view (if any) is stacked ready for possible re-use later by the same method.

If you want to exit from the list box and return to the Load-files menu without selecting a file to view, press Escape rather than Enter.

7.5.10 Clearing a File

After you save a file, it remains in the window until you either clear it, close the window, or exit from the Editor.

To clear a file and present an empty window for editing another file, ensure that the required window is the currently active window and press Ctrl+F4=clear from the Editor main menu. If you have other files apart from the one you want to clear loaded in the window, none of those files are affected by the clear operation - it applies only to the current file being edited and/or viewed.

If you are in danger of losing modifications to a file, you are warned and given the chance to cancel the clear operation. A message such as:

clear without saving? Y/N

appears on the Message Line. Respond by pressing Y (Yes) to clear the current file and discard any unsaved changes or N (No) to cancel the operation.

You can also use the clear option when you want to clear an edited block of text. If you press Ctrl+F4=clear without first saving the block, it cannot be recovered. If you save the block of text (Alt+F4=save-file), you can then use Ctrl+F4=clear to clear the block (and still be able to recover it later from the file).

7.5.11 Printing a File

You can send a file to the printer using the print option on the Editor's Alternate menu. You press F7=print in the Alternate menu to access the Print submenu from which you can define how the file is printed. This menu is shown in Figure 7-17.



Figure 7-17: The Print Menu

You can set the system to pause at each page by selecting the F3=pause-at-new-page option. Printing stops each time a "/" (page-break character) is encountered in the column where the left-hand margin is set. For example, if you are using the default COBOL margins, you would enter page break characters at column 7. You restart printing by pressing Space.

You can also print the entire file without pausing by pressing F4=no-pause. However, a new page is still begun each time the page-break character is encountered. Pressing F3=pause-at-new-page or F4=no-pause initiates the printing process.

If you want to cancel printing at any time, press F2=cancel-print. You return to the Editor main menu as printing is aborted.

You exit from the Print menu without printing anything by pressing Escape.

7.5.12 Additional Features

In addition to its comprehensive set of editing features, the Editor also offers additional functionality that enables you to:

These features are described in the following sections.

7.5.12.1 Drawing Lines

The Editor draw feature enables you to draw diagrams and charts as well as enclose text in boxes.

The draw feature has its own menu, which you access by pressing F6=draw/screens in the Control menu, and then F2=draw from the Editor Draw/Screens menu.

The Draw Information Line and menu are shown in Figure 7-18.



Figure 7-18: The Draw Menu

As soon as you press one of the cursor movement keys (<right-arrow>, <down-arrow>, <left-arrow>, or <up-arrow>), the beginning of a single line appears on the screen. You can switch back and forth between drawing single lines and double lines by pressing the F3 toggle. When you press F3 to draw double lines, the appearance of the Information Line changes to display a double line.

You change the mode indicator by pressing F2=draw/erase/move. This key toggles from one function to the next and changes the effect of cursor movement; its current function is displayed both on the Information Line and next to the <down-arrow> <left-arrow> <up-arrow> <right-arrow> display on the Draw menu. The default behavior of the cursor is draw (which is displayed when you first invoke this menu). When you set the cursor to erase by pressing F2=draw/erase/move, you use the cursor movement keys to go back over those lines, deleting them. When you set this toggle to move, the cursor changes shape, and you can then move through the screen without drawing any lines.

Lines can be made to join, cross over or cross under when they meet by using the "Join" toggle. Pressing F4=join/over/under toggles between the settings "Join", "Over" and "Under". The default setting is "Join". When the toggle shows "Join", lines are merged when they cross. "Over" causes the current line to appear to pass over the existing line while "Under" causes the current line to appear to pass below the existing line.

You can use the full record width (250 characters) of the Editor when you draw. If you try to move the cursor beyond the borders of the current window, the window contents scroll in the same way as when you enter text. In addition, you have unlimited movement downwards - the Editor extends the number of lines in the file each time you try to move beyond the end of text marker. If you try to move above the top of text marker, to the left of column 1 or to the right of column 250, the Editor beeps. When drawing left and right, the current margin settings are ignored although the line highlighting indicates the region on each line enclosed by the margins.

The text editing options are not available when you are in draw mode. You press Escape to return to the Editor main menu to continue editing your file. The lines you have drawn remain visible on the screen.

7.5.12.2 Calculate

You can perform mathematical calculations on values in your file by using the calculate feature. This feature is useful for totaling figures in tables or lists.

You invoke this option by pressing Alt+F8=calculate on the Editor main menu. The Editor main menu remains on the screen. However, the word "Calculator" replaces the word "Edit" and the name of the current file on the Information Line. The phrase "Tally=0" appears on the Message Line at the bottom of the screen.

When you are using the calculator option, the +, -, * and / keys become mathematical operators. Each time you press one of these keys, the cursor moves to the end of the next numeric value encountered in the file. The current mathematical operation is performed on that value and the result is displayed on the Message Line. The Tally field displays a cumulative value that changes as you continue through the file. You can insert the total value at the current cursor position by pressing "=".

To cancel Calculate mode and return to editing, press Escape.

7.5.12.3 Editing Files Identified in Your COBOL Program

You use the Library facility to edit a file identified in your COBOL program by one of the following statements:

CALL filename 
COPY filename 
INCLUDE filename 
++INCLUDE filename 
-INC filename

You can then edit this file, save it and return to your main program file. You access this function of Editor from the Library option on the Alternate menu. When you press F2=library, Editor scans the current line for a CALL, COPY, INCLUDE, ++ INCLUDE or -INC statement. If it locates one of these statements, the word following the statement is assumed to be a filename and the Editor looks for a file with that name.

If you do not specify a filename extension, Editor searches for that filename using a default extension list. You can change this default configuration to the extensions you want Editor to search for. See the section Defining Copyfile Search Extensions later in this chapter for details on the search order used in your given environment and on how to change these defaults. If the file is located, the current file being viewed is stacked and the window displays the contents of the new file, with the name of the file being displayed on the Information Line. If the file is not found, the view onto the current file is stacked and a blank work file is presented in the window.

If the Editor does not locate one of these statements, the word at, or to the right of, the current cursor position becomes the filename.

If multiple COPY, CALL, INCLUDE, ++INCLUDE, or -INC statements are located on the same line of text, the Editor selects only the first occurrence. The filename must follow the statement identifier and be completed on the same text line; if the statement is continued onto a second text line, the required file is not found.

Editor searches for the named file in the following sequence:

  1. The list of files already loaded for editing is searched to see if a matching file basename exists. If a match is found, the Editor represents the existing view for editing. If no match is found, the Editor looks for the file on disk.

  2. If the filename contains a pathname, the Editor searches for the file in that path only.

  3. If there is no path specification on the COPY statement, it looks for the filename in the current directory.

  4. If no match is found, it searches the directory specified by the COBCPY environment variable, if it has been set. (This behavior is consistent with the Server Express Compiler's treatment of the COPY statement.)

  5. If no match is found, a new file is opened in the current directory.

You can easily switch between files loaded using the library function by using the list box available from the Load-files menu. For further details, see Accessing Files in a Window.

For further information about the COBCPY environment variable, see your Server Express User's Guide.

7.6 The Directory Facility

The Directory Facility is available whenever you need to provide the Editor with a filename (for example when you load or save files). The Directory Facility includes functions for listing, browsing, renaming and deleting files. This facility is described fully in the chapter Directory Facility.

Whenever you are prompted for a filename, the File Specification menu is invoked. In the Editor, this menu contains two extra function keys: F7=files-in-window and F8=all-files. These functions are described in the section Accessing Files in a Window.

7.7 COBOL Support Functions

When you use Editor to develop COBOL programs, functions are available to assist you in the development process. These functions enable you to syntax-check and animate your COBOL program.

In addition, you can query program characteristics using COBOL Source Information created during the checking process.

Editor uses the first file loaded into a window as the main COBOL program root file for that window when accessing any of these functions. It is possible to have loaded in the Editor more than one program provided that each main program file is loaded in a different window and is the first file loaded for each of those windows. Any files loaded after the initial file in a window by using the library facility (Alt+F2=library from the Editor Alternate menu) are assumed to be components of the main program file. Blocks are assumed to contain only temporary information related to editing any of these files.

When accessing any of the COBOL support functions, the particular function uses the program file associated with the current window. If you are editing more than one program in different windows, you need to make the window containing the main file for that required program active (that is, highlighted) before you access the function. The main program file does not necessarily have to be the file currently being viewed in that window, however. It is sufficient to simply select the window.

All of these functions are available from the COBOL menu, accessed by pressing F2=COBOL from the Editor main menu. The COBOL menu is as shown in Figure 7-19.



Figure 7-19: The COBOL Menu


Note: The compiling process is split into two phases: syntax-checking and generating. These phases can be specified separately by specifying the options for compiling or generating. This option enables you to syntax-check or animate your source code. You cannot generate code in Editor.


For Server Express users, the COBOL Source Information (CSI) and insert-statement functions are not available and do not appear on the menu.

7.7.1 Syntax-checking and Animating

When you use the Editor to develop programs to be generated and executed, you have the additional options of syntax-checking and animating your program. See your Server Express User's Guide for full details on syntax-checking, and your Debugging Handbook for information on using Animator.

Syntax-checking is the first phase of the compiling process. Each time the Compiler finds a syntax error in your source code, it interrupts the syntax-checking process and displays the appropriate error message and corresponding line number in error on the screen. It then gives you the option of returning to the Editor to correct the error immediately or continuing with the compilation process. See your Error Messages for a list of syntax error messages.

Once the syntax has been checked, you can debug and execute your program using Animator. Animator enables you to control and view the execution of your source code. When you exit Animator, you are returned to the Editor and you can correct any logic errors in your program. You can initiate syntax-checking and/or Animator for the program in the current window by pressing F2=compl/animate to display the Compile menu, then Enter.

When you press Enter the program to be syntax-checked and/or animated is determined by the main program file for the currently active (that is, highlighted) window. The basename and path of this program file is shown on the bottom line of the Check menu. If the name shown is not that of the program required, you must first select the correct window before pressing Enter. For details on how to select windows see the section Using Edit Windows.


Note: You must save your program (F4 in the Alternate menu) before you can check and animate it. If you don't save, the message:

exit without saving? Y/N

reminds you to do this.


7.7.1.1 Syntax Checking

When you press Enter to start the syntax-check, the screen is initially blank except for the information displayed at the bottom of the screen. This line shows the name of the file being checked.

The first line that appears in the working area of the screen lists the options (Compiler directives) that are preset by the system. It then displays the source code of your program.

Each time the Compiler detects a syntax error, it stops and displays an error message and the following prompt:

CONTINUE CHECKING PROGRAM ? Yes/No/Zoom-all/zoom-This

If you respond by pressing N (No), you are returned to the Editor screen on the first line that caused an error so that you can correct the error. To recheck the program, first save your changes then press F2=COBOL to reenter the COBOL menu followed by F2=compl/anim to access the Check menu. Finally press Enter to restart the checking process.

If you press Y (Yes) in response to the "Continue checking..." message, the system continues to check the program, informing you about any further errors it detects.

The checking process ends by displaying the number of errors found in your code. It also displays the size of the generated data area, the size of the generated code, and the size of the internal dictionary used by the code generator.

On completion of the checking phase the system returns you to the Editor with your text file displayed on the screen. If the checking process detected errors, the Editor positions you at the first line that caused an error.

7.7.1.2 Specifying Compiler Options

You might want to syntax-check a program with directives other than the default, or to use Animator as well as or instead of syntax-checking it. These directives can be entered from the Compile menu. The Compile menu is displayed as shown in Figure 7-20.



Figure 7-20: The Compile Menu

If during the syntax-checking phase, you do not want the Compiler to stop at errors, press F3=pause which deselects the option and clears the "Pause" indicator from the Information Line. You can select the option again by pressing F3=pause again.

The F4=list option enables you to specify either no listing ("Nolist") which speeds up the syntax-checking process, list to file ("List-File"), print ("Print"), or list to console ("List-Con"). Pressing F4=list cycles through these settings with the Information Line being updated to show the current setting.

To enter additional directives, press F10=directives to access the Compiler Directives menu. Type in the directives you require and press Enter to return to the Compile menu. Pressing F9=directives on the Compile menu toggles the "Opt-On" indicator on the Information Line. When "Opt-On" is displayed, the directives entered on the Compiler Directives menu are passed to the Compiler. When "Opt-On" is not shown, they are ignored.

The syntax-check phase and/or Animator is started by pressing Enter.

The default settings of the toggles on the Compile menu are configurable. It is also possible to specify a default set of additional directives. See Configuring the Editor for more details.

7.7.1.3 Compiler Error Handling

During the syntax-checking phase, any errors encountered are displayed on the screen and written to an error file. The file is created with the basename of the program being checked and is given a file extension of .msg. On return to the Editor, the error file and program main file are loaded. The Editor reads the first error file record and positions the cursor on the identified error line. The error message associated with the error line is displayed on the message line.

If the error is in a copyfile, the Editor first loads the main program file and then loads the copyfile containing the error and positions to the required line. The copyfile load action is similar to the library function (F2=library on the Alternate menu); that is, the current edit view (onto the main program file that has just been loaded) is stacked and the copyfile is loaded.

To position the Editor on the next program error, press F8=locate-next from the COBOL menu. To position on the previous program error, press F7=locate-previous. The current error position can be relocated by pressing F9=locate-current.

The section File Handling Considerations later in this chapter contains further information about the Editor's handling of program and copyfiles.

If it is not convenient to process the errors immediately after syntax-checking the program, you can close the error message file and process it at some later time. The error message file can be opened and closed explicitly from the Command File menu. See the section Command File Processing later in this chapter.

7.7.1.4 Starting Animator

Animator can be selected using F2=compl/anim from the Compile menu. Pressing F2=compl/anim selects the next of the three options, Compile, Compile+Animate and Animate. The default option is Compile but this is configurable (see the section Configuring the Editor). As you press F2=compl/anim, the selected option is displayed on the Information Line and immediately preceding the program-name on the bottom of the Compile menu.

If the Animate option is selected, the program must previously have been syntax-checked to create the files required for animation. If the Compile+Animate option is selected, once the checking process has ended and no errors have been found, program animation begins. Animator enables you to control the execution of your program while you view the process. The screen displays the program with the cursor positioned under the first executable statement.

See your Debugging Handbook for full details of the features available in Animator.

When the system completes program animation, the following message is displayed on the Message Line of your screen.

STOP RUN encountered

When you press Escape, the system then asks if you want to leave Animator. If you press Y (Yes), the system returns you to the Editor with your main program file displayed in the initial window.

During animation of your program you can include additional COBOL statements at breakpoints (Brk, Do). These COBOL statements are written to a command file on exit from the Animator. A program with breakpoint Do statements has a file created with the same name as the program source file, but with an extension of .edo. The command file can be loaded into Editor and the COBOL statements inserted at the breakpoint location, see the section Command File Processing.

7.7.2 Command File Processing

You can load the command files created during syntax-checking and animation, as well as pasted text copied from the on-line documentation system, into the Editor at any time. The functions to load these files are provided by the Command File menu, which can be displayed from the COBOL menu by pressing F3=cmd-file . The Command File menu is shown in Figure 7-21.



Figure 7-21: The Command File Menu

Text copied from the on-line documentation system can be inserted at the current point in your file by pressing F2=insert-paste-text. The Editor looks for a file called paste.txt in the current directory. If the file is found, the Editor loads the entire contents of the file and inserts the text immediately before the current line. The same text can be inserted as many times as you require, either at the same place or at different locations in your files.

The error message file created by the Compiler can be loaded by pressing F3=load-error-file. The Editor searches for a file with the same name as the main program file associated with the current window but with a file extension of .msg. If the file is found, the Editor positions the cursor at the first error defined in the error message file and returns to the COBOL menu with the error message displayed on the message line.

The Editor can be positioned to other error locations using F7=locate-previous, F8=locate-next and F9=locate-current from the COBOL menu.

On next entry to the Command File menu, the Information Line contains "Error-File-Active". The currently active file can be closed by pressing F5=close file.

The COBOL Breakpoint-Do statement file created during Animation and containing the COBOL statements associated with breakpoints can be loaded by pressing F4=load-DO-statement-file on the Command File menu. The Editor searches for a file with the same name as the main program file associated with the current window, but with a file extension of .edo.

If the file is found, the Editor positions to the first breakpoint location in the Breakpoint-Do statement file and returns to the COBOL menu with the COBOL statement displayed on the message line. The statement can be inserted into the source by pressing F10=insert-statement from the COBOL menu.

The Editor can position the cursor on other breakpoint locations using F7=locate-previous, F8=locate-next and F9=locate-current from the COBOL menu.

On next entry to the Command File menu, the Information Line contains "Do-Statement-File-Active". The currently active file can be closed by pressing F5=close file.

7.7.3 COBOL Source Information (CSI)

COBOL Source Information provides various program-wide functions, which enable you to find out information such as:

During the syntax-checking phase of a COBOL program, a COBOL Source Information (CSI) file can be produced. This file contains an information base for the COBOL program enabling query functions in the Editor to operate on the complete COBOL program source.

The information base is created for COBOL programs that complete the check phase. The information is written to the .idy associated with that program. If the program completes the syntax-checking phase with errors, you can still use CSI, although the information can be inaccurate in some circumstances.

7.7.3.1 Accessing CSI-functions

The query functions operate and provide information on a data item, procedure-name, reserved words (for example CALL, for called subprograms, COPY, for the file structure of the program) and special queries such as TIMES for statistics on the program or DEADDATA for locating data items which are never used.

Three query functions are provided from the COBOL menu. F6=CSI-at-cursor provides a query function which displays information about the word at or to the right of the cursor. F5=CSI-enter displays a submenu enabling the word to be entered from the keyboard.

The submenu displayed is shown in Figure 7-22.



Figure 7-22: The Find Menu

F4=return-CSI causes re-entry to CSI to display the previously active information.

For further information on the use of CSI see the chapter COBOL Source Information.

7.7.4 File Handling Considerations

If you use the Editor to position the cursor in a file as a result of a COBOL error, query (CSI posn-exit), or library function, the Editor does the following:

For example, if the main file, a-prog.cbl, is loaded and is stacked when the file a-copy.cbl is entered, a subsequent positioning function to a text line in a-prog.cbl causes a-copy.cbl to be stacked and a-prog.cbl to be displayed, positioned at the required text line. On exit from a-prog.cbl or on subsequent positioning to a different file, the file a-prog.cbl is returned to its original position in the stack.

If you try to exit from the main program file associated with a window, the Editor always restacks the file if other files are still loaded into the window. This enables further COBOL support functions to be used until you explicitly close the window or exit from the main program file when it is the only file loaded in the window. Other files in the same window are not automatically restacked and are thus closed when you elect to exit from viewing them.

When using either COBOL Source Information (CSI) or the COBOL Error feature in the Editor you should regard the Editor as operating on the complete COBOL program. When different parts of the COBOL program are selected for editing, it is advisable not to save any changes until you have completed all the changes you want to make. This is particularly important when using CSI, as text line selection with CSI is based on information constructed when the program was last syntax-checked. If changes are made to a program source file and saved, the text lines highlighted by CSI are displaced by the number of added or deleted text lines in the file.

When using CSI and amending source files, use the CSI features to navigate the COBOL program source and select files for editing. When you have completed all the changes you want to make, you can save all of the modified files together in one batch. See the section The Save-file List Boxes for more details. Alternatively you can save and exit from each file individually.

7.8 Compile Menu Functions

The functions on the Compile menu control the behavior of the Compiler.


Start Check and/or Animation (Enter)

Starts checking and/or animation of the indicated program.


Pause (F3)

This key toggles Pause on and off. The Information Line indicates when pause is on. The default setting is on, but this is configurable.

When pause is on, the Compiler pauses if an error is found during syntax-checking, and waits for you to suspend to the prompt. At this time, if the main menu is displayed the additional menu line is updated to enable the Shift+F10=to-error function. You can then view the Compiler screen to establish the nature of the error, and use Shift+F10 to position the Editor at the indicated error line.

When pause is off, the Compiler errors are stacked on the Compiler screen in the normal way but no indication is given apart from the Compiler sounding the bell.


List (F4)

This function key enables you to define whether you want to have a Compiler listing produced or not. Its default setting is configurable.


Lang (F6)

This key selects the language variant that you want your program to be checked with, and is fully configurable (see Configuring the Editor).

By default, you can key to toggle the following selections:

Displayed toggle
Directives selected
XOPEN XOPEN NOOSVS ANS85 NOVSC2
OSVS OSVS NOANS85 NOVSC2
ANS85 NOOSVS ANS85 NOVSC2
VSC2(1) NOOSVS NOANS85 VSC2(1)
VSC2(2) NOOSVS NOANS85 VSC2(2)
VSC2(3) NOOSVS NOANS85 VSC2(3)
VSC2(4) NOOSVS NOANS85 VSC2(4)
"blank" (no directives)

If no Lang configuration details are located by the Editor on start-up, the Lang toggle defaults to its "blank" setting.


XRef (F7)

Enables you to set the XREF directive. The default setting for this toggle is off, but this is configurable.


Directives (F9/F10)

F10 gives access to the Compiler Directives menu, where you can enter additional directives not available from the Check menu. F9 turns the directives toggle ("Opt-On") on or off, determining whether the additional directives are included during the checking/animation or not. The setting of the "Opt-On" toggle does not affect any toggles set on the Check menu via the supplied function key options. The settings of these options are always included.


7.9 Configuring the Editor

You can configure the initial settings of many of the toggles used in the Editor as well as define the margins you want to use with specific files, file extensions you want the Editor to look for, and attributes for both monochrome and color screens.

The configuration options you require can be specified in the local configuration file under the tag of [EDIT-USER]. See the chapter Configuring Development Tools in your Getting Started for information on configuration files.

Each configuration option, or command, must start on a new line and occupy a single line (up to 250 characters). Case is significant only in the arguments of the LANG, MARGINS, INIT-MARGINS, EXTENSIONS and COPYEXT commands. Space and colon (:) are treated as separators and are ignored.

If the Editor detects an error when it reads the configuration options, a message is displayed indicating what is wrong. Once all of the commands have been read, the Editor pauses and waits for you to press a key to continue. If there are no errors, the Editor continues without messages or a pause.

The following sections describe all the commands that you can use to configure the Editor. Some commands only apply to the Editor on certain COBOL systems. In this case, the description indicates on which system the command is available; if you try to use such a command on another system, the command is ignored.

7.9.1 Toggle Settings

All of the toggles contained on the Check menu can have their initial settings configured, as well as the global Word-wrap and Backup options. These entries appear alphabetically in this section.


BACKUP on/off

Determines the initial setting of the Backup toggle. The default setting is OFF. The state of the toggle can only be seen when you are using either the Load or Save-file menus. The setting of this option does not affect the initial setting of the "save" toggle on the Save-file list boxes.


CHECK-MODE mode

Determines the initial setting of the check/anim toggle on the Check menu. Three modes are supported:

COMPL
COMPL+ANIM
ANIMATE

The default setting of this toggle is COMPL.


DIRECTIVES directive-text

This command enables you to specify an initial set of directives which appear on the Compiler Directives menu. Specifying a set of directives also turns on the directives toggle ("Opt-On") on the Check menu automatically.

You can enter up to a maximum of 60 characters of directives - excess directives are ignored with a warning message being displayed. Each directive must be separated by a space, for example:

DIRECTIVES NOQUAL NOQUERY ANIM LIST()

inserts the directives NOQUAL, NOQUERY, ANIM and LIST() into the Editor's directives buffer. Any directives entered in this buffer take priority over toggles set via the function keys on the Check menu.


Note: If a particular directive contains embedded spaces, you can include it in the command by enclosing that directive entirely in quotation marks.


By default the Editor's directives buffer is initialized to spaces and the directives toggle is off.


LIST

Determines the initial setting of the list toggle on the Check menu. Four settings are available:

Setting
Effect
OFF No listing
CON Listing to CONsole
PRINT Listing to LIST(LST)
FILE Listing to a file with the same basename as the program but an extension of .lst

The default setting is CON.


PAUSE on/off

Determines the initial setting of the Pause toggle on the Check menu. The default setting is ON.


XREF on/off

Determines the initial setting of the XRef toggle on the Check menu.

Specifying XREF ON means a cross-reference is produced, while XREF OFF does not cause a cross-reference listing to be created.

The default setting is OFF.


WORD-WRAP on/off

Determines the initial setting of the Word-wrap toggle. The default setting is ON.


WINSHOWPATH on/of

Determines whether the full path is shown on the window title bar.

If off (the default), window titles show only the base filename and extension of the file currently being edited. If on, they show the full path (where specified) as well.


7.9.2 Defining Language Settings

The settings toggled through by the F6=lang function on the Check menu and their associated directives are configurable using the LANG configuration command. Up to 20 different LANG toggles can be defined in the configuration file: if you define more than 20 the excess statements are ignored and a warning message displayed.

The LANG command enables you to define particular subsets of directives or USE() directives and attach those directives to a toggle of your choice. The format of the command is as follows:

lang toggle-text directive-text

where the parameters are:

toggle-text A text string of up to eight characters in length. This is the text that is displayed on the Information Line when and if the F6=lang function is toggled to that text. If you want the text to contain embedded spaces, you must enclose the entire text in quotation marks. If the toggle-text you specify contains more than eight characters, the toggle is still accepted but the excess characters are removed. The toggle-text is not sent to the Compiler.
directive-text A string of one or more directives up to a maximum of 65 characters. Again, excess characters are truncated. If you specify more than one directive in the directive-string, they must be separated by spaces - the separating spaces also contribute to the overall length of your specified directive-text. If a particular directive contains embedded spaces, enclose that directive entirely in quotation marks.

The directive-text is the text sent to the Compiler when its associated toggle-text is displayed on the Information Line.

A default "blank" toggle is always supplied by the Editor. This enables you to override your specified toggles by repeatedly pressing the F6 key until the Information Line "lang" toggle is not displayed. When this toggle is selected, no directive-text from any LANG command is sent to the Compiler.

If the particular directive-text you want to specify is longer than 30 characters, place the directives in a file and specify the USE"filename" Compiler directive in your directive-text, where filename is the name of the file containing the directives.

Examples:

Specifying the command line:

lang ans85 noosvs ans85 novsc2

defines a toggle-text of ANS85 to be associated with the directives NOOSVS ANS85 and NOVSC2; that is, when ANS85 shows on the Information Line, NOOSVS ANS85 NOVSC2 is sent to the Compiler.

The following command line:

lang osvs use($cobdir/wbosvs.dir)

defines the directive USE($cobdir/wbosvs.dir) for a displayed toggle of OSVS.

Specifying:

lang prog1 use(prog1.dir)
lang prog2 use(prog2.dir)

defines two toggles, prog1 and prog2, which select two different directives file. These files could hold Compiler directives unique to two different programs. A common set of directives could also be specified using the DIRECTIVES Compiler directive described earlier. You could then toggle between the two .dir files depending upon which program you are currently working on.


Notes:


7.9.3 Defining Margins

The margins you want to use when editing files with specific extensions can be specified using the MARGINS command. You can also set the default margins to use if the file you are editing does not have margins explicitly set by a MARGINS command and you can specify, using the INIT-MARGINS command, the margins to use whenever a new window is opened (that is, while you are at the "...workfile empty..." prompt).

Up to 20 unique margin settings can be defined. Excess commands are discarded and a warning message displayed. If you should define margins for the same extension more than once, the last margins defined are used - the earlier definitions are overwritten.

The MARGINS command has three variations, which are outlined below.

MARGINS ext left-col right-col

This command specifies that files which have the extension ext have a left margin column of left-col and a right margin column of right-col. If ext has previously been defined, the existing definition is updated; otherwise a new entry is made in the Editor's margin table. The values of left-col and right-col should enclose the area in which you want to enter text. For example, for COBOL programs the margins would be 7 and 73, enabling you to enter text in columns 8 through 72 inclusive. To enable full line-width working use the values of 0 and 251.

MARGINS ext1 ext2

This command specifies that files which have the extensions ext1 are to assume the margins already specified for files with extension ext2. ext2 must have been defined previously. If it is not found, the entire command is ignored and an error message displayed.

This format of the MARGINS command can be used to easily replicate a particular set of margins for similar file types (for example for COBOL files the margins defined for .cbl extensions can be easily copied to a .cpy file type (say) by specifying MARGINS CPY CBL).

MARGINS {OTHER} left-col right-col

This command enables you to modify the Editor's undefined margins, which are always present when you work with the Editor. The {OTHER} keyword specifies that the margin settings are to be used if you are working with a file for which no explicit MARGINS command is available. The values for left-col and right-col are in the same format as those used in the first variation of this command.

Only one set of {OTHER} margins can be defined. Subsequent definitions merely overwrite the earlier ones.

Examples:
MARGINS DOC 0 79 MARGINS CBL 7 73
MARGINS CPY CBL
MARGINS {SPACE} CBL

{SPACE} in the last example specifies a space extension. The Editor always replaces this keyword where it is valid in configuration commands with spaces.

None of the above examples modified the {OTHER} definition which is set to 0 and 81 by default.

If you want to define margins for files with a numeric extension, for example file.321 or file.456 you must enclose the extension in quotation marks, that is to set margins of 10 and 70 for the two files shown you would specify

MARGINS "321" 10 70 
MARGINS "456" "321"

You must also specify alphabetic extensions in quotation marks if the extension contains embedded spaces, for example:

MARGINS "C B" 0 251

The maximum size of an extension is 65 characters. Excess characters are truncated and a warning message displayed. Do not include the leading "." in the extensions used, unless the extension itself starts with a period (for example, file..ex). If a leading period is detected, it is removed; however, further periods are left intact.

If no MARGINS commands are present in your configuration file, the Editor sets itself to behave as if the following commands had been present:

MARGINS CBL 7 73
MARGINS CPY CBL
MARGINS {SPACE} CBL
MARGINS COB CBL 
MARGINS BAK CBL 
MARGINS {OTHER} 0 81
MARGINS htm     0 251
MARGINS HTM     htm
MARGINS html    htm
MARGINS HTML    htm
MARGINS shtml   htm
MARGINS SHTML   htm

However, if any MARGINS commands are detected, the above defaults are canceled and only those MARGINS commands found are used.

The INIT-MARGINS command enables you to specify which margins you want to use when a window is opened (including the initial window) if a file has not been loaded into that window. The format of the command is:

INIT-MARGINS  ext

This command specifies that the margins defined for file extension ext using a previous MARGINS command are to be used. ext must have been defined. If it is not found in the margin table then the command is ignored and a warning message output. The Editor then sets itself to the default initial margins of CBL if they are available, otherwise it uses the current {OTHER} definition.

As well as an explicit extension, you can also specify INIT-MARGINS {OTHER} which, since {OTHER} margins are always defined, will never fail.

If subsequent INIT-MARGINS commands are found, the latest commands override the earlier commands.

7.9.4 Defining File Search Extensions

If you specify a filename without an extension, the Editor searches for that filename using a default extension list:

.cbl, .cpy, .cob, .bak, .CBL, .CPY, COB, .BAK and spaces (no extension)

You can change this default configuration to the extensions you want Editor to search for and specify which extension you want to have offered by default when saving a new file using the EXTENSIONS command. The format of the command is:

EXTENSIONS ext1 ext2 ext3 ... extn

where ext1, ext2, ext3 and extn are individual file extensions. You can define up to 20 extensions; however, the entire EXTENSIONS command must fit on a single line (250 characters). The length of an individual extension can be between 1 and 65 characters. The extensions specified must be separated by one or more spaces. If you want to define an extension that contains embedded spaces, enclose the particular extension in quotation marks (" ").

File extensions are case-sensitive. The extension is searched for in the case specified.

The first extension specified is the one offered by default when saving a new file, so you can change the default by changing the first extension.

As the command is processed, extensions are checked to see if they have been defined previously in the current command. If so, the duplicate definition is ignored.

Only a single EXTENSIONS command can be specified. If a subsequent command is found, the extensions defined in the later command override those specified initially. When specifying extensions that are composed entirely of spaces, the keyword {SPACE} can be used. When the Editor processes this keyword, it fills the current extension entry with spaces (up to 65 characters). The keyword can be specified in either upper or lower case but it must be enclosed in braces ({ }).

If no EXTENSIONS command is specified in your configuration file, the Editor defaults to behaving as if the command:

EXTENSIONS cbl cpy cob CBL CPY COB {SPACE}

had been defined.

If an EXTENSIONS command is present, these definitions are canceled and the extensions defined in the current command used instead; hence, if you want to continue searching for .cbl, .cpy and {SPACE} extensions, in addition to your own specialist extensions then you need to include cbl, cpy and {SPACE} definitions in your EXTENSIONS command.

7.9.4.1 Defining Copyfile Search Extensions

You can also specify the extensions of copyfiles to be searched. This is useful when trying to locate a copyfile; for example, when using Alt+F2=library function.

These generally follow the rules for file extensions.

You can change this default configuration to the extensions you want Editor to search for and specify which extension you want to have offered by default when saving a new file using the COPYEXT command. The format of the command is:

COPYEXT ext1 ext2 ext3 ... extn

If no COPYEXT command is specified in your configuration file, the Editor defaults to behaving as if the command:

COPYEXT .cpy .cob .CPY .COB {SPACE}

had been defined.

7.9.5 Default Configuration of the Editor

Below is a list of the commands that set the default state of the Editor. These commands are contained in the configuration file. Configuration files are described in the chapter Configuring Development Tools in your Getting Started. The configuration file sets the default states for all Server Express tools and utilities, not just the Editor.

[EDIT-USER]
BACKUP OFF
WORD-WRAP ON
CSI ON
CHECK-MODE CHECK
PAUSE ON 
LIST CON 
XREF OFF 
LIMIT LINE 
AUTORESTART ON 
WINSHOWPATH OFF
MARGINS {OTHER}0 81 
MARGINS CBL 7 73 
MARGINS CPY CBL 
MARGINS {SPACE} CBL 
MARGINS COB CBL 
MARGINS BAK CBL 
MARGINS htm     0 251
MARGINS HTM     htm
MARGINS html    htm
MARGINS HTML    htm
MARGINS shtml   htm
MARGINS SHTML   htm
INIT-MARGINS CBL 
EXTENSIONS CBL CPY COB {SPACE} BAK
COPYEXT CPY COB {SPACE}
;COLOR-CURRENT-LINE        YELLOW ON BLACK
;COLOR-NORMAL-TEXT         BROWN ON BLACK 
;COLOR-TAGS                LIGHT-CYAN ON BLACK
;COLOR-MARGIN-COL          YELLOW ON RED 
;COLOR-KEYTOPS             YELLOW ON BLACK 
;COLOR-MENU-TEXT           BROWN ON BLACK
;COLOR-MESSAGE-NORM        BROWN ON BLACK
;COLOR-MESSAGE-HIGH        YELLOW ON BLACK
;COLOR-ENTRYFIELD          WHITE ON BLACK
;COLOR-BLOCK               YELLOW ON RED 
;COLOR-TELLTALES           LIGHT-CYAN ON BLACK
;COLOR-CURRENT-WINDOW      YELLOW ON BLACK
;COLOR-INACTIVE-WINDOW     BROWN ON BLACK
;COLOR-MOVING-WINDOW       WHITE ON BLACK
;COLOR-RESIZING-WINDOW     LIGHT-CYAN ON BLACK
;MONO-CURRENT-LINE         NORMAL HIGHLIGHT
;MONO-NORMAL-TEXT          NORMAL
;MONO-TAGS                 UNDERLINE
;MONO-MARGIN-COL           REVERSE-VIDEO
;MONO-KEYTOPS              NORMAL HIGHLIGHT
;MONO-MENU-TEXT            NORMAL
;MONO-MESSAGE-NORM         NORMAL
;MONO-MESSAGE-HIGH         NORMAL HIGHLIGHT
;MONO-ENTRYFIELD           UNDERLINE HIGHLIGHT
;MONO-BLOCK                REVERSE-VIDEO 
;MONO-TELLTALES            UNDERLINE
;MONO-CURRENT-WINDOW       NORMAL HIGHLIGHT 
;MONO-INACTIVE-WINDOW      NORMAL
;MONO-MOVING-WINDOW        UNDERLINE HIGHLIGHT
;MONO-RESIZING-WINDOW      UNDERLINE

If no configuration data is found, the Editor initializes itself to behave as if the above statements had been present.

The color and monochrome statements that specify default attributes are commented out in this default configuration file to prevent them overriding any attributes you might have changed for other environments. You can change these statements to your own requirements by removing the semicolon (;) comment indicator from the front of the line and specifying new values for color and monochrome attributes.


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

PreviousDirectory Facility GNT AnalyzerNext