Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Study
Guide
Natural
Study Guide
Version 4.1.3
Edited by D. D. Hamilton
WH&O International
5th Edition
ii
The WHERE Clause of the FIND and READ Statements .............................. 135
FINDWITHWHERE............................................................................................. 135
READWHERE .......................................................................................................... 137
Natural System Variables and the WHERE ............................................................. 137
Table of Contents
iii
iv
11
Chapter 1
Introduction to Natural
Natural provides a set of integrated tools which allow creation, maintenance, and
documentation of on-line and batch environment. It has two main components. The first
is a program development environment complete with a program editor, data area
editor, map editor, compiler, and library maintenance subsystem. The second is the
powerful database-oriented programming language for maintaining data on ADABAS
databases. (There are versions for accessing VSAM files and DB2 databases as well as
other database platforms).
During this course, you will use the development facilities of Natural to code, test,
modify, and store Natural programs and other Natural objects in an on-line environment.
Menus
First well take a look at the menus you will see when you log onto Natural. If you do not
know how to LOGON to Natural from your terminal, ask your Course Supervisor for
help. Your first menu welcomes you to the Natural Applications Development System.
The first menu you will see after logging onto Natural is the Main Menu (Figure 1.2). Try
getting into Natural from your terminal and confirm that the screen appears as in Figure
1.2. If it does not, ask your Course Supervisor to help you.
If this is the screen (Figure 1.1) you see when logging into Natural, just type menu on
the MORE line and press [ENTER].
12
MORE
12:34:56
Friday, April
NNN
NN
AAAAAAAA
NNNN NN
AA
AA
NN NN NN
AA
AA
NN NNNN
AAAAAAAA
NN
NNN
AA
AA
NN
NN
AA
AA
TTTTTTTTT
UU
UU
RRRRRRRR
AAAAAAAA
LL
TT
UU
UU
RR
RR
AA
AA
LL
TT
UU
UU
RR
RR
AA
AA
LL
TT
UU
UU
RRRRRRRR
AAAAAAAA
LL
TT
UU
UU
RR RR
AA
AA
LL
TT
UUUUUUUU
RR
RR
AA
AA
LLLLLLLL
44
44
44
44
44
44
444444444
44
44
<>
A
1, 2005
P R O D U C T
1111
11 11
11 11
11
11
111111
O F
SM Level 0003
S O F T W A R E
A G
Function
2005-04-01
Library CLASSLIB
Mode Reporting
Work area empty
Create Object
Edit Object
Rename Object
Delete Object
Execute Program
List Object(s)
List Subroutines Used
Help
Exit
Type .. _
Name .. ________________________________
Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--Help Menu Exit
Canc
Development Facilities is the only Function addressed in this Study Guide. Until you
gain a better understanding of Natural. Help is the only other Function you should
attempt to use. Upon completion of the course, the Example Libraries would be an
interesting adjunct to the course materials.
13
Introduction to Natural
12:34:56
User STUDENT
2005-04-01
Library CLASSLIB
Function
_
_
_
_
_
_
_
_
Development Functions
Development Environment Settings
Maintenance and Transfer Utilities
Debugging and Monitoring Utilities
Example Libraries
Other Products
Help
Exit Natural Session
Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--Help
Exit
Canc
Function
2005-04-01
Library CLASSLIB
Mode Reporting
Work area empty
Create Object
Edit Object
Rename Object
Delete Object
Execute Program
List Object(s)
List Subroutines Used
Help
Exit
Type .. _
Name .. ________________________________
Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--Help Menu Exit
Canc
14
Natural objects are discussed later in this section. They can be created, updated, renamed,
deleted, and listed in the process of developing an application system. All of these
facilities, as well as others, are available from this Development Facilities menu. Youll
look at these different facilities later in the course. Return to the Main Menu by either
typing . (a period) in the CODE field or pressing the [PF3] key. Then terminate your
Natural session by typing . in the Exit Natural Session field or pressing the [PF3] key
while on the Main Menu.
Data area object types are used by the programs to hold the data on which they are
operating.
Map objects define screen and report layouts as well as validation rules for input
data.
Description objects enable you to record documentation on the programs that you
develop.
We will use programs, data areas, and maps exclusively in this course. Descriptions are
covered in WH&Os Introduction to PREDICT, and will not be discussed otherwise herein.
A minimum amount of time is spent on the Map Editor in this study guide; you may
consider the WH&Os Advanced Natural Study Guide which deals in greater detail with
maps, windows, and on-line applications in general.
Introduction to Natural
15
Objects (modules) of the three main types (programs, data areas and maps) can exist in
both source and object forms. The source is the form that is readable to a programmer
and is manipulated by using the appropriate editor.
Before the object or modules of any of these types can be used as part of an application, it
must be compiled into object form. This double meaning of object can be understood if
you keep clear in your mind the general concept of an object as a readable source that
you can manipulate and the object form as an object which has been compiled into a
computer readable form for execution.
Natural Libraries
Natural Libraries are where you store the objects you have created or modified. If you do
not store them in a library, they will be lost when you end your Natural session. The
Natural system supports many libraries, each identified by a library name, up to 8
characters long. You identify the library you want to work with by typing a LOGON
command specifying the library name. Natural will then connect you to the specified
library. Natural stores the contents of its libraries on an ADABAS file called the Natural
System File.
You can only work on one library at a time. All objects that you read into an editor will
be read from your current library. Both the source and object form of objects are stored in
the same library. To access another library you must type another LOGON command to
disconnect from your current library and connect to the new library.
16
However, instead of being taken into the Development System Main menu as you were,
the user will normally be transferred to the first Natural program they wish to use. This
will probably be an application menu program.
The exact way that the user is transferred into Natural will depend on how Natural has
been set up at your installation. Your Natural Administrator will be able to tell you how
things are done at your site.
In an interactive environment all commands and parameters are read from the terminal
and all output is directed to the terminal. Your users operate in an interactive mode
whereas you program on-line.
Using Natural in Batch
To run a Natural program in batch you must run a batch job that invokes the Natural
environment. Your installation should have standard JCL for doing this. The JCL will
actually EXEC Natural (that is, the Natural environment). Once Natural has started it,
will read commands and parameters from a SYSIN data set (which may be coded in-line).
The commands will cause Natural programs to be run and these programs may
themselves read parameters from the SYSIN data set.
In the batch environment all output is directed to SYSOUT data sets. Sequential OS data
sets may be read and written in batch.
Introduction to Natural
17
18
There are a few more commands than appear on this list. Please refer the Software AGs
Natural Reference Manual or WH&Os Natural Developers Handbook for details on these and
other Natural Commands and their parameters. General syntax for commands and their
parameters:
command
global
parameter
local
program
subprogram
subroutine
helproutine
copycode
map
[module-name]
For example:
object
type
object
(module)
name
Natural Commands may be abbreviated. The command example can also be coded:
349
INDEX
*COUNTER, 122, 129
*ERROR-LINE, 321
*ERROR-NR, 321
*NUMBER, 122, 129
*PAGE-NUMBER, 152
ACCEPT and REJECT statements, 198
add a new record, 260
ADD ROUNDED, 239
ADD ROUNDED GIVING, 239
ADD statement, 237
Alphanumeric Edit Masks, 311
AND Connection, 121
arithmetic operations, 255
arithmetic-expression, 247
Arrays, 205
arithmetic expressions as indexes, 214
C* notation, 218
Data Area Editor, 222
dimension, 215
Free Mode Initialization, 210
Initial Values, 210
Initial Values and Edit Mask, 210, 213
Multiple Value Field, 217
Periodic Group, 218
Arrays:. ARRAY3, ARRAY2,
ARRAY1
ASSIGN [ROUNDED, 111
ASSIGN statement, 111
AT BREAK block, 303
AT BREAK OF DEPT statement, 305
AT BREAK statement, 302
350
Data Definition Modules, 4
Data Editor, 37
database variables, 19
Date Format Edit Masks, 312
DB
0, 347, 348
DECIDE FOR EVERY, 189
DECIDE FOR FIRST, 189
DECIDE FOR statement, 189
DECIDE ON FIRST, 188
DECIDE ON statement, 187
DECIDE ONVALUE OF, 187
default title, 143
default title line, 296
DEFINE SUBROUTINE, 274
Delete Object function, 109
DELETE Statement, 262
deletes a record, 262
Description objects, 14
Development Facilities, 12
Direction Indicator, 74
DISPLAY
Headers, 144
Positioning Text and Variables, 146
T notation, 146
DISPLAY statement, 143
DIVIDE GIVING, 245
DIVIDE GIVING ROUNDED, 246
DIVIDE statement, 244
edit mask, 33
Edit Mask, 53
Editor Work Area, 15
Empty Line Suppression, 329
END statement, 85
END TRANSACTION, 265
END-ALL, 336
END-BREAK, 302
END-ENDFILE, 290
END-FOR, 197
END-READ, 124
END-SUBROUTINE, 274
END-TOPPAGE, 299
END-WORK, 289
ESCAPE
BOTTOM, 195
TOP, 195
ESCAPE statement, 195
EXAMINE
351
MULTIPLY GIVING, 243
MULTIPLY statement, 242
NATURAL Commands, 14, 17
NATURAL comment line, 71
NATURAL file definition, 42
NATURAL Libraries, 15
NATURAL Mathematical Functions,
251
NATURAL on-line, 15
NATURAL program, 284
NATURAL program in batch, 16
NATURAL SORT statement, 336
NATURAL stack, 285
NATURAL subprogram, 281
NATURAL Subroutine, 274
NATURAL System Functions, 304
NATURAL System Functions:, 304
NATURAL System Variables, 20
Negation, 121
NEWPAGE
IFLINES LEFT, 157
title, 157
NEWPAGE statement, 149
non-NATURAL subprogram, 284
Numeric Edit Mask, Floating Character,
310
Numeric Edit Mask, Zero Suppression,
308
Numeric Edit Mask, Zero Suppression,
Fixed Position Sign, 309
Numeric Edit Mask, Zero Suppression,
Floating Sign, 309
Numeric Edit Masks, 307
check protection, 310
floating currency symbol, 310
Inserted spaces, 309
object in NATURAL, 14
Object Type Indicator, 279
OLD, 303
ON ERROR statement, 321
one dimensional array, 206
OR Connection, 121
P*, 315
Parameter Data Area, 21, 281
Parentheses, 121
PERFORM statement, 274
Periodic Group, 27
Periodic Groups, 49
352
PRINT
compresses, 163
variables are output, 163
PRINT statement, 163
printer number, 293
Printing in Batch, 293
logical printers, 293
printer, 293
printer number, 293
processing loops, 130
Profile Maintenance, 101
Program Attention (PA) keys, 340
Program Comments, 71
Program Editor
CHECK, 95
Command Line, 70
copy function, 78
Delete, 79
Direction Indicator, 74
help information, 104
INSERT, 83
join, 89
MOVE, 82
PROFILE command, 101
Program Editor work area, 70
READ command, 94
SCAN, 90
SPLIT command, 88
Split Screen function, 98
STOW command, 94
top of the program, 87
X and Y markers; no other alphabetic
characters can be used for the
purpose. You will now copy the
marked range of lines to another
position using the, 77
Program Function (PF) keys, 340
Program object types, 14
PS parameter, 300
qualifying a variable, 131
READ, 67
END-READ, 125
READ LOGICAL
ENDING AT, 126
STARTING FROM, 125
READ PHYSICAL, 128
READ statement, 124
READ viewname LOGICAL, 124
353
Writing/Reading the Same Workfile,
292
X and Y markers, 77
WH&O
International
1-878960-00-8