Natural Editor

This document covers the following topics:


Functional Scope

"Natural Editor" is a general term used to describe the Predict editors listed below. These editors can be used to modify all editable attributes of Predict objects. Many main and line commands are common to all editors. All these editors share a common profile. Editor-specific differences are described under Task-Specific Editors.

Prerequisites

No additional prerequisites need to be met when working with the Natural Editor.

Presettings

The following commands can be used to customize the Natural Editor:

Profile

Common Natural and Predict Profile

The editor profile you define in Predict and your Natural profile are identical. Changes you make to your Predict profile may not be suitable for working in Natural and vice-versa.

System Profile

If a user does not have a profile defined, the profile SYSTEM is taken as default. The SYSTEM profile can be modified and saved under a given name.

The SYSTEM profile can be modified in module USR0070P in library SYSLIBS.

Upper and Lower Case

A combination of Predict default and Natural parameter settings determine whether text in an extended description is converted to upper case. See table of possible values and recommendations.

How Editor Commands are Called

Editor functions are executed with one of the following types of commands:

  • Main
    commands are typed in the command field of the editor (top left corner).

  • Line
    commands are typed at the beginning of a line and start with an escape character, normally a period (.).

Note:
If Con-form instructions are to be used, another escape character must be assigned in the session profile and with the SET ESC command of the editor.

Note:
The special line commands *X, *Y and *CURSOR that allow block-oriented text editing must be assigned to a PF key.

Command Field Indicator Field
    >                     > + FI: JCA-FI1                          L: 1    S: 3
     All  ....+....1....+.... Extended description ...+....5....+....6....+....7..
   
          This is a sample extended description
          This is the second line of the description.
   
   
   
   

Undoing Changes

Changes to text that have not been confirmed with ENTER can be undone with

  • the main command LET

  • the line command .L

Indicator Field

The value in the indicator field (plus or minus) determines the direction of certain main and line commands.

Examples:

  • The main command ADD adds blank lines at the beginning (-) or end (+) of the text.

  • The line command .C copies text above (-) or below (+) the current line.

  • SCAN commands search forward (+) or backward (-)

The value can be changed by overwriting it.

Basic Functions

The basic functions of the Natural Editor below are described in greater detail in the Natural Utilities documentation. The section here gives an overview of the basic functionality of the Natural Editor and describes any differences of the individual functions when used in Predict. This section covers the following topics:

General Functions

The parts of editor commands and parameters that can be omitted are enclosed in square brackets ([]).

Editor Command Description
*=  Repeat the previous editor command.
* Display the previous editor command.
CAT, SA[VE][R[ETURN]] Save and quit the editing session. If RETURN is specified: Save and stay in the editing session.

Note:
Additional syntax checks are performed when cataloging or saving subquery clauses or rules.

E[ND], Q[UIT], . End the editing session and leave the editor (without saving the text).
HELP, ? Display a summary of commands for the editor.
HELP nnnn, ? nnnn Display the specified Natural error message in the Natural help system.
HELP DICnnnn, ? DICnnnn Display the specified Predict error message.
LET Undo changes to the text that have not yet been confirmed with ENTER.
PROFILE Display the current Natural Editor profile settings, for example PF keys and escape character assignments. This profile can be modified and saved under a given name. The default is the Natural Editor profile "SYSTEM".

Note:
Predict and Natural use the same profile. Changes made to the profile here are also in effect for your Natural session.

PROFILE name Load the specified profile for the current session.
SET ESC char Change the escape character with which editor line commands begin to char (example: SET ESC ;).

Note:
If Con-form is used, you cannot use a period (.) as escape character.

Scrolling

Some of the following commands are normally assigned to PF keys.

Editor Commands Description
+|- n Move forward|backward n lines.
+|- H Move forward|backward half a page (10 lines).
These commands are normally assigned to PF5 (move forward) and PF4 (move backward).
+|- [P] Move forward|backward one page (20 lines). -P is normally assigned to PF1.
SET STAY No scrolling is done when ENTER is pressed and the contents of the screen have not been altered.
SET STAY OFF The screen display is moved forward one page when ENTER is pressed and the contents of the screen have not been altered.
B[OT], ++ Move to the bottom of the text.
This command is normally assigned to PF3.
T[OP], - Move to the top of the text.
This command is normally assigned to the key PF2.
POINT Move the line where the .N line command was given to the top of the screen (see description of .N command below).
X|Y Move to the line marked with the line command X or Y (see description of line commands below).

 

Line Command Description
.P Position the current line to the top of the screen.

Marking Text

A section of text can marked by marking its first line with X and its last line with Y. Copy, delete, move, modify and scan operations can then be restricted to a range of text.

Note:
If the PF key commands *X and *Y are used, the marked section can include partial lines.

Editor Command Description
RES[ET] Delete X and Y marks and reset values specified with the SCAN command.

 

Line Commands Description
.X, .Y Mark the current line with X or Y.
These marks are used by the following commands:
- Main commands DX, DX-Y, DY, EX, EX-Y, EY, X,Y
- Line commands .CX, .CX-Y, .CY, .MX, .MX-Y, .MY.
*X, *Y Mark the line and column of current cursor position with X or Y.
If marks have been set with *X and *Y, the following commands process the text section starting in the line and column marked with *X and ending in the line and column marked with *Y.
- Main commands DX-Y and EX-Y
- Line commands .CX-Y and .MX-Y.

Note:
The commands *X, *Y must be assigned to PF keys. See Customizing Predict with Profiles in the section Predict User Interface in the Introduction to Predict documentation.

.N Note the current line (see description of the POINT command in the section Scrolling.)

Copying Text

Main Commands Description
EXP[ORT] See Exporting Text to an External Target
IMP[ORT] See Importing Text from an External Source
SEL[ECT] See Selecting Text from another Source within Predict

Note:
The commands above are not applicable to the Link Editor.

The following commands are used for copying text within an object (for example an extended description).

Line Commands Description
.C[(n)] Copy the current line n times (default: 1 copy).
.CX[(n)] Put n copies (default: 1 copy) of the line marked with X either above (-) or below (+) the current line. If a character is marked with X, do not copy characters before it in the line.
.CX-Y[(n)] Put n copies (default: 1 copy) of the text between the X and Y marks (inclusive) either above (-) or below (+) the current line.
.CY[(n)] Put n copies (default: 1 copy) of the line marked with Y either above (-) or below (+) the current line. If a character is marked with Y, do not copy characters after it in the line.
.H Identifies the target line of an IMPORT or SELECT command. Depending on the value in the indicator field, the text is added above (-) or below (+) the current line.

Inserting Lines

Editor Command Description
ADD Insert 10 blank lines at the beginning (-) or end (+) of the text and scroll accordingly. New lines that are still blank will be deleted when the ENTER key is pressed.
Line Commands Description
.I[(n)] Insert n (default: 10) blank lines either above (-) or below (+) the current line.
.W(n)] Inserts n (default: 10) blank lines either above (-) or below (+) the current line. New lines that are still blank will be deleted when the ENTER key is pressed.

Deleting Lines

Editor Commands Description
CLEAR Deletes all lines. Note: that Predict reads the default extended description skeleton whenever an empty extended description is opened with the description editor.
DX Delete the character marked with X and characters after it in the same line. If a whole line is marked with X, delete it.
DX-Y Delete the text between the X and Y marks inclusive.
DY Delete the character marked with Y and characters before it in the same line. If a whole line is marked with Y, delete it.
EX Delete all text before the X mark (exclusive).
EX-Y Delete all text before the X mark and all text after the Y mark (exclusive).
EY Delete all text after the Y mark (exclusive).
Line Command Description
.D[(n)] Delete the current line and the following n-1 lines.

Moving Lines

Line Commands Description
.MX Move the line marked with X to either above (-) or below (+) the current line. If a character is marked with X, do not move characters before it in the line.
.MX-Y Move the text between the X and Y marks (inclusive) to either above (-) or below (+) the current line.
.MY Move the line marked with Y to either above (-) or below (+) the current line. If a character is marked with Y, do not move characters after it in the line.

Modifying Lines

Note:
With the exception of the command .L, the commands for modifying lines are not available in the Link Editor.

Editor Commands Description
COM[PRESS] Concatenate text between the X and Y marks (inclusive) into as few lines as possible. If no X mark is set, concatenate from the beginning of the text. If no Y mark is set, concatenate up to the end of the text.
SHIFT +n Shift the lines between the X and Y marks (inclusive) n columns to the right.
SHIFT -n Shift the lines between the X and Y marks (inclusive) n columns to the left.
Line Commands Description
.J Join the next line to the end of the current line.
.L Restore the current line to the state it had immediately after the ENTER key was last pressed.
.S Split the current line at the cursor position.
*CURSOR *CURSOR performs two operations:
The current line is split at the cursor position and marked text or blank lines are inserted between the two split parts. The line command (.C, .M, .I or .W) entered in the line of the cursor position when *CURSOR is executed determines whether text or blank lines are entered.

Searching and Replacing Strings

The plus (+) or minus (-) sign displayed in the indicator field at the top of the editor screen determines whether search commands are executed forward (towards the end of the text) or backward (towards the beginning). Change the +/- sign by overwriting it.

The SCAN and CHANGE commands contain a special character that delimits strings of text. In the table below, the apostrophe (') is used as delimiter but another special character can be substituted.

The way SCAN and CHANGE work can be changed with the SET command. See Setting SCAN Options below.

Editor Commands Description
SCAN 'string' Search either forward (+) from the top of the current screen display to the end of the text or backward (-) from the bottom of the current screen display to the beginning of the text for lines containing the specified string, mark these lines with S and move to the first of them. See the SET ABS, SET RANGE and SET NULL commands.
SCAN, SC Display a menu offering all the SCAN/CHANGE options mentioned above. This command is normally assigned to the key PA2.
SCAN=, SC= Repeat the previous SCAN command. This command is normally assigned to PF6.
CHANGE 's1's2' Scan for lines containing s1, replace each s1 with s2 and mark the line with R.

Setting SCAN Options

Option Description
SET ABS [ON] Absolute scan. SCAN and CHANGE find all occurrences of the string no matter what comes before or follows them.
SET ABS OFF Cancel the above setting. A string will be found only if it is preceded and followed by a space, new line or special character.
SET RANGE [ON] Limit the range of SCAN or CHANGE to the lines between the X and Y marks inclusive.
SET RANGE OFF Cancel the SET RANGE command.
SET NULL [ON] Delete all strings that satisfy the next SCAN command.
SET NULL OFF Cancel the SET NULL command.