The Natural program editor is used to create and modify the source code of a Natural object of the type program, subprogram, subroutine, helproutine, copycode, text, class or function.
Note:
The Natural program editor has been disabled in your environment by
                         default. For more information, see Disabled Natural
                            Editors.
                  
The Program Editor documentation is organized in the following parts:
For information on Unicode and code page support for Natural editors, see Editors in the SPoD Environment in the Unicode and Code Page Support documentation.
To invoke the program editor
Use the system command EDIT as
                                described in the System Commands documentation.
                     
When the program editor is invoked, an editor screen similar to the example below appears:
>                                       > +  Program     SAGDEMO  Lib SAGTEST  
All    ....+....1....+....2....+....3....+....4....+....5....+....6....+....7..
  0010 ** EXAMPLE 'SAGDEMO': DISPLAY                                           
  0020 ************************************************************************
  0030 DEFINE DATA LOCAL                                                       
  0040 1 VIEWEMP VIEW OF EMPLOYEES                                             
  0050   2 PERSONNEL-ID                                                        
  0060   2 NAME                                                                
  0070   2 BIRTH                                                               
  0080   2 JOB-TITLE                                                           
  0090 END-DEFINE                                                              
  0100 *                                                                       
  0110 READ (3) VIEWEMP BY BIRTH                                               
  0120   DISPLAY PERSONNEL-ID NAME JOB-TITLE                                   
  0130 END-READ                                                                
  0140 END                                                                     
  ....                                                                         
  0280                                                                         
       ....+....1....+....2....+....3....+....4....+....5....+... S 14   L 1 | 
                        
The editor screen contains the following items (from top to bottom): the editor command line, the top information line, the editing area and the bottom information line. These items are explained in the following sections.
Note:
 If Natural ISPF is installed and the
                          editor profile
                          option ISPF Editor as
                                Program Editor is set to Y, instead of the
                          program editor, either the Natural ISPF main menu (if the
                          EDIT command is entered without an object name) or
                          the Natural ISPF editor screen with the specified object is invoked.
                  
The editor command line is indicated by the leftmost greater than sign (>) in the top line of the editor screen. In the command line, you can enter one of the following:
For example: The system command CHECK can be
                               used for checking the syntax of source code and
                               SAVE
                               for saving source code (see also Saving and Cataloging
                                  Sources).
                     
For other system commands related to maintaining and using object sources, see Managing Applications with Natural Objects in the System Commands documentation.
One or more editor commands.
The name of a Natural program to be executed.
Additionally, the top line can contain the following items (from left to right):
| Direction Indicator: 
                                    
                            
  |  
                                
                        The direction indicator can be set to control the direction of
                                    the editor commands ADD and
                                    SCAN, and of the line commands
                                    .C, .I and
                                    .M. The plus sign (+) indicates after and
                                    the minus sign (-) indicates before. The exact interpretation is
                                    described with the relevant command description. See also the editor profile
                                    option Direction
                                          Indicator described in
                                    Editor
                                       Profile.
                         |  
                               
                     
| Object Type | The type of object currently in the source work area. If no
                                    object type or object name is specified when the program editor is invoked,
                                    object type Program is displayed by default. 
                                    
                            The object type can be changed by using the editor command
                                          |  
                               
                     
| Modification Indicator: 
                                    
                            
  |  
                                
                        An asterisk (*) indicates whether the source code
                                    currently in the source work area contains unsaved modifications. The asterisk
                                    (*) also appears for new source code that has not yet been saved as a source
                                    object. 
                                    
                            The asterisk (*) is only visible if the editor profile option
                                        Source Status
                                              Message is set to  The asterisk (*) disappears when you execute a successful
                                         See also Exit Function.  |  
                               
                     
| Object Name | The name of the object currently in the source work area. No
                                    name is displayed if the source work area is empty or if the current source
                                    code has not yet been saved as a source object with the
                                    SAVE,
                                    CATALOG or
                                    STOW
                                    command.
                         |  
                               
                     
| Lib | The library to which you are currently logged on. | 
The top information line of the editor screen is a scale line. It can contain the following:
A message indicating object modification. This information is only
                               displayed if the editor profile option
                               Source Status
                                     Message is set to Y (see
                               Editor
                                  Profile).
                     
The programming mode (structured or reporting) currently in effect.
                               When a Natural object is read into the source work area, the mode is set to the
                               one which was in effect when the object was saved with the
                               SAVE or
                               STOW
                               command. This information is only displayed if the editor profile option
                               Source Size
                                     Information is set to Y (see
                               Editor
                                  Profile).
                     
For information on the differences between structured and reporting mode, see Purpose of Programming Modes in the Programming Guide.
The editing area of the editor screen contains the numbered lines where you add or modify source code.
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 Positioning) to go to the line you want to view or modify.
In addition, if you use split-screen mode, the editing area displays fewer lines of source code. See also Split-Screen Mode.
To create or edit source code, you can perform multiple functions:
Type in or update code directly in the relevant source line.
Use one or more editor commands as described in the relevant section.
Use one or more line commands as described in the relevant section.
When performing multiple functions, consider the following:
Only one insert line command (.I) can be
                               performed at a time.
                     
You can enter multiple commands in the command line of the editor: you can enter more than one editor command, but only the last command entered in the editor command line can be a system command. For example:
SC 'MOVE',-2,RENUMBER
Note:
 Natural treats the editor command N
                                  like a system command. N corresponds to the system
                                  command RENUMBER.
                        
If you have changed the source code by typing in a modification or by using an editor command, a system command cannot be entered until you press ENTER.
You can activate or deactivate dynamic conversion to upper case, by
                        setting the appropriate editor
                           profile options Editing in Lower
                              Case and
                        Dynamic
                              Conversion of Lower Case to Y (see
                        Editor
                           Profile). All source code you enter in the editing area is
                        then converted to upper case, with the following exceptions:
               
The contents of a Natural object of the type text remain as entered.
A text string that is not
a hexadecimal constant or
a Unicode hexadecimal constant
and is enclosed in apostrophes or quotation marks remains as you enter it.
DBCS characters enclosed in shift-out and shift-in characters remain as you enter them.
A comment indicated by the character string blank-slash-asterisk ( /*) remains as you enter it.
Caution:
 If the character string slash-asterisk (/*) denotes an
                                   executable part of a statement, it must be specified without a blank
                                   character in front of the string (/*). The string will otherwise be considered
                                   a comment.
                        
The bottom information line of the editor screen is a scale line. It can contain the following:
The size (number of characters) of the current source. As source lines
                               are stored in variable length in the source work area, trailing blanks within a
                               source line are not counted; leading and embedded blanks are counted. This
                               information is only displayed if the editor profile option
                               Source Size
                                     Information is set to Y (see
                               Editor
                                  Profile).
                     
The number of characters still available in the source work area. This
                               information is only displayed if the editor profile option
                               Source Size
                                     Information is set to Y (see
                               Editor
                                  Profile).
                     
S
The size (number of lines) of the source being edited.
L
The number of the source line currently displayed as the top line.
Editor commands are entered in the command line of the program editor. The command parameters must be separated either by the input delimiter character as defined with the Natural session parameter ID (the default delimiter character is comma (,)) or by a blank. When multiple commands are entered, these must also be separated by the delimiter character or by blanks.
The editor commands available are described in the following table and in the section Editor Commands for Positioning. For explanations of the syntax symbols used in the editor commands, refer to System Command Syntax in the System Commands documentation. An underlined portion of a command denotes a valid abbreviation.
| Editor Command | Function | ||||||
|---|---|---|---|---|---|---|---|
ADD[(n)] | 
                                
                                
                        Adds n
                                    blank lines. If the direction
                                       indicator is set to + (plus sign), the lines are added
                                    after the last line of the object being edited; if the direction indicator is
                                    set to - (minus sign), the lines are added before the first line
                                    of the object. 
                                    
                           The value for n can be in the range from 1 to 9. If n is not (or not correctly) specified, 9 lines (4 in split-screen mode) are added by default. With the next ENTER, lines that are still left blank are removed.  |  
                               
                     ||||||
CANCEL 
                                    
                           or 
 (a period)  |  
                                
                        Leaves the editor. Any
                                    modifications made since the last time the SAVE command was
                                    entered are not saved.
                         |  
                               
                     ||||||
CATALOG
                                       [object-name] 
                         |  
                                
                        Executes the system command
                                    CATALOG which checks and catalogs the current source
                                    code. 
                                    
                           You must supply an object name with the command if you catalog new source code or if you want to copy the current source code. See also Saving and Cataloging Sources. |  
                               
                     ||||||
CHANGE
                                       ['scan-value'replace-value'] | 
                                
                                
                        Scans the source code for the
                                    character string entered as scan-value and replaces
                                    each such scan-value found with the character string
                                    entered as replace-value. 
                                    
                            Each line in which a character string is replaced is marked with an
                                         Any special character which is not valid within a Natural variable name can be used as the delimiter character. If you enter   |  
                               
                     ||||||
CHECK | 
                                
                                
                        Executes the system command
                                    CHECK
                                    which checks the syntax of the current source code. If an error is found, the
                                    erroneous line is marked with an E and an appropriate error
                                    message appears in the message line. If no errors are found, a message appears
                                    indicating successful completion of the check.
                         |  
                               
                     ||||||
CLEAR |  
                                
                        Executes the system command
                                    CLEAR
                                    which clears the source work area (including the object name and the line
                                    markers X and Y).
                         |  
                               
                     ||||||
DX 
                                    
                           or 
  |  
                                
                        Deletes the X-marked or the Y-marked line. | ||||||
DX-Y |  
                                
                        Deletes the block of lines
                                    delimited by the X and Y markers. 
                                    
                           
                         |  
                               
                     ||||||
EX 
                                    
                           or 
  |  
                                
                        Deletes lines from the top of the editing area to, but not including, the X-marked line; or from the line following the Y-marked line to the bottom of the editing area. | ||||||
EX-Y |  
                                
                        Deletes all lines in the editing
                                    area excluding the block delimited by X and Y. 
                                    
                           
                         |  
                               
                     ||||||
EXIT |  
                                
                        Leaves the editor. Any modifications to the source are saved depending on the setting of the editor profile described in Exit Function. | ||||||
LET |  
                                
                        Undoes all modifications made to
                                    the current screen since the last time ENTER was
                                    pressed. In addition, LET ignores all line commands
                                    already entered but not yet executed.
                         |  
                               
                     ||||||
N
                                       [(nnnn)] |  
                                
                        This command corresponds to the
                                    system command RENUMBER. It
                                    renumbers the lines of the source code currently in the source work area. 
                                    
                           If you only enter  If the value specified for n is too big, lines are numbered in increments of 5. Note:  |  
                               
                     ||||||
PROFILE
                                       [name] |  
                                
                        Invokes the Editor Profile screen where you can view or change your current editor profile settings. For details, see the section Editor Profile. | ||||||
REN ON|OFF |  
                                
                        
                           
  |  
                               
                     ||||||
RESET | 
                                
                                
                        Deletes the current X
                                    and Y line markers and any marker previously set with the line
                                    command .N. See also the
                                    line commands .X and
                                    .Y.
                         |  
                               
                     ||||||
SAVE
                                       [object-name]  
                         |  
                                
                        Executes the system command
                                    SAVE which saves the current source code. 
                                    
                           You must supply an object name if you save new source code or if you want to copy the current source code. See also Saving and Cataloging Sources. |  
                               
                     ||||||
SCAN
                                       ['scan-value'] |  
                                
                        Scans the source code for a
                                    character string (scan-value). 
                                    
                            Each line in which the scan-value is
                                        found is marked with an  If the supplied scan-value is entered
                                        without delimiter characters, for example,  Note: If the direction indicator is set to  If you enter  
  |  
                               
                     ||||||
SCAN=[+|-] | 
                                
                                
                        Scans for the next occurrence of
                                    scan-value specified with the
                                    SCAN command.
                                    
                                    
                           The direction for a given scan command can be explicitly specified
                                        by entering  Note:  |  
                               
                     ||||||
SET ABS
                                       [ON|OFF] |  
                                
                        ON |  
                                
                        The SCAN and
                                    CHANGE
                                    commands operate in absolute mode, which means that the
                                    scan-value and the
                                    replace-value need not be delimited by blanks or
                                    special characters.
                         |  
                               
                     |||||
OFF |  
                                
                        The SCAN and
                                    CHANGE
                                    commands do not operate in absolute mode, which means that the
                                    scan-value and the
                                    replace-value must be delimited by blanks or special
                                    characters.
                         |  
                               
                     ||||||
The default is OFF. 
                                    
                           The   |  
                               
                     |||||||
SET CAPS
                                       [ON|OFF] |  
                                
                        ON |  
                                
                        Converts all lowercase characters displayed on the current screen to upper case, except for those characters placed in a comment or enclosed in apostrophes or quotation marks. | |||||
OFF |  
                                
                        Characters are not converted. | ||||||
| This command corresponds to the Editing in Lower Case option described in Editor Profile. | |||||||
SET RELINE
                                       [ON|OFF] |  
                                
                        ON |  
                                
                        Removes empty lines from the current screen when you press ENTER. | |||||
OFF |  
                                
                        Empty lines are retained. | ||||||
| This command corresponds to the Empty Line Suppression option described in Editor Profile. | |||||||
SET ESCAPE
                                       character |  
                                
                        The escape character which must precede each line command. The default escape character is the plus sign (.). | ||||||
SET NUL
                                       [ON|OFF] |  
                                
                        ON |  
                                
                        All occurrences of a value scanned with the
                                    SCAN command are deleted. After the deletion of the
                                    scanned value, the SET NUL command is automatically
                                    set to OFF.
                         |  
                               
                     |||||
The default is OFF.
                                    
                         |  
                               
                     |||||||
SET RANGE
                                       [ON|OFF] |  
                                
                        ON |  
                                
                        The SCAN and
                                    CHANGE commands operate in range mode, which means
                                    that the value to be scanned/changed must be located within the range of lines
                                    delimited by the X and Y line markers.
                         |  
                               
                     |||||
OFF |  
                                
                        The SCAN and
                                    CHANGE commands operate in non-range mode, which
                                    means that no range limit is to be in effect.
                         |  
                               
                     ||||||
The default is OFF. 
                                    
                           The   |  
                               
                     |||||||
SET SEQ
                                       [ON|OFF] |  
                                
                        OFF |  
                                
                        If your input is numeric, the first four
                                    positions in the editing area are considered as the line number and are moved
                                    to the line number position once you press ENTER. 
                                    
                            This feature is useful, for example, if a statement line is to be referenced by a source code line number in another statement line; when you renumber the source code, the referencing line number is renumbered, too.  |  
                               
                     |||||
ON |  
                                
                        Numeric input in the first four positions remains as entered. | ||||||
Except for object type text, the
                                    default is OFF. 
                         |  
                               
                     |||||||
SET
                                          SIZE [ON|OFF] |  
                                
                        ON |  
                                
                        The size of the source is displayed at the bottom information line of the editor screen and the programming mode is displayed on the scale line. | |||||
OFF |  
                                
                        This information is not displayed. | ||||||
The default is OFF. 
                                    
                           The   |  
                               
                     |||||||
SET STAY
                                       [ON|OFF] |  
                                
                        ON |  
                                
                        The current screen will stay when ENTER is pressed. Forward and backward positioning can be done by positioning commands only. | |||||
OFF |  
                                
                        Pressing ENTER positions to the next screen. | ||||||
The default is OFF. 
                                    
                           The   |  
                               
                     |||||||
SET TYPE
                                       object-type |  
                                
                        This command is used to change the
                                    object type (displayed in the editor command line) for the source currently
                                    contained in the source work area. 
                                    
                            object-type represents one of the following values that must be specified with the command:  |  
                               
                     ||||||
P |  
                                
                        or PROGRAM |  
                               
                     ||||||
S |  
                                
                        or SUBROUTINE |  
                               
                     ||||||
N |  
                                
                        or SUBPROGRAM |  
                               
                     ||||||
H |  
                                
                        or HELPROUTINE |  
                               
                     ||||||
T |  
                                
                        or TEXT |  
                               
                     ||||||
C |  
                                
                        or COPYCODE |  
                               
                     ||||||
4 |  
                                
                        or CL or CLASS |  
                               
                     ||||||
7 |  
                                
                        or FUNCTION |  
                               
                     ||||||
SHIFT
                                       [-nn|+nn] | 
                                
                                
                        This command shifts each line
                                    delimited by the X and Y markers to the left or
                                    right. The nn parameter represents the number of
                                    characters the line is to be shifted. Comment lines are not shifted.
                         |  
                               
                     ||||||
SHIFT
                                       -- |  
                                
                        This command shifts each line
                                    delimited by the X and Y markers to the leftmost
                                    position. Comment lines are not shifted.
                         |  
                               
                     ||||||
SHIFT
                                       ++ |  
                                
                        This command shifts each line
                                    delimited by the X and Y markers to the rightmost
                                    position (maximum 99 positions). Comment lines are not shifted.
                         |  
                               
                     ||||||
SPLIT
                                       [parameter] 
                         |  
                                
                        This command splits the editor
                                    screen and displays the source of another Natural object in one half of the
                                    screen as described in Split-Screen
                                       Mode. 
                                    
                            parameter represents a parameter that must be specified with the command as described in Split-Screen Commands 
 If   |  
                               
                     ||||||
STOW
                                       [object-name] |  
                                
                        Executes the system command
                                    STOW which saves and catalogs the current source
                                    code. 
                                    
                           You must supply an object name if you
                                          |  
                               
                     ||||||
STRUCT [DISPLAY] |  
                                
                        This command performs structural
                                    indentation of source code. The default indentation is in increments of two
                                    positions. 
                                    
                            If   |  
                               
                     ||||||
* |  
                                
                        This command displays the editor command most recently entered. | ||||||
*= |  
                                
                        This command again executes the command most recently entered in the command line. | ||||||
Editor commands for positioning are entered in the command line of the program editor. The following commands are available for positioning:
| Command | Function | 
|---|---|
| ENTER 
                                    
                            or 
 or 
  |  
                                
                        Position forwards one page. | 
-P 
                                    
                           or 
  |  
                                
                        Position backwards one page. | 
+H |  
                                
                        Position forwards half a page. | 
-H |  
                                
                        Position backwards half a page. | 
T  
                                    
                           or 
  |  
                                
                        Position to top of source. | 
B  
                                    
                           or 
  |  
                                
                        Position to bottom of source. | 
+nnnn | 
                                
                                
                        Position forwards nnnn lines (maximum 4 digits). | 
-nnnn | 
                                
                                
                        Position backwards nnnn lines (maximum 4 digits). | 
nnnn | 
                                
                                
                        Position to line number nnnn. | 
X |  
                                
                        Position to the line marked with an X.
                         |  
                               
                     
Y |  
                                
                        Position to the line marked with a Y.
                         |  
                               
                     
POINT |  
                                
                         Positions to the line in which the line command
                                    .N was
                                    entered. 
                                    
                            See also the line command   |  
                               
                     
Line commands are entered in the first position of a source line. The
                       line commands provided by the program editor are listed below. The notation
                       (nn) or (nnnn) indicates
                       a repetition factor. The default repetition value is 1 (with the exception of
                       the .I command; see below). For explanations of the
                       syntax symbols used in this section, refer to
                       System Command
                          Syntax in the System Commands
                       documentation.
               
Note:
 We recommend that you enter a blank at the end of each line command.
                          This prevents the editor from attempting to interpret any information existing
                          on the line as part of the line command.
                  
| Line Command | Function | 
|---|---|
.C[(nnnn)] | 
                                
                                
                        Copies the line in which the command was entered. | 
                                    .CX[(nnnn)] 
                                    
                           or .CY[(nnnn)] | 
                                
                                
                        Copies the X-marked or the Y-marked line. See also the line
                                    commands .X and .Y as
                                    well as Notes for Line
                                       Commands.
                         |  
                               
                     
.CX-Y[(nnnn)] | 
                                
                                
                        Copies the block of lines delimited by the X and
                                    Y markers. (See also Notes for Line
                                       Commands.)
                         |  
                               
                     
.D[(nnnn)] | 
                                
                                
                        Deletes one or more lines beginning with the line in which you enter the command towards the end of the source (regardless of any direction indicator setting). The default is 1 line. | 
.I[(nn)] | 
                                
                                
                        Inserts nn empty lines, where
                                    nn can range from 1 to the total number of lines
                                    shown in the editing area minus two. For example, if a total of 28 lines is
                                    shown in the editing area, you can insert a maximum of 26 lines. 
                                    
                            If nn is not (or not correctly) specified, 9 lines (4 lines in split-screen mode) are inserted by default. Lines that are left blank are then removed from the source, depending on the setting of the editor profile options Empty Line Suppression and Empty Line Suppression for Text described in Editor Profile. See also Notes for Line Commands.  |  
                               
                     
.I(obj,ssss,nnnn) | 
                                
                                
                        Includes into the source an object contained in the current
                                    library or in the steplib (the default steplib is SYSTEM). 
                                    
                            Depending on the direction indicator, the object is inserted before or after the line in which you enter the command. If you want to include only part of the object, you specify as
                                        ssss the first line to be included (for example,
                                         If you enter multiple commands, this command is always executed after all other line and/or editor commands have been executed. If the object is a map, an  If the object is a data area, the entire data area is included,
                                        except comment lines. Only local and parameter data areas that were saved and
                                        cataloged with the  If the object is an adapter, a   |  
                               
                     
.J |  
                                
                        Joins the current line with the next line. 
                                    
                            If the resulting line exceeds the length of the editor screen line,
                                        the line is marked with an   |  
                               
                     
.L |  
                                
                        Undoes all modifications that have been made to the line since the last time ENTER was pressed. | 
 .MX 
                                    
                           or 
  |  
                                
                        Moves the X-marked or the Y-marked line. See also the line
                                    commands .X and .Y as
                                    well as Notes for Line
                                       Commands.
                         |  
                               
                     
.MX-Y |  
                                
                        Moves the block of lines delimited by the X and
                                    Y markers (see also Notes for Line
                                       Commands).
                         |  
                               
                     
.N |  
                                
                        Marks (invisibly) a line to be positioned at the beginning of
                                    the source work area by the editor command
                                    POINT. 
                                    
                           The mark is automatically deleted when an error with a line command
                                        or editor command occurs, or when the   |  
                               
                     
.P |  
                                
                        Positions the line marked with this command to the top of the screen. | 
.S |  
                                
                        Splits the line at the position marked with the cursor. | 
.X |  
                                
                        Marks a line with an X (see also
                                    Notes for Line
                                       Commands).
                         |  
                               
                     
.Y |  
                                
                        Marks a line with a Y (see also
                                    Notes for Line
                                       Commands).
                         |  
                               
                     
If both the commands .X and
                               .Y are applied to one line, it is treated as being
                               marked with an X and with a Y; the line marker
                               actually shown to reflect this status is a Z.
                     
If the direction
                                  indicator is set to + (plus sign), the copied, inserted
                               or moved lines are placed after the line in which the corresponding
                               command was entered; if the direction indicator is set to - (minus
                               sign), the copied, inserted or moved lines are placed before the line
                               in which the command was entered.
                     
The following special functions can also be controlled using PF keys:
| Function | Explanation | 
|---|---|
*CURSOR |  
                                
                        A line split function can be combined with the command
                                    .I, .CX,
                                    .CX-Y, .MX or
                                    .MX-Y. This is accomplished by assigning the value
                                    *CURSOR to a PF key in the editor profile (see
                                    PF and PA
                                          Keys in Editor
                                       Profile). If this PF key is then pressed instead of
                                    ENTER after a line command has been entered, the line in which the
                                    command was entered is first split at the cursor position and then the line
                                    command is executed. See also Example of *CURSOR on PF
                                       Key.
                         |  
                               
                     
*X 
                                    
                           or *Y |  
                                
                        If a PF key is assigned the value *X or
                                    *Y in the editor profile (see
                                    PF and PA
                                          Keys in Editor
                                       Profile), the cursor position is marked X or
                                    Y whenever this PF key is used. These position markers are then
                                    used to determine which portion of a line is to be included in the command
                                    operation. See also Example
                                       of *X and *Y on PF Keys.
                         |  
                               
                     
The following are instructions for using a PF key to which the value
                       *CURSOR is assigned.
               
In the PF and PA Keys section of the
                               Editor Profile screen (see
                               Editor
                                  Profile), enter *CURSOR next to
                               PF6.
                     
Open the program editor, type in the following text, and press ENTER:
>                                       > +  Program              Lib SAGTEST  
All    ....+....1....+....2....+....3....+....4....+....5....+....6....+....7..
  0010 MOVE A TO B                                                             
  0020 WRITE A B C                                                             
  0030 MOVE C TO B MOVE A TO C                                                 
  0040                                                                         
  0050                                                                         
  0060                                                                         
  0070                                                                         
  0080                                                                         
  0090                                                                         
  0100                                                                         
  ....                                                                         
  0280                                                                         
       ....+....1....+....2....+....3....+....4....+....5....+... S 3    L 1 | 
                        
In line 0020, enter the line command
                               .X and press ENTER.
                     
The line is marked as indicated by the X next to it.
                     
In line 0030, enter the line command
                               .CX, place the cursor on the M of the
                               second MOVE, and press PF6.
                     
The screen then looks similar to the one below:
>                                       > +  Program              Lib SAGTEST  
All    ....+....1....+....2....+....3....+....4....+....5....+....6....+....7..
  0010 MOVE A TO B                                                             
X 0020 WRITE A B C                                                             
  0030 MOVE C TO B                                                             
  0020 WRITE A B C                                                             
  0030 MOVE A TO C                                                             
  0040                                                                         
  0050                                                                         
  0060                                                                         
  0070                                                                         
  0080                                                                         
  0090                                                                         
  0100                                                                         
  ....                                                                         
  0260                                                                         
       ....+....1....+....2....+....3....+....4....+....5....+... S 5    L 1 | 
                        
Line 0030 is split before the cursor position, line
                               0020 is copied to the line after the line in which you entered the
                               .CX command, and the second half of the split line
                               is moved to the last line.
                     
The following are instructions for using PF keys to which the values
                       *X and *Y are assigned.
               
In the PF and PA Keys section of the
                               Editor Profile screen (see
                               Editor
                                  Profile), enter *X next to PF4 and
                               *Y next to PF5.
                     
Open the program editor, type in the following text, and press ENTER:
>                                       > +  Text                 Lib SAGTEST  
All    ....+....1....+....2....+....3....+....4....+....5....+....6....+....7..
  0010 THIS PORTION                                                            
  0020 OF TEXT IS                                                              
  0030 FOR DEMONSTRATION OF                                                    
  0040 PF-KEY ASSIGNMENTS.                                                     
  0050                                                                         
  0060                                                                         
  0070                                                                         
  0080                                                                         
  0090                                                                         
  0100                                                                         
  ....                                                                         
  0280                                                                         
       ....+....1....+....2....+....3....+....4....+....5....+... S 0    L 1   
 | 
                        
In line 0010, place the cursor on the letter
                               P and press PF4. 
                     
The position of P is marked as shown on the following
                               example screen.
                     
In line 0030, place the cursor on the blank character
                               behind DEMONSTRATION and press PF5.
                     
The screen then looks similar to the one below:
>                                       > +  Text                 Lib SAGTEST  
All    ....+X...1....+..Y.2....+....3....+....4....+....5....+....6....+....7..
X 0010 THIS PORTION                                                            
  0020 OF TEXT IS                                                              
Y 0030 FOR DEMONSTRATION OF                                                    
  0040 PF-KEY ASSIGNMENTS.                                                     
  0050                                                                         
  0060                                                                         
  0070                                                                         
  0080                                                                         
  0090                                                                         
  0100                                                                         
  ....                                                                         
  0280                                                                         
       ....+X...1....+..Y.2....+....3....+....4....+....5....+... S 4    L 1 | 
                        
The positions of the characters (P and blank) are marked
                               as indicated by the X and Y respectively, which
                               appear in the top and bottom information lines and next to the source lines
                               that contain the marked characters.
                     
In line 0040, enter the line command
                               .MX-Y and press ENTER.
                     
The screen then looks similar to the one below:
>                                       > +  Text                 Lib SAGTEST  
All    X...+....1....+.Y..2....+....3....+....4....+....5....+....6....+....7..
  0010 THIS                                                                    
  0030 OF                                                                      
  0040 PF-KEY ASSIGNMENTS.                                                     
X 0010 PORTION                                                                 
  0020 OF TEXT IS                                                              
Y 0030 FOR DEMONSTRATION                                                       
  0040                                                                         
  0050                                                                         
  0060                                                                         
  0070                                                                         
  0080                                                                         
  0090                                                                         
  0100                                                                         
  ....                                                                         
  0250                                                                         
       X...+....1....+.Y..2....+....3....+....4....+....5....+... S 6    L 1 | 
                        
The block of text starting with P in line
                               0010 and ending with N in line 0030 is
                               moved to the line below the line in which you entered the command. The moved
                               block of text and the remaining text in line 0010 and
                               0030 are left-justified.
                     
Cursor-sensitive commands are entered without any parameters but with the cursor positioned anywhere on the editor screen (except in the command line).
To use a cursor-sensitive command
Enter a cursor-sensitive command in the editor command line.
Position the cursor on any character string contained on the editor screen (except in the command line).
Press ENTER.
Alternatively, you can use a PF key:
Position the cursor on any character string contained on the editor screen (except in the command line).
Press the PF key to which the required cursor-sensitive command is assigned (see PF and PA Keys in Editor Profile).
The following topics are covered below:
The cursor-sensitive SCAN command searches
                        the current source for the character string on which the cursor is positioned.
                        (If the cursor is positioned on a blank character, however, the
                        SCAN/REPLACE window is invoked.)
               
In split-screen mode, the cursor can be placed on a string in the split-screen area, too.
When using the SPLIT SCAN command, the same
                        applies as for the SCAN command, but the scan
                        operation is performed in the split-screen area only (see also the section
                        Split-Screen
                           Commands).
               
For more information on SCAN, see the
                        relevant description in Editor
                           Commands.
               
Instead of using object-specific SPLIT
                        commands to display the source of an object (see the section
                        Split-Screen
                           Commands), you can use the cursor-sensitive
                        SPLIT command.
               
If you use the cursor-sensitive SPLIT
                        command and position the cursor on a character string that corresponds to an
                        object name or extended name (long name), the source code of the respective
                        object is displayed in the split-screen area of the editor. The required object
                        must be contained in the current library. 
               
This feature is particularly useful, for example, if you do not know the object name that corresponds to the extended name (long name) of an object (for example, a subroutine) referenced in the current source.
If you use the cursor-sensitive EDIT or
                        LIST command and position the cursor on a character
                        string that corresponds to an object name or extended name (long name), the
                        source of the respective object is shown:
               
With the EDIT command, the source is
                                loaded into the editing area. If necessary, even a different editor is invoked.
                                
                     
With the LIST command, the source is
                                listed, even if a view (DDM) has been referenced.
                     
The objects to be edited or listed must be contained in the current library.
For more information on EDIT and
                        LIST, see the
                        System Commands documentation.
               
You can save the source code currently in the source work area as a source object and also as a cataloged object, which are stored in a Natural library in a Natural system file.
To save and/or catalog the current source
Use the system command SAVE,
                                CATALOG
                                or STOW as
                                described in
                                Saving
                                   and Cataloging Objects in the Using
                                   Natural documentation.
                     
Note:
When you leave the program editor with the
                                   EXIT editor command, the current source code is
                                   saved automatically if the appropriate
                                   editor profile
                                   option is set accordingly as described in
                                   Exit
                                      Function.
                        
To keep a copy of the current source
Use the editor options Source Save into and Auto Save Numbers as described in Editor Profile.
A copy of the source edited last with any of the Natural editors is then automatically saved as a source object in the current Natural environment.
The exit function is used to terminate the current editor session by
                       issuing the EXIT command.
               
The effect of the EXIT command depends on the
                       setting of the editor
                          profile option
                       Prompt Window
                             for Exit Function:
If the option is set to Y (default setting), the
                               EXIT command invokes the EXIT
                                  Function window whenever you execute the command on a source that
                               contains unsaved modifications (see also
                               Modification Indicator). If
                               no modifications were made to the source, the window does not appear
                               and the editor closes without saving the source.
                     
The EXIT Function window provides the following options:
| Option | Explanation | 
|---|---|
| Save and Exit | Saves all modifications made to the current source code and leaves the editor. See also SAVE Object Window. | 
| Exit without Saving | Leaves the editor without saving any modifications made to the current source code since it was last saved. | 
| Resume Function | Neither leaves the editor nor saves any modifications; the prompt window is closed and the current function is resumed. | 
If the option is set to N, the
                               EXIT command executes the Save and
                                  Exit function: saves all modifications made to the current source
                               and leaves the editor. See also
                               SAVE Object
                                  Window.
                     
The Save and Exit function invokes the SAVE Object window if no object name has yet been defined for the current source code (as indicated in the editor command line).
This window prompts you to enter an object name and type. If you confirm your entries with ENTER, the source is saved under the specified name as a new object in the current library and the editor is terminated. PF3 closes the window without any action and the editor session is retained.