Version 6.3.8 for OpenVMS
 —  Editors  —

Editing Area

The editing area is either empty or contains source code that was last read into the source work area with the command EDIT or READ as shown in the example of a program in Invoking the Program Editor.

When you read in the source of an existing object, the entire source code is loaded into the source work area and is available for editing. However, depending on the size of the source, the editing area may not show all of the lines that belong to the source. In this case, you have to scroll down the source (see Editor Commands for Scrolling) to go to the line you want to view or modify.

In addition, if you use split-screen mode (see the relevant section), the editing area displays fewer lines of source code.

You can use multiple methods to create or modify source code:

This section covers the following topics:


Inserting Text

This section provides example instructions for using a line command to insert text into the current source.

Start of instruction setTo insert text into a source

  1. In the leftmost column of the prefix area, next to the required source line, enter an I (insert) command (see Line Commands) thus temporarily overwriting the characters in the prefix area.

    For example, enter the following line command:

    I5

    Insert mode is activated as indicated by a series of apostrophes ('''''') and five blank source lines are inserted below the line in which you entered the line command. The cursor is positioned at the beginning of the first blank source line.

  2. In the blank source lines, type in text. Lines that are left blank are eliminated from the source when you press ENTER.

    The apostrophes are replaced by line numbers indicating that the new text has been incorporated into the source.

Renumbering of Source Lines

When you add lines to the source code of an object, Natural numbers the added lines in increments of ten. When you insert lines in source code, Natural automatically renumbers all lines contained in the source code in increments of ten beginning with 000010 at the first line.

You can change the number of increments by using the system command RENUMBER described in the System Commands documentation.

See also Renumbering of Source-Code Line Number References in the Programming Guide.

Top of page

Copying and Pasting Text

This section provides instructions for copying text within the current source by using copy and paste functionality. For instructions on copying text from another Natural object into the current source, see To display and copy definitions with SPLIT.

Start of instruction setTo cut or copy and paste text to a source

  1. Cut or copy text to the clipboard.

  2. Add the number of source lines required to place the text you cut or copied to the clipboard, for example, by proceeding as follows:

  3. In the command line, enter the following:

    PROTECT ON

    This command protects the prefix area to avoid overwriting of source lines if a pasted line contains more than 72 characters.

  4. Position the cursor in the first position of the first source line where you want to paste the text.

  5. Choose the paste function of your terminal emulation or press CTRL+V.

    The text placed on the clipboard is pasted in the source lines from the cursor position to the end of the source.

    If a pasted line starts with a 6-digit line number copied from a source, you can remove the line number with the following steps.

  6. In the command line, enter the following:

    PROTECT OFF

    The prefix area is no longer protected and you can enter a line command.

  7. Next to the pasted line that contains a copied line number, enter the following line command:

    (7

    The line is shifted left by 7 columns thus deleting the line number.

Top of page

Copying or Moving Text with a Data Window

You can use a data window to copy or move text that does not start or end at the beginning or end of a line. Data window functions can be performed by using line commands and/or editor commands.

When you define a window, all text on your screen between start and end of the window become part of the window.

Example of Using a Data Window

This section provides an example of defining and moving text with a data window by using either line commands or corresponding editor commands.

The example refers to the text shown in Step 1 and assumes that you want to move the whole sentence starting Note that when... (line 80) to follow the first sentence of the displayed text ending ...copy operations (line 30).

Start of instruction setTo define and move a window using line commands

  1. Type in text as shown below:

    >> -----------Columns 001 072 <<     Text WINEX    Lines  10     User MMO       
    Command ===>                                       Mode   Report Lib  SAGTEST   
    ****** ****************************** top of data ***************************** 
    000010 Copy a Window with Text                                                  
    000020                                                                          
    000030 You can specify a window with text for move or copy operations. This     
    000040 allows you to copy or move text that does not start or end at the        
    000050 beginning or end of a line. This function can be performed using         
    000060 line commands and/or editor commands.                                    
    000070                                                                          
    000080 Below are some examples of copying windows with text. Note that when     
    000090 you define a window, all text on your screen between start and end of    
    000100 the window become part of the window. Available line commands are:       
    ****** **************************** bottom of data **************************** 
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- 
          Help  Save  Exit  Run   Rfind Stow              Check Home  Undo  Canc
    
  2. Type the line command WS in line 80, the first line of text to be moved, place the cursor in the required column (N of the word Note) and press ENTER.

    The message WS55 appears in the prefix area of line 80, indicating the column number selected:

    >> ----------Block is pending <<     Text WINEX    Lines  10     User MMO      
    Command ===>                                       Mode   Report Lib  SAGTEST  
    ****** ****************************** top of data *****************************
    000010 Copy a Window with Text                                                 
    000020                                                                         
    000030 You can specify a window with text for move or copy operations. This    
    000040 allows you to copy or move text that does not start or end at the       
    000050 beginning or end of a line. This function can be performed using        
    000060 line commands and/or editor commands.                                   
    000070                                                                         
    WS55   Below are some examples of copying windows with text. Note that when    
    000090 you define a window, all text on your screen between start and end of   
    000100 the window become part of the window. Available line commands are:      
    ****** **************************** bottom of data ****************************
                                                                                   
                                                                                   
                                                                                   
                                                                                   
                                                                                   
                                                                                   
                                                                                   
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help  Save  Exit  Run   Rfind Stow              Check Home  Undo  Canc
    
  3. Type the line command WE in line 100, the last line of text to be moved, move the cursor to the last column to be moved (full stop (.) after window) and press ENTER.

    The message WE37 appears in the prefix area of line 100:

    >> ----------Block is pending <<     Text WINEX    Lines  10     User MMO      
    Command ===>                                       Mode   Report Lib  SAGTEST  
    ****** ****************************** top of data *****************************
    000010 Copy a Window with Text                                                 
    000020                                                                         
    000030 You can specify a window with text for move or copy operations. This    
    000040 allows you to copy or move text that does not start or end at the       
    000050 beginning or end of a line. This function can be performed using        
    000060 line commands and/or editor commands.                                   
    000070                                                                         
    WS55   Below are some examples of copying windows with text. Note that when    
    000090 you define a window, all text on your screen between start and end of   
    WE37   the window become part of the window. Available line commands are:      
    ****** **************************** bottom of data ****************************
                                                                                   
                                                                                   
                                                                                   
                                                                                   
                                                                                   
                                                                                   
                                                                                   
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help  Save  Exit  Run   Rfind Stow              Check Home  Undo  Canc
    
  4. Type the line command WM in line 30 (the text will be moved to the following line, line 40), and move the cursor to the column at which line 30 is to be split (the blank before the word This). Press ENTER.

    The specified text section is moved:

    >> -----------Columns 001 072 <<     Text WINEX    Lines  13     User MMO      
    Command ===>                                       Mode   Report Lib  SAGTEST  
    ****** ****************************** top of data *****************************
    000010 Copy a Window with Text                                                 
    000020                                                                         
    000030 You can specify a window with text for move or copy operations.         
    000040 Note that when                                                          
    000050 you define a window, all text on your screen between start and end of   
    000060 the window become part of the window.                                   
    000070 This                                                                    
    000080 allows you to copy or move text that does not start or end at the       
    000090 beginning or end of a line. This function can be performed using        
    000100 line commands and/or editor commands.                                   
    000110                                                                         
    000120 Below are some examples of copying windows with text.                   
    000130                                       Available line commands are:      
    ****** **************************** bottom of data ****************************
                                                                                   
                                                                                   
                                                                                   
                                                                                   
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help  Save  Exit  Run   Rfind Stow              Check Home  Undo  Canc
    

You can achieve the same result described in the instructions above by using the command sequence indicated below.

Start of instruction setTo define and move a window using editor commands

  1. Type in the text shown in Step 1 above.

  2. In the command line, enter the following:

    WINDOW 80 100 55 37;MWINDOW 30 64

    The specified text section is moved as illustrated in Step 4 above.

Top of page

Finding and Replacing Text

This section provides instructions for finding and replacing a character string in the current source.

Start of instruction setTo find and replace a character string in a source

  1. Search for a string by using the following editor command:

    FIND 'string'

    where string is any alphanumeric character string.

    The first occurrence of the specified string is found.

  2. Replace the string found by using the following command:

    CHANGE 'string'  'new-string'

    Or:
    Search for the next occurrence of the string by pressing PF5.

    Depending on the command used, the first occurrence of the string is either replaced or the next occurrence (if any) of the string is found.

  3. Replace the string found by pressing PF17.

    Or:
    Search for the next occurrence of the string by pressing PF5.

    Depending on the PF key used, the next occurrence of the string is either replaced or the next but one occurrence (if any) of the string is found.

Top of page

Formatting Source Code

You can format source code by indenting source lines. Indentation is performed differently for sources created in reporting mode than for sources created in structured mode.

Start of instruction setTo format source code

  1. In the command line, enter the following system command:

    STRUCT

    The lines in the source code are indented.

For details, see STRUCT in the System Commands documentation.

Top of page

Checking Source Code

Start of instruction setTo check the current source code for syntax errors

Top of page