The Natural data area editor is used to create and modify a data area. A data area is a Natural object of the type global data area (GDA), local data area (LDA) or parameter data area (PDA). For information on using a data area, see Data Areas in the Programming Guide.
A data area contains data element definitions, such as user-defined variables, constants and database fields referenced with a data view in a data definition module (DDM), which can be used by one or more Natural objects. You can also create copycode from a data area. Note that data views from a DDM cannot be defined in PDAs.
Notes:
DEFINE
DATA
format, will be automatically converted into the internal format
before editing. This format can only be interpreted by the data area editor
itself and cannot be parsed by the Natural compiler directly. When the source
is saved with the data area editor, the internal format will be generated. In
this case, the original source layout (e.g. indentations for comments and
INIT
values) will get lost when the data area will be downloaded
to the NaturalONE client again.
Editors in the SPoD Environment in the Unicode and Code Page Support documentation
The Data Area Editor documentation covers the following topics:
You invoke the data area editor with the Natural system command
EDIT
described in the System Commands documentation.
To invoke the data area editor for a new data area
Issue the EDIT
command specifying
the type of data
area (GLOBAL
, LOCAL
or PARAMETER
) you
want to create.
For example:
EDIT LOCAL
An editor screen with an empty editing area appears for an LDA
(indicated by LOCAL
in the top information line of the screen)
similar to the example shown in the following instructions.
To invoke the data area editor for an existing data area
Issue the command EDIT
specifying
the name of a
data area that has been stored as a source object in your current Natural
environment.
For example:
EDIT LDA1
An editor screen similar to the example below appears which
contains the source of the local data area LDA1
:
Press <ESC> to enter command mode Mem: LDA1 Lib: SAGTEST Type: LOCAL Size: 1662 Line: 0 of: 36 C T Comment * *** Top of Data Area *** V 1 EMPLOYEES_VIEW EMPLOYEES 2 PERSONNEL-ID A 8 G 2 FULL-NAME 3 FIRST-NAME A 20 3 MIDDLE-I A 1 3 NAME A 20 2 MIDDLE-NAME A 20 2 MAR-STAT A 1 2 SEX A 1 2 BIRTH D 2 N@BIRTH I 2 G 2 FULL-ADDRESS M 3 ADDRESS-LINE A 20 (1:191) 3 CITY A 20 3 ZIP A 10 3 POST-CODE A 10 3 COUNTRY A 3 G 2 TELEPHONE F 1 HELP F 2 CHOICE F 3 QUIT F 4 SAVE F 5 STOW F 6 CHECK F 7 READ F 8 CLEAR F 9 MEM TYPE F10 GEN F11 FLD TYPE F12 |
The editor screen is organized in the following sections (from top to bottom):
Section | Explanation | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Command line | Used to issue an editor or a system command or execute a program as described in Edit Mode and Command Mode. This line only appears if command mode is set. Otherwise, a message regarding command mode is displayed instead. | ||||||||||||||||||||||||||
Information line |
|
||||||||||||||||||||||||||
Editing area | Contains the source of a data area or
appears empty for a new data area: see Using the Editing
Area.
You can only scroll in the source or modify the source if edit mode is set: see Edit Mode and Command Mode. |
||||||||||||||||||||||||||
Function-key lines | Contains the function keys (F keys) available to execute an editor command: see Editor Commands and Function Keys. | ||||||||||||||||||||||||||
Message line | Appears if an error occurs, in which case the message line temporarily overwrites the first function-key line with an appropriate error message. |
The data area editor operates in two different modes: edit mode and command mode.
In edit mode, you can scroll up or down in the source of the current data area, use the line commands required for creating or modifying source lines, and press all F keys available on the screen.
In command mode, you can enter or select an editor or a system command or execute a program. In command mode, you cannot modify the source of the data area.
By default, the data area editor is in edit mode when you invoke it.
To toggle between edit and command mode
Press ESC.
If command mode is set, the editor command line appears, which is indicated by Command: in the top left corner of the editor screen.
The current mode is kept for the duration of the Natural session.
To enter a direct command or a program name
In the command line, enter one of the following:
Any Natural system command.
For example: The system command
CHECK
can be used for checking the syntax of source code and
SAVE
for saving source code (see also Storing and Cataloging a Data
Area).
For other system commands related to maintaining and using object sources, see Managing Applications with Natural Objects in the System Commands documentation.
The name of a Natural program to be executed.
An editor command. All editor commands available are described in Editor Commands and Function Keys.
To select a direct command from a menu
In the command line, enter an M
(menu).
The following command menus appear:
When you select this menu (selected by default), a window with a subset of most frequently used commands appears. You can select and execute one of the following commands: , , , , , , or . For explanations of these commands, see the corresponding direct commands described in Editor Commands and Function Keys.
When you select this menu, all command menus are closed and the command line appears.
When you select this menu, the data area editor is
terminated. Any changes made to the current data area since the last
SAVE
or STOW
command are
not saved.
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 in Invoking the
Data Area 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 in the source to go to the line you want to view or modify as described in Viewing and Selecting Source Lines.
This section covers the following topics:
The editing area of the editor screen is organized in columns where all attributes that belong to a variable or field definition are maintained in one line.
The columns contained in the editing area are described in the following section. The contents of the columns depend on the values entered in the Definition or Redefine window (see Input Fields in the Definition or Redefine Window) when creating or modifying a variable or field. The contents also depend on whether a counter field (C* variable) was created from a field.
Note:
A column heading can change or disappear depending on the type
of variable or field contained in the current source line.
Column Heading | Explanation |
---|---|
C | The command column in which you can enter one of the line commands required to create or modify source lines. See also Line Commands. |
T | |
L | The level number of the variable or field (1 - 99).
Variables which are not within a hierarchical structure and view definitions must be assigned level 1. Level numbers cannot be used with data block definitions. |
Name of
variable-field-type
or Comment |
The name of the variable or field. This
column heading changes according to the type of variable or field currently
selected as indicated in the description of column T.
For a view, in addition to Name of variable-field-type, the Name of DDM column appears. For a block, in addition to Name of variable-field-type, the Name of Parent Block column appears. |
F | The Natural data format of the variable or field. |
Length | The length of the variable or field. |
Index/Comment | The array indices and/or comment of the variable or field. |
M | The M
(Miscellaneous) column contains an X if an edit mask, header,
and/or initial value is defined for a variable or field.
This column does not appear for a view, or a group, periodic group or multiple-value field within a view. |
In edit mode, you can scroll up or down in the current data area to view all lines of the source currently contained in the source work area, select a line for modification, or position at the line where you want to insert new lines.
To scroll in a source and select a line
Scroll up or down one line with UP ARROW and DOWN ARROW respectively.
Or:
Press HOME or END to access the
corresponding first (topmost) line or the last (bottommost) line contained in
the source work area.
Or:
Move the current source line up or down one screen page at a
time with PAGE UP or PAGE DOWN respectively. Check your
file SAGtermcap for entries if you have no access to any
of these keys.
The line in which the cursor is positioned is the current line, which is selected (highlighted) and can be modified.
In edit mode, you can create or modify the variable or field definition in the current source line by using the appropriate line command described in Line Commands.
The following are example instructions for using a line command to add single or multiple lines to a source or modify a line.
To add a line for a new definition other than a view, redefinition or counter field
In the C column, next to the selected line below which you want to place the new definition, type in the following line command:
I
If the data area is empty, enter the
I
next to Top of Data Area.
A selection window appears.
Select one of the following:
: | For a user-defined variable or a database field. |
: | For a data block within a GDA described in the Programming Guide. |
: | For a user-defined constant described in User-Defined Constants in the Programming Guide. |
: | For an object handle described in Using Classes and Objects in the Programming Guide. |
: | For a hierarchical group structure (not within a view). |
: | For a comment field. |
A Definition window appears for the selected type of variable or field in which you can enter the required attribute definitions. For explanations of the input fields contained in this window, see Input Fields in the Definition or Redefine Window.
To add lines for a view definition
In the C column, next to the selected line below which you want to place the view, type in the following line command:
V
If the data area is empty, enter
V
next to Top of Data Area.
A View Definition window appears.
Enter the name of the view to be created and the DDM from which to create the view. The specified DDM must be contained in the current Natural library in the current system file.
A DDM selection window appears with a list of all fields defined in the specified DDM.
Scroll through the list with the arrow (cursor) keys and
enter an X
next to each DDM field you want to select for the
view.
Or:
In the DDM selection window, enter an
A
next to any of the DDM fields to select all DDM fields for the
view.
You can deselect a field by replacing the X
with a blank character.
If no periodic group or multiple-value field is selected, all fields are copied into the data area.
If you selected a periodic group or multiple-value field, an Occurrences Definition window appears.
In the From: field(s), enter the lower bounds of the one- or two-dimensional array to be used in the view, and, in the To: field(s), enter the upper bounds.
The periodic group or multiple-value field is copied into the data area with the specified occurrences as subordinate fields of a hierarchical view definition structure where the view name is at level 1.
To modify the contents of a line
In the C column, next to the selected line, type in the following line command:
E
The Definition window (or Redefine window for a redefinition) appears for the variable or field definition contained in the selected line.
You create and modify a variable or field in the Definition window or the Redefine window for a redefinition. The input fields contained in this window depend on the type of variable or field selected. The table below lists and describes all possible input fields.
The definitions you enter in the Definition or Redefine window are checked for syntax errors.
For explanations of the variable or field attributes mentioned in
this section, see also User-Defined Variables
and Field
Definitions in the Programming Guide
and DEFINE DATA
in
the Statements documentation. The values used in the
DEFINE DATA
statement correspond to the values used in a data
area.
Input Field | Explanation | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Level | The level number (1 - 99) of the
variable or field.
Variables or fields which are not within a hierarchical structure must be assigned level 1. View definitions must be assigned level 1. Level numbers cannot be used with data block definitions. |
||||||||||||||||||
Name | The name of one of the following:
For valid names, see Naming Conventions for User-Defined Variables in the Using Natural documentation. For a user-defined constant, see also
|
||||||||||||||||||
Format | The Natural data format of the variable
or field.
For valid formats, see Format and Length of User-Defined Variables and Special Formats in the Programming Guide. For a counter field (C* variable), you can specify the Natural data format/length I2 or I4 (the default setting is N3 for no format/length). |
||||||||||||||||||
Length | The length of the variable or field.
For valid lengths, see Format and Length of User-Defined Variables in the Programming Guide. No length is permitted for the Natural data formats C,
D, T and L. You can define dynamic variables by specifying For a counter field (C* variable), you can specify the Natural data format/length I2 or I4 (the default setting is N3 for no format/length). |
||||||||||||||||||
Arraydefinition | The array definition of the variable or
field.
You can define the upper and lower bounds of a one- or two-dimensional array as demonstrated in Examples of Array Definitions. |
||||||||||||||||||
Edit Mask | Not applicable to PDAs.
The edit mask of the variable or field to be used when the variable or field is displayed with an I/O statement. Enter a valid value without using apostrophes or
parentheses as shown in Examples of Edit Mask
Definitions. For valid input values, see the corresponding
session parameter |
||||||||||||||||||
Header Definition | Not applicable to PDAs.
The header to be produced for the variable or field in a
Enter any alphanumeric character string without using
apostrophes or parentheses as shown in Example of a Header
Definition. For further information on headers, see the
corresponding session parameter |
||||||||||||||||||
Initialization |
|
||||||||||||||||||
Value Clause |
|
||||||||||||||||||
Optional Param |
|
||||||||||||||||||
Indexdefinition | The array definition of a variable of
the type structure (group).
This input field can be used to define the upper and lower bounds for an array, to supply initial values for a variable or to supply an edit mask for a variable. See also Examples of Array Definitions. |
||||||||||||||||||
Comment | Commentary text. |
(2,2) /* 2 dimensions, 2 occurrences (2,2,2) /* 3 dimensions, 2 occurrences (1:10,2) (-1:3,2)
999.99 XXX...XX MM.DD.YY
HEADER TEXT
INIT<3> INIT<'ABC'> INIT<H'F1F2'> /* binary variable (B2) CONST<12> INIT ALL<'ABC'>
You enter a line command in the C column of a source line when edit mode is set. The command entered may not be indicated in the column.
For a selection list of all available line commands, press F2.
All line commands provided by the data area editor are described in the following table. The expression "edit block" used in the table, denotes a marked block of source lines.
Command | Function | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
C
(Copy) |
Copies one or more lines. If
C is entered within an edit block, all lines of this
block are copied.
See also To cut/copy and paste an edit block. |
||||||||||||||||||||||
D
(Delete) |
Deletes one or more lines.
If See also To cut/copy and paste an edit block. |
||||||||||||||||||||||
E
(Edit) |
Depending on the variable or field type
selected, opens the Definition or
Redefine window (see also
Input Fields in the
Definition or Redefine Window), in which you can modify
the attributes of the variable or field contained in this line.
For a field within a view definition, you can only modify the following: Level (except periodic groups and multiple-value fields), Edit Mask, Header Definition, Indexdefinition and Comment. |
||||||||||||||||||||||
H
(Unmark block) |
Unmarks the current edit block. This command must be issued from within the edit block. | ||||||||||||||||||||||
I
(Insert line) |
Inserts a line for a new definition as described in To add a line for a new definition other than a view, redefinition or counter field. | ||||||||||||||||||||||
M
(Add comment) |
Adds comment mark(s) to the selected line or the marked edit block. These lines are ignored by a compiler check. This may be useful for testing purposes. | ||||||||||||||||||||||
N
(Remove comment) |
Removes comment mark(s) from the selected line or the marked edit block. | ||||||||||||||||||||||
P
(Paste) |
Pastes one or more lines into the data area
after the current line.
See also To cut/copy and paste an edit block. |
||||||||||||||||||||||
R
(Redefine) |
|
||||||||||||||||||||||
S
(Show) |
Displays the
Definition or Redefine window which
contains all definitions of the variable or field contained in this line (see
also Input Fields in the
Definition or Redefine Window). Changes are not possible.
If an initialization has been specified, a separate window containing initialization information is also displayed. Information scrolling is possible. |
||||||||||||||||||||||
V
(Insert view) |
Inserts a view definition as described in To add lines for a view definition. | ||||||||||||||||||||||
X
(Mark block start) |
Marks the beginning of an edit block. | ||||||||||||||||||||||
Y
(Mark block end) |
Marks the end of an edit block. | ||||||||||||||||||||||
Z
(Mark group) |
Marks an entire group structure as an edit
block.
The edit block starts at the current line and includes
all consecutive lines with levels less than the current line. For example, if
|
||||||||||||||||||||||
*
(Generate counter) |
Not applicable to PDAs.
Generates a counter field (C* variable) from the multiple-value field or periodic group contained in this line. The counter field is placed in the line above which you entered the command. A counter field is used to retrieve the number of occurrences of a multiple-value field or a period group. See also Referencing the Internal Count for a Database Array (C* Notation) in the Programming Guide. |
The following are instructions for using line commands to move or copy a block of lines or a single line within the source.
To cut/copy and paste an edit block
Next to the first line of the block of lines (or the single line) to be cut or copied, enter the following line command:
X
The line is marked.
Scroll up or down to the last line of the block of lines and enter the following line command:
Y
For a single line, you enter the line command
Y
in the same line, in which you entered the line
command X
.
All lines that belong to the block are marked (highlighted) thus representing the edit block.
Within the edit block, enter one of the following line commands:
C
to copy the line(s), or
D
to delete (cut) the line(s).
Position the cursor in the line below which you want to paste the line(s) and enter the following line command:
P
The line(s) are pasted into the source.
You can unmark the edit block by entering the following line command within the edit block:
H
The edit block is unmarked and only the current line is highlighted.
This section describes the editor commands and editor-specific system commands that can be entered in the command line or selected from the
menu in command mode.In addition, this section describes alternative F keys that can be used in edit mode. In command mode, you can only use F1.
For explanations of the syntax symbols used in the editor commands, refer to System Command Syntax in the System Commands documentation.
Command | F Key | Function | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
n/a | F1 | Provides help information on
editor features. See also Help
Information and Selection Options.
Note: |
||||||||||||||||||||
n/a | F2 | Invokes a selection window with valid input values for the input field in which the cursor is positioned. | ||||||||||||||||||||
CATALOG
[object-name] |
n/a | Executes the system command
CATALOG which checks and catalogs the current data area
definition.
You must supply an object name with the command if you catalog a new data area definition or if you want to copy the current data area. Otherwise, an appropriate message appears. See also Storing and Cataloging a Data Area. |
||||||||||||||||||||
CHECK |
F6 | Executes the system command
CHECK
which checks the syntax of the current data area definition. A window informs
you that a syntax check is in process. If a syntax error is found, the line
containing the error becomes the current line, and the error is displayed in
the message line. If no errors are found, a corresponding message is
displayed.
|
||||||||||||||||||||
CLEAR |
F8 | Executes the system command
CLEAR
which clears the source work area. Changes to the data area currently contained
in the source work area are lost if they were not previously saved.
|
||||||||||||||||||||
FLD TYPE |
F11 |
|
||||||||||||||||||||
GENERATE
object-name
|
F10 | Generates a Natural object
of the type copycode from the current data area definition thus overwriting the
contents of the source work area. Changes made to the data area since the last
SAVE or
STOW are
lost.
The copycode object is stored as a source object in the
specified Natural library in the current system file under the
|
||||||||||||||||||||
QUIT
or
(a period) |
F3 | Terminates the data area
editor.
Any changes made since the last
|
||||||||||||||||||||
READ
object-name
|
F7 | Executes the system command
READ
which reads an existing data area definition into the source work area. The
data area must be stored as a source object with the specified
object-name in the current Natural
library in the current system file.
|
||||||||||||||||||||
SAVE
[object-name] |
F4 | Executes the system command
SAVE which saves the current data area definition.
You must supply an object name if you save a new data area definition or if you want to copy the current data area. Otherwise, an appropriate message appears or input window appears. If you press F4, a window always prompts you for name of the data area and the library. If the current object and library names are correct, no entry is required. See also Storing and Cataloging a Data Area. |
||||||||||||||||||||
SCAN
scan-value |
n/a | Scans the data area for a character
string (scan-value ) in the
Name of variable-field-type
column (default) and/or the M column of the editor screen,
depending on whether the SET
SCAN command was executed earlier.
The line in which the
The scan is performed from the first to the last line in the source work area and wraps around to the beginning after the last line is reached. Note: |
||||||||||||||||||||
SET ABS
[ON|OFF] |
n/a |
|
||||||||||||||||||||
SET SCAN
[COMMENT|NAME|LEVEL] |
n/a |
|
||||||||||||||||||||
STOW
[object-name]
|
F5 | Executes the system command
STOW which saves and catalogs the current data area
definition.
You must supply an object name if you
See also Storing and Cataloging a Data Area. |
||||||||||||||||||||
SET TYPE G|L|A |
F9 |
|
Before a data area can be used in a Natural program (or another object), the data area must be saved as a source object and/or a cataloged object in the current Natural environment.
The commands used for saving and cataloging the current data area definition are described in the following section.
You must supply an object name if you save or catalog a new data area definition or if you want to copy the current data area. Otherwise, an appropriate message appears or a window prompts you for the name. For the naming conventions that apply when saving or cataloging a data area, refer to Object Naming Conventions in the Using Natural documentation.
To save a data area as a source object
Enter the system command SAVE
according
to the syntax rules described in the System Commands
documentation.
Or:
Press F4.
Or:
From the menu, choose
.
The source of the data area is stored as a source object in the specified Natural library in the current system file. The data area is not checked for syntax errors.
To save a data area as a cataloged object
Enter the system command CATALOG
according to the syntax rules described in the System
Commands documentation.
The source of the data area is checked for syntax errors. If no errors are found, it is saved as a cataloged object in the specified Natural library in the current system file.
To save a data area as a source object and a cataloged object
Enter the system command STOW
according
to the syntax rules described in the System Commands
documentation.
Or:
Press F5.
Or:
From the menu, choose
.
The source of the data area is checked for syntax errors. If no errors are found, it is saved as a source object and a cataloged object in the specified Natural library in the current system file.
You can use the help system to obtain help information on editor functions and input fields. In addition, in edit mode, you can use the help system to choose a valid input value or a line command from a list.
To display help information
In edit mode, position the cursor in the C column and press F1 for a summary of all editor functions available.
Or:
Place the cursor on the field about which you require further
information and press F1 for instructions on using this field.
A window appears with help information.
You can use the arrow (cursor) keys to scroll up or down in the window.
Choose ENTER or ESC to close the help window.
To select a valid value or appropriate line command
Place the cursor on the field for which you want to select a valid input value or execute a line command and press F2.
If applicable, a selection window appears from which you can select an input value or a line command.