0% found this document useful (0 votes)
116 views476 pages

Natural Programming Essentials

The document is a participant guide for a course on Natural Programming Essentials, covering topics such as basic structure, data definitions, conditional processing, and error handling. It includes detailed information on programming objects, naming conventions, and syntax used in the Natural language. The guide is intended for internal use by Software AG partners and contains copyright information and a table of contents outlining the course structure.

Uploaded by

allan.andrewdc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views476 pages

Natural Programming Essentials

The document is a participant guide for a course on Natural Programming Essentials, covering topics such as basic structure, data definitions, conditional processing, and error handling. It includes detailed information on programming objects, naming conventions, and syntax used in the Natural language. The guide is intended for internal use by Software AG partners and contains copyright information and a table of contents outlining the course structure.

Uploaded by

allan.andrewdc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PARTICIPANT GUIDE

Natural Programming
Essentials
E307-7BE
© 2022 Software AG. All rights reserved.
Copyright

This publication is protected by international copyright law. All rights reserved.


No part of this publication may be reproduced, translated, stored in a retrieval system, or transmitted in any form or by any
means, electronic, mechanical, photocopying, recording or otherwise, without the prior permission of Software AG.

Software AG and all Software AG products are either trademarks or registered trademarks of Software AG. Other product or
company names mentioned herein may be the trademarks of their respective owners.

2 © 2022 Software AG. All rights reserved.


Table of Contents

1. Basic Structure of Natural


2. Simple Data Definitions​
3. Conditional Processing
4. Loop Processing
5. INPUT-OUTPUT-Maps
6. Workfile Processing
7. String Processing
8. Modularization part I
9. Modularization part II

3 © 2024 Software AG. All rights reserved.


Table of Contents (cont.)

10. Complex Data Types and Arrays


11. Error Handling
12. Adabas, DDMs and Views
13. Adabas Access from a Sample Application
14. Adabas, DDMs and Views
15. Adabas Find Access
16. Data Manipulation and Contention

4 © 2024 Software AG. All rights reserved.


01

Basic Structure of Natural

5 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Natural - A Procedural Language


▪ Natural Object Types with Naming Conventions
▪ Basic Structure of Modules
▪ Syntax used in this Course

6 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Natural - A Procedural
Language

7 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Procedural vs. OOP

Procedural Object Oriented


Top-Down approach Bottom-Up approach

Divided into functions Smallest unit object

No access specifier Object access specifiers

Functions over data Data over functions

No overloading Overloading is possible

C, Pascal, Basic, Fortran, etc. C++, C#, Java, Python, etc.

Simple - easy to learn More complex (Inheritance, Polymorphism)

Faster Execution Increased execution time

8 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Natural Object Types with
Naming Conventions

9 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Natural ´Folder´ Structure

Only available in NaturalONE

Available on all platforms

10 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Programming Objects

▪ Modules
▪ Program
▪ Subprogram
▪ Subroutine
▪ Function
▪ CopyCode
▪ Helproutine
▪ Text

11 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Programming Objects

▪ Data areas
▪ Local data area
▪ Parameter data area
▪ Global data area
▪ Database access
▪ DDM
▪ Others
▪ Map, Helproutine,
▪ Error Message Text,
▪ Resource, Adapter, …

12 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Naming Conventions

▪ Object Name
▪ First character

− Upper-case alphanumeric
− A number or plus sign (#,+)
▪ Can include special characters
▪ 1-8 characters

▪ Library
▪ 1-8 characters
▪ Must not start with ´SYS´

13 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Basic Structure of Modules

14 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Basic structure of a module

Variables
James 2015-05-01
Application System
Meier
defined defined
1991-05-01

24

COMPUTE AGE = *DATX – [Link]

Statements ..
15 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Two Programming Modes

▪ Structured Mode
▪ All variables are defined on top

▪ Reporting Mode
▪ Variable definition is within program logic

16 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Syntax

17 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Syntax used in this Course

Syntax Symbol Description


ABCDE Term a Natural keyword or reserved word

abcde Presents variable information, you must supply a valid value

[ ] Optional, if stacked then optional alternatives

{ } Stacked above an alternative, but not optional

| Separates alternatives

… Optional repetition of a term

,… Repetitions must be separated by comma

18 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
02

Simple Data Definitions

19 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Define Data Types


▪ Initialization of Data
▪ WRITE and MOVE
▪ EDIT MASK
▪ DATE, TIME and System Variables
▪ Arithmetic Statements

20 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Define Data Types

21 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Field Definition and DEFINE Statement

DEFINE DATA DEFINE DATA


[GLOBAL USING global-data-area]
Variable
[PARAMETER
Array USING parameter-data-area
parameter-data-definition ]
Group
[LOCAL

View USING local-data-area


local-data-definition ]
END-DEFINE END-DEFINE

22 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Local Data Definition

Level number 01 -99

Naming conventions

Lower and upper case characters (A-Z)

Digits (0-9) special characters - _ / @ $ & # +

Elementary field

Format, length

Group

Array, Redefinition, Views

23 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Simple Data Definitions

Data Type Description Definable Length


A Alphanumeric 1-1073741824 (1GB) or dynamic
B Binary 1-1073741824 (1GB) or dynamic
D Date - (internal 4)
F Floating Point 4 or 8
I Integer 1,2 or 4
L Boolean True or false
N Numeric (unpacked) 1-29 digits
P Packed Numeric 1-29 digits
T Time - (internal 7)
U Unicode (UFT-16) 1-536870912 (0.5 GB) or dynamic

24 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
DEFINE DATA

25 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Initialization of Variables

26 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Implicit Default Value

Unless initialized explicitly, each variable has an implicit, format-specific default value

Type Value
A or U <blank>
N 0.0
I 0
F/P 0.0
Use RESET D 0000-01-01
statement to reset
T [Link]
to implicit value
L <false>

27 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Variable definition with CONST and INIT

Variable-name (format-length) INIT INIT definition

CONST

28 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example for Explicit Initial Value Assignment with INIT

Use
RESET INITIAL
to reset

29 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
INPUT, WRITE and MOVE

30 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
INPUT and WRITE Statement

INPUT operand1

WRITE [(statement-parameters)] operand1

31 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
INPUT and WRITE Statement

32 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
MOVE Statement

MOVE operand1 TO operand2 MOVE ROUNDED

Operand2 can be multiple MOVE LEFT/RIGHT


Variants, i.e.
targets JUSTIFIED

ASSIGN (for numeric and


MOVE ALL
alphanumeric operands)

COMPUTE (for numeric


Alternatives
operands)

Assignment by :=

33 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
MOVE Statement

34 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
WRITE and INPUT

35 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Edit Masks

36 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Edit Masks – Example for Numeric Variables

Statements like
- INPUT
- WRITE
- MOVE EDITED

37 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Supported Formats and Some Mask Definitions

Alphanumeric Binary
Numeric Time and Date
and unicode (Hexadecimal)

9 - position X – character
to be to be
displayed displayed

Z – zero Fillers, blank


suppression (^)

Period –
decimal
separator

38 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Date, Time and System
Variables

39 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Format D – Date and T- Time

40 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
System Variables

Value is provided
by Natural

System variables
are predefined Start with ´*´
variables

Can be used at
Example: *DATX
any time

41 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
System Variables – Extract from Documentation

42 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
System Variables

43 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Arithmetic Statements

44 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
ADD Statement to Add One or More Operands

ADD [ ROUNDED ] operand1… TO operand2

operand2 := operand1 +operand1 + ..

ADD [ROUNDED] operand1… GIVING operand2

operand2 := operand1 + ..

45 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
ADD example

46 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
SUBTRACT Statement to Subtract Two or More Operands

SUBTRACT [ ROUNDED ] operand1… FROM operand2

operand2 := operand2 – operand1


SUBTRACT [ROUNDED] operand1… FROM operand2 GIVING operand3

operand3 := operand2 – operand1 GIVING must be used if


operand2 is a constant

47 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example SUBTRACT

48 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
MULTIPLY Statement

MULTIPLY [ ROUNDED ] operand1… BY operand2

operand1 := operand1 * operand2

MULTIPLY [ROUNDED] operand1… BY operand2 GIVING operand3

operand3 := operand1 * operand2

49 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example MULTIPLY

50 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DIVIDE Statement

DIVIDE [ ROUNDED ] operand1… INTO operand2

operand2 := operand2 / operand1

DIVIDE [ROUNDED] operand1… INTO

operand2 GIVING operand3

operand3 := operand2 / operand1

51 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example DIVIDE

52 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
COMPUTE Statement for Arithmetic Operation

COMPUTE [ ROUNDED ] operand1 [:]= operand2

COMPUTE [ROUNDED] operand1 [:]= arithmetic expression

Alternative is ´:=´ only

53 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example COMPUTE

54 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
Exercise Environment

55 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Preparation and First Natural Program

56 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
First Natural Program with variables

57 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
03

Conditional Processing

58 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ IF … THEN … ELSE Statement

▪ DECIDE Statement

59 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
IF … THEN … ELSE
Statement

60 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
How does it work ?

false
IF

true
ELSE code
THEN code

After IF

61 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
IF Statement
Control processing based on a logical condition
IF logical-condition Control the number of times the loop is
processed based on a condition

• UNTIL
THEN clause
THEN statement …
until
logical a logicaliscondition
condition true becomes true

WHILE
• must include at least 1 statement
[ ELSE statement …] •as long as the logical
i.e., IGNORE condition is true
statement

ELSE clause
END-IF • Position of UNTIL or WHILE
logical condition is false
• at the beginning
optional
• at the end
IF statements can be nested

62 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example IF… THEN … ELSE

63 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Comparison Operators

EQ , EQUAL, EQUAL TO, ´=´


NE, NOT =, NOT EQUAL, ´<>´

LT, LESS THAN, ´<´


GT, GREATER THAN, ´>´
LE, LESS EQUAL, ´<=
GE, GREATER EQUAL, ´>=´
NOT LT, NOT < NOT GT, NOT >

THRU
THRU … BUT NOT … THRU ..

64 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example Comparison operators

65 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Relational Expressions

Logical operators
Bracketing ´(´
NOT
AND
OR
Simplified syntax
A = B OR = C
A = B OR = D THRU E
SCAN and MASK
Arithmetic expressions
IF var1 + 3 GT var2 - 5

66 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Relational Expressions

67 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Checking and Conversion of Data
Logical condition criteria

MASK upon

• checking if a field (or selected positions of a field)


has a specific format and/or content

IS option

• checking if a field with format A or U can be


converted to format N, F, D,T, P or I
Mathematical system function VAL

• Extract numeric value from an alphanumeric field

Notes
If the input value for the VAL function cannot be extracted to
a number a runtime error will occur.

68 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DECIDE statement

69 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
How does it work ?

Decide

Value1 Check value1

Value2 Check value2 if value1 doesn’t match

Value3 Check value3 if value2 doesn’t match

None Go to none if no match found

70 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DECIDE ON Statement
Conditional processing based on the content of a variable
DECIDE ON FIRST | EVERY [VALUE] [OF] operand1
EVERY check all VALUE clauses

VALUE operand2 statement ….. FIRST stop after the first true VALUE clause

VALUE clause
[ ANY statement …]
• check operand1 EQ operand2
[ ALL statement …]
multiple values

NONE statement … • Separated by comma

range of values (GE, LE)


Multiple values:
END-DECIDE • Separated by colon
- Separated by ‘,’
• i.e., VALUE 'A' : 'Z'
- Range separated by ‘:’

71 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example DECIDE ON

72 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DECIDE FOR Statement
Conditional processing based on a logical condition
DECIDE FOR FIRST | EVERY [CONDITION]

WHEN logical-condition statement ….. • WHEN clause

Check if condition is true


[ ANY statement … ]
• WHEN ANY (optional)
[ ALL statement … ]
at least one clause was true
NONE statement …
• WHEN ALL (optional)

END-DECIDE all clauses were true

not valid in combination with FIRST

• WHEN NONE (mandatory)

none of the clauses were true

73 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example DECIDE FOR

74 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
DECIDE Statement

75 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Loops and Conditions – DECIDE
Statement

76 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Loops and Conditions – DECIDE
Statement Alternative

77 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
04

Loop Processing

78 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Loop Processing Statements


▪ FOR Statement
▪ REPEAT UNTIL/WHILE Statement

▪ Statement Reference
▪ Label Definition
▪ ESCAPE Statement

79 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Loop Processing – FOR
Statement

80 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
How does it work?

Loop until condition is false

No Yes
Exit loop Decide Perform task

81 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
FOR Statement

FOR operand1 [:]= | EQ | FROM operand2 The number of times the loop is processed is based on the
Control the number of times the loop is
value of operand1
processed based on a condition
TO | THRU operand3 [ STEP operand4 operand2, operand3 or operand4 can be any
• UNTIL
arithmetic expression
]
Processinguntil a logical condition becomes
steps
statement … true
Initialize operand1 := operand2
• WHILE
END-FOR Check IF operand1 GT (LT*) operand3
as long as the logical condition is
IF truetrue
terminate the loop
‘Check operand1 GT operand3’ Execute the statements
IF operand4 is negative: check LT IF not true operand1 := operand1 +
• Position of UNTIL or WHILE
operand4
• at the beginning
Restart loop with check
• at the end
* IF operand4 (STEP value) is negative the
check is LT

82 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example FOR

83 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
FOR Statement

84 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Loops and Conditions – FOR Statement

85 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
[Link]

REPEAT UNTIL/WHILE
LOOP

86 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
REPEAT Statement
REPEAT [UNTIL | WHILE logical -condition] Control the number of times the loop is processed based on a
condition
UNTIL a logical condition gets
statement … true UNTIL

WHILE a logical condition is true,


END-REPEAT till a logical condition becomes true
stop when logical
condition is false
WHILE
Position of UNTIL or WHILE
• at the beginning as long as the logical condition is true
or
• at the end
Position of UNTIL or WHILE
at the beginning
at the end

87 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example REPEAT

88 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
[Link]

Statement Reference

89 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Statement Reference / Label

Any statement which causes a


processing loop to be initiated
may be marked with a symbolic label
Naming conventions are
identical to variable naming
• Defined in the form “label.” before
the statement
• Referenced with “(label.)”.

90 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example of label Definition

91 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
[Link]

ESCAPE Statement

92 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
ESCAPE Statement

ESCAPE TOP Interrupt the linear flow of statement execution in a


processing loop

ESCAPE BOTTOM [(label.)] ESCAPE


TOP continue at the top of the
• Interrupt the linear flow processing loop

• Select where to continue BOTTOM continue with the first


statement following the processing loop
as long as the logical condition is true
ESCAPE BOTTOM with label reference

used to selectively interrupt one of the


(nested) active processing loops

93 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
ESCAPE Statement Example

94 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
REPEAT Statement With ESCAPE

95 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Loops and Conditions – REPEAT
Statement

96 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
05

INPUT-OUTPUT-Maps

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Non-Graphical User Interface: INPUT Statement with Field Attributes


▪ REINPUT and SET CONTROL statement
▪ Dynamic Field Attributes
▪ WRITE and PRINT statement
▪ Natural Maps Overview
▪ INPUT USING MAP Statement
▪ Formatted Screen Output

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Non-Graphical User
Interface

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
A Typical Screen Output
Message
Line

I0001 Please enter valid Data for Personnel ID 950001

Output Field
Customer ID: 950001

Lastname: Hunt

Pagesize
Firstname: James
Birthday: 1991-06-30

Static Text Input Field

Linesize

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
INPUT Statement

INPUT [WINDOW='window-name‘]
[ NO ERASE ] Support of window concept
[ (statement-parameters) ]
[ WITH-TEXT-option ] [ MARK-option ] Parameters /attributes

nX ‘text’ [ (attributes) ] Behaviour and appearance


nT
x/y [ ‘-’ ] operand1 [ (parameter) ] Statement and/or field level
/ [ ‘=’ ]
Message line output / position cursor

Formatting

Line feed, tabs, positions

Usage of Edit masks

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example INPUT

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Parameters - Field Attribute Definitions

(AD=xyz)
Others, i.e.
Presentation (CD=xyz)

B - blinking (AL=n)
C - italic (IP=)
D - default intensity
I - intensified
N - non-display
U - underlined
V - reverse video
Y - dynamic

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Parameters - Field Attribute Definitions (AD=xyz)

Input/Output
A – input (or *IN)
O – output (or *OUT)
M – input/output (or *OUTIN)
P – temporarily write-protected

Other examples
T – translate lower case to upper case
W – accept lower case (default, related to LC)
E – value mandatory
F – value optional

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example Attribute Definition

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
Input Statement with Field Attribute

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
REINPUT and
SET CONTROL Statement

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
SET CONTROL Statement

SET CONTROL operand1

Operand1 (terminal command without ´%´)


▪ ´L´ – switch to lower case
▪ SET CONTROL ‘L’
▪ ´MT´ – message line, i.e. on Top
▪ SET CONTROL ‘MT’
▪ ´HDEST´ – activates hardcopy output to destination DEST
▪ SET CONTROL 'HDEST'

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example SET CONTROL – Message on Top

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example SET CONTROL – Message on Bottom

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FORMAT Statement

FORMAT parameter

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
REINPUT Statement

REINPUT [ FULL ]
Re-position to previous INPUT
[ [WITH] [TEXT] operand1 ]
Re-execute previous INPUT
[ MARK-option ]
No Write or Display allowed
between INPUT and REINPUT

FULL – updated fields -> output

Message line output / position cursor

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example REINPUT

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
REINPUT

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Dynamic Field Attributes

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
CONTROL Variables for Dynamic Field Attributes

Definition

Assignment

Usage

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Dynamically Modifiable Attributes

Presentation
B - blinking
C - italic
D - default intensity
I - intensified
N - non-display
U - underlined
V - reverse video
Input/Output
P – temporarily write-protected
© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Checking Changes with MODIFIED Option

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
Dynamic Field Attributes

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
WRITE and PRINT Statement

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
WRITE Statement

For screen and


WRITE [ NOTITLE ]
print output
[ (statement-parameters) ]

operand1 (parameter) ….

Editmask
(EM=xyz)

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example WRITE

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
PRINT Statement

PRINT [ NOHDR ]

[ (statement-parameters)

operand1 (parameter)

Difference to WRITE:
▪ Output length is value content
▪ Continued on next line

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
PRINT Statement

PRINT [ NOHDR ]

[ (statement-parameters)

operand1 (parameter)

Difference to WRITE:
▪ Output length is value content
▪ Continued on next line

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example PRINT

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Natural Maps Overview

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
The MAP object

DEFINE DATA …
*
INPUT USING MAP 'ABCMAP'

DECIDE ON …
PERFORM ….
CALLNAT …
END

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example of a MAP

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Processing Rules For a MAP

A processing rule
Defined in a map
Executed before the processing is passed back to the calling object
Related to Processing order is
determined by
Map
▪ rank and
Field ▪ position of the field
▪ In a rule ‘&’ represents the actual field for which the rule is defined
Function key
Multiple rules are possible
© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Help Routines For a MAP

Help routines are similar to subprogram


Referenced at
Map level
Field level
Activated by:
Entering a question mark (?) into a map field.
Placing the cursor in a map field and pressing a function key allocated to the
HELP function
REINPUT USING HELP statement
© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Summary Index Access

The Index key is called Descriptor (DE)

The index list is called inverted list

In the inverted list is stored: the value, the number of values and a list of ISNs

The records are stored in blocks which are called RABN

The Address Converter (AC) is a table which maps the ISN to a RABN

Records can have variable length

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
INPUT USING MAP
Statement

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
INPUT USING MAP Statement

INPUT [WINDOW='window-name'] Call a Map


[WITH-TEXT-option]
Without parameter list
[MARK-option]
All parameters are defined
identically in the calling object
[USING] MAP map-name
With parameter list
[NO ERASE]
All parameters are not defined
[operand1 … | NO PARAMETER] identically in the calling object

NO PARAMETER – map is not


available at compile

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example Map and INPUT USING MAP

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example MAP and INPUT USING MAP

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
SET KEY Statement

ALL
For all keys: ALL, ON, OFF
SET KEY ON
Individual keys
OFF
Operand2

program
ON
Customer specific
SET KEY PFn = OFF NAMED op4}
command
op2

HELP Operand4: display text

*PFKEY – name of function key

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
EXAMPLE Function Keys

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Formatted Screen Output

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
WRITE USING Statement

WRITE [NOTITLE] Screen and printer output


[NOHDR] Options correspond to WRITE

[USING] FORM map-name

NAME

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example WRITE USING FORM

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
AT TOP OF PAGE Statement

[AT] TOP [OF] PAGE

statement …

END-TOPPAGE

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example AT TOP OF PAGE

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
AT END OF PAGE Statement

[AT] END [OF] PAGE

statement …

END-ENDPAGE

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example AT END OF PAGE

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Screen I/O –
INPUT and REINPUT statement

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Screen I/O – INPUT and REINPUT
statement with Control Variable

© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
06

Work File Processing

147 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ DEFINE and CLOSE WORK FILE


▪ READ WORK FILE
▪ WRITE WORK FILE
▪ Demo - Read/Write in File

148 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DEFINE & CLOSE

149 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DEFINE WORK FILE STATEMENT
DEFINE WORK FILE
DEFINE WORK FILE n
Assign a file name to work file number
n– ident number
Open the file
1-32 If already open: implicitly close
and reopen
{operand1 | TYPE operand2 }
“n” - number of the work file (1-32)
filename ASCII, SAG, CSV
Operand1 - file name
[ATTRIBUTES {operand3}…]
TYPE: ASCII, SAG, CSV, others
150 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
[NO]APPEND ATTRIBUTES
DELETE/KEEP No APPEND
DELETE/KEEP

CLOSE WORK FILE


READ WORK FILE

152 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ WORK FILE STATEMENT
Read data sequentially from a
sequential work file with automatic loop
processing
READ WORK [FILE] work-file-number Work file number
[ONCE] Same number as in DEFINE WORK
Read only one record
NO END-WORK Operand1
Target field(s) or group
[ RECORD] operand1 Giving LENGTH
[GIVING LENGTH operand3] Length of record
Number of fields(TYPE CSV)
153 statement …
© 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.

END-WORK ONCE
Read only one record
No END-WORK allowed
Example READ WORK FILE

154 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
WRITE WORK FILE

155 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
WRITE WORK FILE STATEMENT

WRITE WORK [FILE] work-file-number Write records to a physical sequential


work file
[ VARIABLE] operand1
Work file number
Same number as in DEFINE WORK
CLOSE WORK [FILE] work-file-number
Operand1
Source field(s) or group
156 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.

VARIABLE
Enables writing of record
Having different structures
Example READ & WRITE WORK FILE

157 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
READ/WRITE

158 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
07

String Processing

159 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ SUBSTRING Function

▪ SEPARATE Statement

▪ COMPRESS Statement

▪ EXAMINE Statement

160 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
SUBSTRING() Function

161 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
SUBSTRING() option used in statements

Process only a defined section of a


SUBSTRING (operand1,operand2,operand3) variable
Operand definitions
Operand1- source value
Source value Start position Length
Operand2- start position
Available for Operand3- length

MOVE
MOVE, COMPRESS, COMPUTE
COMPRESS
Optional in a relational expression etc.
COMPUTE
Value format
In relation expression… Alphanumeric

Value format : alphanumeric, unicode and binary Unicode

Binary

162 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example SUBSTRING() Option

163 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
SUBSTRING() Function

164 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
SEPARATE Statement

165 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
SEPARATE Statement

SEPARATE operand1

INTO operand2…

IGNORE

REMAINDER operand3

WITH [RETAINED] [ANY] DELIMITERS

DELIMITERS operand4

[[GIVING] NUMBER [IN] operand5 ]

166 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example SEPARATE

167 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
SEPARATE statement

168 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
COMPRESS Statement

169 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
COMPRESS statement

COMPRESS [NUMERIC] [FULL] operand1 ...

INTO operand2

LEAVING [SPACE]

LEAVING NO [SPACE]

WITH [ALL] DELIMITERS operand4

170 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example COMPRESS

171 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
COMPRESS statement

172 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
EXAMINE Statement

173 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
EXAMINE Statement

EXAMINE

[FULL [VALUE [OF]]] operand1

[FOR] operand2

DELETE-REPLACE-clause

GIVING-clause

DELETE-REPLACE-clause GIVING-clause

174 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
EXAMINE TRANSLATE Statement

EXAMINE operand1

[AND] TRANSLATE

INTO UPPER [CASE]

LOWER

175 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
EXAMINE statement

176 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
String Processing

177 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
08

Modularization Part-I

178 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Why Modularization
▪ Local Data Area
▪ User Defined Function
▪ Natural System Functions
▪ Subprogram
▪ CALLNAT Parameter Transfer
▪ Parameter Data Area

179 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Why Modularization

180 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Why Modularization

Avoiding Code Service


Re-usability
Redundancies Structuring Orientation

181 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Local Data Area - LDA

182 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Object Type : Local Data Area

Reuse of local
data definitions

DEFINE DATA
Program
LOCAL

Referenceable in
Subprogram
various objects

Referenced with
Function etc.
USING Statement

183 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Local Data Area

DEFINE DATA LOCAL VIEWLDA


01YACHT VIEW OF NCYACHT
02 YACHT-ID (N8.0) DEFINE DATA LOCAL
02 YACHT-NAME (A30) 01 YACHT VIEW OF NCYACHT
02 YACHT-TYPE (A30) 02 YACHT-ID (N8.0)
02 YACHT-NAME (A30)
01 START-VALUE (A30) 02 YACHT-TYPE (A30)
01 END-VALUE (A30) END-DEFINE

END-DEFINE
….
READ YACHT-DATA BY YACHT- DEFINE DATA
TYPE LOCAL USING VIEWLDA
FROM START-VALUE TO END-
VALUE LOCAL
DISPLAY YACHT-NAME YACHT- 01 START-VALUE (A30)
TYPE 01 END-VALUE (A30)
END-READ END-DEFINE
/*
READ YACHT-DATA B

184 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
User Defined Function

185 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Function

DEFINE FUNCTION function-name


can be different to object name

[ return-data-definition ]

can return a value


[ function-data-definition ]

input parameters &


statement… local parameters
END-FUNCTION

186 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example- Calling & Callee Function

Caller

5000 5.00
Callee
NCFUNC07

5250

187 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
System Function

188 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Subprogram

189 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Subprogram Concept
webMethods
Java .NET
IS

EntireX Integration

Natural

DEFINE DATA PARAMETER


01 P-PERSONNEL-ID (A10)
01 P-PERSON
02 LASTNAME (A50)
02 FIRSTNAME (A50)
LOCAL Interface

END-DEFINE
*
Move ‘Smith’ to LASTNAME

END

190 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Natural Subprogram

Called using Service


High degree of
CALL Oriented Arch.
reusability
NAT various callers

COBOL Java/.NET REST API

191 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
CALLNAT Statement

CALLNAT operand1

Subprogram to be invoked

[USING]

operand2

nX

Input and output parameters

192 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Parameter Definition

DEFINE DATA Referenced only CALLNAT


Describes the
PARAMETER within the transfers values
interface of
Statement module as defined there

External
Functions Subprograms
subroutines

193 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example-CALLNAT and Subprogram

Calling
PROGRAM

Called
SUBPRO
GRAM

Termination via END


or ESCAPE ROUTINE

194 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
CALLNAT Parameter
Transfer

195 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
CALLNAT Parameter Transfer by “Reference”

Caller Subprogram
DEFINE DATA PARAMETER
DEFINE DATA LOCAL *
* 01 P-PERSON-ID (A10)
01 #PERSONNEL-ID (A10) *
* 01 P-PERSON
01 #PERSON 02 LASTNAME (A50)
02 LASTNAME (A50) 02 FIRSTNAME (A50)
02 FIRSTNAME (A50) 02 BIRTHDAY (D)
02 BDAY (D) 02 SEX (A10)
02 SEX (A10) *
* LOCAL
… *
by
END-DEFINE …
* reference END-DEFINE
… *
CALLNAT ‘GETPERSN‘ MOVE ‘Smith’ TO LASTNAME
USING #PERSONNEL-ID …
#PERSON

196 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
CALLNAT Parameter Transfer by “Value”

Caller Subprogram
DEFINE DATA LOCAL DEFINE DATA PARAMETER
* *
01 #OPERATOR (A1) 01 P-OPERATOR (A5) BY VALUE
01 #OPERAND1 (I2) 01 P-OPERAND1 (I4) BY VALUE
01 #OPERAND2 (I2) 01 P-OPERAND2 (I4) BY VALUE
01 #RESULT (I4) 01 P-RESULT (I4) BY VALUE RESULT
* *
END-DEFINE END-DEFINE
* *
… P-RESULT := P-OPERAND1 + P-OPERAND2
CALLNAT ‘CALC‘ …
USING #OPERATOR
#OPERAND1 by value
#OPERAND2
#RESULT

197 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
CALLNAT Parameter Optional

Caller Subprogram

DEFINE DATA LOCAL


DEFINE DATA PARAMETER
*
*
01 #PARAM1 (I4)
01 P-PARAM1 (I4)
01 #PARAM3 (I4)
01 P-PARAM2 (I4) OPTIONAL
01 #PARAM5 (I4)
01 P-PARAM3 (I4)
*
01 P-PARAM4 (I4) OPTIONAL
END-DEFINE
01 P-PARAM5 (I4) OPTIONAL

*
CALLNAT ‘OPTIONAL‘
END-DEFINE
USING #PARAM1
*
1X
optional IF P-PARAM2 SPECIFIED
#PARAM3

1X
*
#PARAM5
END

END

198 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Parameter Data Area
(PDA)

199 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Object Type : Parameter Data Area

Reusable
parameter data
definition

DEFINE DATA
Subprogram
PARAMETER

Referenceable in
Function etc
various objects

Referenced with
Program in LOCAL
USING Statement
area

200 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example- How to use PDA

PDA ‘NCCALL1A’

Reference PDA Reference PDA as


as LDA Parameter
NCCALL1N
NCMPROG

201 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
09

Modularization Part- II

202 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Inline Subroutine
▪ External Subroutine Object
▪ Copy Code Object
▪ Global Data Area
▪ Example- FETCH Program

203 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Inline Subroutine

204 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
INLINE SUBROUTINE

Defined via DEFINE SUBROUTINE

• Name <= 32 characters

Called via PERFORM statement

• Within the object where it is defined


• With its name

Access to all variables

• All variables within this object


• No parameters are passed

Exiting via

• END-SUBROUTINE (mandatory)
• ESCAPE ROUTINE

After exiting the execution continues after PERFORM

205 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Inline Subroutine

DEFINE DATA
LOCAL USING VIEWS
LOCAL
1 P-PERSONNEL-ID (N5)
1 P-LASTNAME (A10)
1 ERROR (N3)
1 ERROR-TEXT (A30)
END-DEFINE
*

PERFORM ACCESS-EMPLOYEE-DATA
IF ERROR = 0 THEN
P-LASTNAME := [Link]
ELSE
ERROR-TEXT := ‘No employee found’
END-IF
...
DEFINE SUBROUTINE ACCESS-EMPLOYEE-DATA
*
FNDEMPL.
FIND EMPLOYEE
WITH [Link]-ID = P-PERSONNEL-ID
*
IF NO RECORDS FOUND
ERROR := 999
ESCAPE ROUTINE
END-NOREC

END-FIND
END-SUBROUTINE
END

206 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
External Subroutine
Object

207 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
External Subroutine Concept
Call via
PERFORM
Parameter Global Data

DEFINE DATA
PARAMETER
*
01 P-PERSONNEL-ID (A10)
01 P-PERSON
02 LASTNAME (A50)
02 FIRSTNAME (A50)
*
LOCAL …..*
END-DEFINE
DEFINE SUBROUTINE READ-PERSON
*…
*
END-SUBROUTINE
END

208 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
External Subroutine

DEFINE [SUBROUTINE] subroutine-name

statement… Exit from subroutine via


- END-SUBROUTINE
END-SUBROUTINE
- ESCAPE ROUTINE
- ESCAPE MODULE

Called via PERFORM statement


With its name
Pass parameters

209 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example- PERFORM with an External Subroutine

210 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
CopyCode Object

211 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Copy Code Concept

DEFINE DATA LOCAL


1 NCYACHT VIEW OF NCYACHT
2 YACHT-ID (N8.0)
2 YACHT-NAME (A30)
2 YACHT-TYPE (A30)
END-DEFINE
NCCOPY1C
R1. READ NCYACHT BY YACHT-
NAME IF
[Link]-NAME =
INCLUDE NCCOPY1C 'Aurora'
ESCAPE BOTTOM (R1.)
END-READ END-IF
DISPLAY NCYACHT
/*
END

212 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
INCLUDE Statement

INCLUDE copycode-name

[operand1] … [operand99]

Parameters are resolved at


compilation time and replaced in
copy code

213 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example- INCLUDE COPYCODE

NCCOPY1C

214 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Global Data Area (GDA)

215 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Object Type : Global Data Area

• Uses same Data Definition and Storage Area


• DEFINE DATA GLOBAL
• Used by all objects referencing the GDA
• Referenced with USING Keyword

• First instance of a GDA


• Created and initialized at first execution
• In a subprogram a new instance is created

216 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example- How to use GDA GDA LDA
GLOBGDA VIEWLDA

YACHT-ID

YACHT-NAME …
217 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Summary Data Area Overview

Local Data Area (LDA) - DEFINE DATA LOCAL

Share Data Definition

Parameter Data Area (PDA) - DEFINE DATA PARAMETER

Description of the interface, share data definition and storage (by reference, by value)

Global Data Area (GDA) - DEFINE DATA GLOBAL


Share data definition and storage

If used always in front of LDA

218 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Call a Program with
FETCH

219 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Program Concept

Call via
FETCH
Natural Stack Global Data

DEFINE DATA GLOBAL USING PERSYS-G


LOCAL
01 P-PERSON
02 LASTNAME (A50)
02 FIRSTNAME (A50)
02 BIRTHDAY (D)
02 SEX (A10)
01 P-PERSONNEL-ID (A10)
END-DEFINE
/*
INPUT P-PERSONNEL-ID
/*…
/*
END

220 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FETCH Statement

FETCH [RETURN] operand1 [operand2]

221 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example- FETCH and Natural Stack Transfer
DEFINE DATA LOCAL /* program NCFETC1P
01 YACHT
02 YACHT-ID (A8)
02 YACHT-NAME (A10)
END-DEFINE
/*
MOVE '12348765' TO [Link]-ID
Write
/*
FETCH 'NCFETC2P' YACHT
/*
END
NCFETC2P
DEFINE DATA LOCAL
01 YACHT
Natural Stack 02 YACHT-ID (A8)
02 YACHT-NAME (A10)
END-DEFINE
/*
INPUT YACHT
DISPLAY YACHT
Read /*
END

222 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
STACK Statement

STACK [ TOP ] COMMAND operand1


DATA

223 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
RELEASE Statement

RELEASE STACK
Deletes all data/commands on the stack

*DATA
- # of data elements
- ´-1´ next element is command

224 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example- STACK Program

Write to
stack

NCSTACK2

Read from
stack

225 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
10

Complex Data Types and


Arrays

226 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

• Group and Operation Statements


• REDEFINE Data Definition
• Static Arrays
• Multi-Dimensional Arrays
• Operations on Array
• Dynamic Variables
• Dynamic Arrays

227 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Group and Operation
Statements

228 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Group – Combination of Data Elements

Yacht
Id
Name
Length
Width
Data Elements
- Variable
- Array
- Group

229 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example - Group Definition

Level Number
Group n / Element
n+1

Fully Qualified
Group Name Name

230 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Group operation – MOVE BY NAME

Transfers elements independent of their


MyYacht YourYacht position, but dependent on their name

Name Name Elements having the same name


must be transfer-compatible
Id Color
Both groups may have a different
Color Age number of elements

#Bunk #Bunk

Type

231 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example MOVE BY NAME

232 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Group operation – MOVE BY POSITION

MyYacht YourYacht
Name Y-Name
Id Ident
Color Colour
#Bunk Bunks

233 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example MOVE BY POSITION

234 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
Group Statements

235 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
REDEFINE Data Definition

236 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
REDEFINE Data Definition

The storage area occupied by

variables, groups or arrays can be

redefined to one or more variables, groups or


arrays

regardless of the format.

237 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example - REDEFINE

DATE

YEAR MONTH DAY

238 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example - REDEFINE

239 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Static Arrays

240 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Static Arrays

Array definition
▪ Up to 3 dimensions
▪ Initialization
Can be addressed by
▪ Single cell
▪ Index range

241 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Array Definition

var-name (format&length/array-definition)

array-definition:
index [:index ] [,index [:index] [,index [:index ] ]

if the index starts with 1


this can be omitted

242 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Addressing Arrays

243 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Array Definition- Initial values

var-name (format&length/array-definition) INIT [ALL] array-initial-value

All occurences in all dimensions


array-initial-value definition are initialized with specific value

*
index [:index ] , ..3 FULL LENGTH <character-string, …>
V LENGTH n

For two and three dimensional arrays:


* -> all occurences are initialized with same value
V -> all occurences are initialized with different
values

244 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Array Definition – Initial values

245 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
1D Array with INIT

246 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Multi-Dimensional Arrays

247 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Multi-Dimensional Array Definition

Elementary field level

Group field level

Combination elementary and group field level

248 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example – Elementary Field Level

249 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example – Group Field Level

250 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example-Combination Elementary and Group Field Level

251 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Operations on Array

252 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Addressing ARRAYs

MOVE Operand1 (index) TO Operand2 (index)

MOVE BY NAME
TO Operand2 (index)
Operand1 (index)

253 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example- Addressing ARRAYs

254 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Arithmetic Operations on ARRAYs

Operand1(index) := Operand2 (index) + Operand3(index)

Dimensions must
be of equal size

255 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Arithmetic Operations on ARRAYs and Scalars

Operand3 (index) := Operand2 (index) + Operand1

Example for entire dimension:

array1(1,1) := array2(1,1) + scalar

array1(1,2) := array2(1,2) + scalar

Example for entire dimension:

scalar1 := array(1,1) + array (1,2) + array(2,1) + array (2,2) + scalar2

256 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example Arithmetic Operations on ARRAYs and Scalars

257 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Dynamic Variables

258 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Dynamic Variables and X-Arrays

ABCD

100 180 140


150 200 160
180 300 190
090 120 150

259 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Dynamic Variables

DEFINE DATA LOCAL


level variable-name (A) DYNAMIC
level variable-name (B) DYNAMIC
END-DEFINE

260 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Dynamic Variables

261 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
String Processing with Dynamic Variables

262 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Performance Considerations

263 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Dynamic Arrays

264 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
X-Arrays

DEFINE DATA LOCAL


level var-name (format-length/1:*)
END-DEFINE

265 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
2D on Elementary Field Level

266 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Multi-Dimensional Arrays

267 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Multi-Dimensional Arrays and Arithmetic
Operations

268 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
11

Error Handling

269 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Error Processing

▪ Logging of Events

▪ Application Programming Interface (API)

270 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Error Processing

271 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Error Processing
DEFINE

ON ERROR… For the creation of robust applications, Natural
END-ERROR
offers the following error handling methods:
FETCH * ERROR-TA
RETURN
END Use of an ON-ERROR statement block

Definition and use of an error transaction



CALLNAT

END



END

272 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Overview Exception Handling

Two major groups of exceptions


Function 1. System or infrastructure errors
not
acceptable
Service wM ESB
resource not available
unavailable system software error
EntireX ‘server’ error
ideally handle by infrastructure

2. Application related

unknown data (contents/format)


Natural ?
? wrong / inconsistent data
´client´ error
sometimes only recognized by service
Adabas

273 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
ON ERROR Statement
Intercepts runtime time errors

ON ERROR Normal flow of program is interrupted when ON


ERROR block is entered for execution
statement(s)…
Non-Procedural
END-ERROR
Each Natural object may contain one

When an error occurs


Trace back the call hierarchy and select
the first ON ERROR block
If no ON ERROR block is found, an error
transaction (if defined) is called

Ends with END-ERROR

When handling error situations, the status of the


database transaction must be considered.

274 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Error Processing Statement and Error Program

ON ERROR statement
ON ERROR
statement block can be exited with
statement(s)…
RETRY
END-ERROR ESCAPE ROUTINE
FETCH
STOP
TERMINATE

Error Transaction Program (*ERROR-TA)

For a Service do NOT use


FETCH , STOP and TERMINATE
an Error Transaction Program does not get
control in RPC Server, instead use exit
NATRPC01 (sample can be found in library
SYSRPC)

275 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Error Transaction and Profile Parameter

The error transaction program is defined with:


▪ *ERROR-TA
Defined in program
▪ Parameter ETA
session profile
ETA=`NCERRTAP` As well as dynamic parameter

276 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example of Error Processing in Subprogram

The example illustrates the following:


▪ Definition of group field for error data
Error number
Name of the Natural object
Line number
Long text
▪ Reaction in ON ERROR block:
Handling of an open database transaction
Filling the field group
Return from the ON ERROR block to the calling
program to avoid runtime error
ESCAPE ROUTINE statement

277 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example of Caller‘s Reaction to an Error

The subprogram contained an ON-ERROR block


and the block was left through
ESCAPE ROUTINE
Processing will continue after
CALLNAT

Decision on the basis of the content of


the error data in the parameter
Was there an error ?
What to do next ?

278 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Sunny Islands – Handling Errors and Writing Log Files

As a service provider I want to have an in error cases detailed information.

Adabas

279 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
Sunny Islands – Implementation of Error Handling
ON ERROR statement
Extract from service subprogram Intercept execution time error without
termination of program execution
Natural error codes
Adabas response codes

CopyCode
Log file → see next slide
Application error handling program CAMSG-N
Handle exceptions with
user defined error codes
language specific text messages
CopyCode ERRLOG-I
Parameter data area NCCOMM-P
Pass error data back to frontend

280 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Logging of Events

281 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Sunny Islands – Handling Errors and Writing Log Files

As a service provider I want to have an overview of activities going on in my services and in error cases
detailed information.

Adabas

282 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
Instrumentation of Services
Instrumentation
Event logging for
exception handling to diagnose errors
security events
Application
Application for performance reasons
wM ESB and Service
Service
and
monitoring
monitoring used for debugging
EntireX

Logging can be done from


Service
can provide very specific and most
Natural Profiler detailed information
Natural ? Infrastructure
more generic information
Command, many different products and
Adabas transaction and possibilities
event logging
independent of service, but often
dependent of infrastructure

283 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Sunny Islands – Implementation of Log Files

Log file for the application


Subprogram CUGET-N C:\training\308-
xxE\resources\[Link]

Realized via CopyCode


some common used copycodes
statistical data (STALOG-I)
service specific copycodes
one for all GET/LIST services
(ENLLOG-I)
CopyCode STALOG-I
one for each service (i.e. GCULOG-I)

Timestamp conversion
Natural Application Programming
Interface program USR1009N is used

284 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Application Programming
Interface (API)

285 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Natural Application Programming Interfaces (API)

Application Programming Interface


Helpful services (subprograms) which are not
available with standard statements/variables
delivered with installation
In system library
SYSEXT or

SYSAPI for Natural add-on products


Entire Output Management
Entire Operations

In library SYSEXV you find many example


programs for all sorts of topics

286 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Natural Application Programming Interfaces (API)

Contents of SYSEXT (on the server)


▪ Subprograms / USRnnnnN
only object code
▪ Programs / USRnnnnP
sample programs ´How to call
API’

▪ Texts / USRnnnnT
description for each API

Using such an API you need to copy the object of


the subprogram into your library or add SYSEXT
as a STEPLIB.
Object code can only be copied on the server
view.

287 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Natural System API - Categories

System Products/Features
Error Profiler
System commands
System files
Database Error Messages Optimize for Infrastructure

Database Error Handling


Steplibs
Natural Objects DDMs
Resources
Runtime Parameters
Input/Output
Natural environment Session parameters
Components Window handling
Profile parameters
Result View Interface
Bufferpool Data
Server (NDV) Work file / printer
Date / time
RPC support
Data handling
RPC - Security
Code page support
RPC – Reliable RPC
Editor

288 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
List of APIs for Error Handling

API Purpose
USR0040N Get type of last error
USR1016N Get error level for error in nested copy codes
USR1037N Get information on Natural ABEND data
USR1041N Install error transaction program (*ERROR-TA).
USR2001N Get information on last error
USR2006N Get information from error message collector
USR2007N Get or set data for RPC default server
USR2010N Get error information on last database call
USR2026N Get TECH information
USR2030N Get dynamic error message parts from the last error

USR2034N Read any error message from FNAT or FUSER

USR3320N Find user short error message (including steplibs search)

USR4214N Get program level information

289 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
12

Adabas Access from a


Sample Application
What we will cover

▪ Database access using Natural DML

▪ Introducing “Sunny Islands” sample application


Database Access using
Natural DML
Natural Database Access

Natural DML

Cruises

READ, FIND,…

STORE, UPDATE, …

Natural Application Adabas Database File


Natural DDMs

Cruises
The ‘Sunny Islands’
Sample Application
Booking a cruise for the summer vacation

“Application ´Sunny Islands´ is for booking


a cruise. This will be enhanced by you.
How does it look like ? “

© Software AG Training
Home of „Sunny Islands“

The OK
and
CANCEL
button
Register as a (new) customer, change your data and logout
All Cruises – display all cruises and book one
Some technical insides

Natural for Ajax Application (responsive web pages)


Library CRUISE16: DDMs, subprograms, copycodes….

Library RDCRUISE: main program RDCRUISP

NJX Components: Adapters, User-Interface-Components

RDCRUISP: Process page statement

Variable naming conventions

NC* database fields from various views

P-* parameter variables RDCRUISEP <-> subprograms

PV* parameter variables to web pages


Hands-On Lab:
Explore the Application “Sunny Islands”
13

Adabas DDMs and


Views

302 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Adabas File Structure

▪ Adabas Indices

▪ Data Definition Module (DDM) and Views

303 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Adabas File Structure

304 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Database Table -> File

ISN Field

ISN NAME FIRST-NAME …

1 FLETCHER LILLY … Record


2 SMITH MARK …
3 CLIMENSON JENNY …
4 FLETCHER GILBERT …
5 SAMMET WILLY …

File

305 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
ISN – Internal Sequence Number

Unique within file

Assignment automatically

Update not possible

Usable by programmer

Performance reasons

306 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Fields and their definition

Filenumber

DBID Elementary Field

Group

307 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Flexible record layout

“ A customer has an ID, a name, an address and multiple different phone


numbers. “

SQL Database Adabas Database

ID Name Address ID Tel# (mobile) ID Name Address Tel# (mobile)


ID Tel# (private) Tel# (private)
ID Tel# (office) Tel# (office)

2 tables / 4 1 file / 1 record


records
308 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Periodic Groups (PE) and Multiple Values (MU)

“ An employee has vacation with a start and an end date. And the
employee speaks several languages”

LEAVE-
BOOKED

LEAVE
LEAVE LEAVE
LEAVE
ISN …… …
… LANG
LANG …

START
START END
END

1 20190101
20160101 20190131
2010131 GER
GER …

20190701
20160101 20190707
2010131 ENG
ENG

FRE
FRE

Periodic Multiple-value
Group Field

309 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Multiple Value field in Periodic Group

“ A cruise has several sailors and each of them speaks several languages”

310 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Adabas Indices

311 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Inverted list / descriptor in Adabas

Inverted List

NAME FIRST-NAME PERSONNEL-ID

COSMO ALEX 20023400


Descriptor
FLETCHER LILLY 20023401

MICHAELS TOM 20023402


EMPLOYEES-FILE
EMPLOYEES-FILE
PERSONNE FIRST-
ISN NAME
L-ID NAME

1 20023400 FLETCHER LILLY

3 20023402 COSMO TOM

2 20023401 MICHAELS ALEX

312 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Descriptor access via Address Converter

Inverted List Address


Converter
NAME
Records
FLETCHER 2 1, 4
SAMMET 1 5 EMPLOYEES-FILE
4312
SMITH 3 2, 6, 7
4313
4312 1 FLETCHER,LILLY,… 5 SAMMET, TED, …
0000
4314
4312 4313 SMITH, CHRISTINE, … 7 SMITH, JOHN,...
2
4314
List of
Number 4313 4314
ISNs 4 FLETCHER, CARL,… 6 SMITH, JANE, …
of values

ASSOCIATOR DATA

RABN

313 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Summary index access

The Index key is called Descriptor (DE)

The index list is called inverted list

In the inverted list is sorted: the value, the number of values


and a list of ISNs

The records are stored in blocks which are called RABN

The Address Converter (AC) is a table which maps the ISN to


a RABN

Records can have variable length

314 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Data Definition Module
(DDM) and Views

315 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
View, DDM and FDT

DDM
Natural

VIEW

Adabas
FDT

316 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Data Definition Module (DDM)

Definition of fields

Long names mapped to short names

Definition of descriptors

Independent of FDT

Field selection

Field sequence

Field length and type (compatible)

317 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DDM attributes
1/2
Type - Structure definition:
Empty Elementary field
G Group
P Periodic group
M Multiple-value field
* comment

Level - Level number for groups


Short Name - Two-digit Adabas short name, used internally for field identification
Name - Name of a field used in Natural as variable name
Format/ Length - Format and length of a field

318 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DDM attributes
2/2
Suppression - type of compression
Empty Standard compression
N Null value suppression
F Fixed length
M SQL null-value

Descriptor - Information on whether the field is a descriptor


Empty Field is not a descriptor
D Field is a descriptor
N Field is not a descriptor, but can be used
as a search field for a non-descriptor
search
S Sub- or superdescriptor
H Hyperdescriptor
P Phonetic descriptor

319 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Natural data view – DDM

A view can be used


to restrict access to
fields for an
application.

320 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
NaturalONE: Editor, Outline and Properties View

321 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
DDM access in NaturalONE

322 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
NaturalONE Data Browser

323 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
14

Adabas Sequential Access

324 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Design a Service in Natural


▪ READ Statement
▪ READ PHYSICAL
▪ READ BY ISN
▪ READ BY DESCRIPTOR
▪ Limit the number of records and direction
▪ WHERE Clause and further Selection Criteria
▪ List with Repositioning
▪ HISTOGRAM Statement

325 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Design a Service in
Natural

326 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Service application design

Devices

Front-
end

Back-
end

Service

327 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Service characteristics

Encapsulated and
stateless
Structured interface

Self-contained (acts as a black box)

Independent of

Location (distributed)

Infrastructure

Calling sequence

328 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Defining a service interface

Common structure

Expandable

Clear definition of Input/Output

Interface Common Part

Status, exception, user, …

Specific Part
Object, function specific data,
sub function, …

329 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Defining a service in Natural

Natural object type ‘subprogram’

Interface: Parameter Data Area (PDA)


By reference

Optional recommended only


at the end

Inside all object types are allowed

Following statements are NOT allowed

FETCH and STACK

STOP and TERMINATE

RUN

330 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Scenarios using Natural services

NJX / JSP Webservices SOAP REST

wM API Management

wM Integration

EntireX

Natural
CUI, NJX

„CALLNAT Interface“

Natural subprogram with parameters via PDA

331 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ Statement

332 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
List function

“The user wants to display all cruises with cruise-Id, start-date, start-harbor
and destination-harbor.“

CRUISE

CRUISE-ID Date Start-Harbor Destin ID-YACHT

2095 2016-11-24 Lefkas Hydra 69

2058 2016-09-29 Santorini Rhodos 105

2043 2016-09-29 Syros Chios 114

2012 2016-09-29 Samos Naxos 123

…….. …. ….. ….. …

333 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
Overview READ statement

Sequence
READ
Physical
[RECORDS] [IN] [FILE] view-name
ISN
[sequence/range-specification ]
Logical by descriptor
statement…
Range-specification
END-READ
Equal

Other comparison operators

Starting from … ending at / thru

334 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DISPLAY statement

DISPLAY [NOTITLE] [NOHDR] Formatted Output

{ [ output-format ] output-element } Column

Header

Customizable

335 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example READ

336 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
READ PHYSICAL

337 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ PHYSICAL

338 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ physical sequential - how Adabas processes it

EMPLOYEES-FILE

4312 1 FLETCHER 5 SAMMET

4313 2 SMITH 7 SMITH

4314 4 FLETCHER 6 SMITH

339 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ PHYSICAL

READ
Range Specification - only ISN
[RECORDS] [IN] [FILE] view-name
STARTING WITH ISN
[IN] [PHYSICAL] [SEQUENCE]

[STARTING WITH ISN= operand ] Valid ISN

statement… Next record

END-READ

340 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Interesting systemvariables

Systemvariable Description

*ISN Contains the ISN of the actual record

*COUNTER A counter which is increased for each loop processing step

341 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example READ PHYSICAL

342 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ BY ISN

343 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ in ISN sequence - how Adabas processes it

Address
Converter
4312 EMPLOYEES-FILE
4313 FLETCHER
4312 1 5 SAMMET

4314 4313 2 SMITH 7 SMITH


4312
4314 4 FLETCHER 6 SMITH
4314
4313

344 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ BY ISN

READ [RECORDS] [IN] [FILE] view-name

BY ISN = operand1 THRU operand2

WITH EQ ENDING AT

FROM
Range Specification - only ISN
statement…
Starting with ISN – greater equal
END-READ
Ending ISN – less equal

345 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example READ BY ISN

346 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ BY DESCRIPTOR

347 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ in logical sequence - how Adabas processes it

Address
Converter

4312 EMPLOYEES-FILE

Inverted List
4313 FLETCHER
4312 1 5 SAMMET

4314 4313 2 SMITH 7 SMITH


NAME
4312
FLETCHER 2 1, 4 4314 4 FLETCHER 6 SMITH
4314
SAMMET 1 5
4313
SMITH 3 2, 6, 7

348 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ BY DESCRIPTOR

READ [RECORDS] [IN] [FILE] view-name


BY descriptor = op1 THRU op2
WITH [STARTING] FROM ENDING AT
TO
<
>=
….
statement…
END-READ

349 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example READ BY descriptor

‘=‘

350 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example READ BY descriptor with start value

351 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ with defined end value

READ … THRU / ENDING AT READ … TO


End-value is checked in Natural End-value is sent to Adabas

The descriptor field used for the range must be defined in the The descriptor field used for the range is not required in the Natural
Natural data view data view
At termination of the loop the view contains the first record ‚out of At termination of the loop the view contains the last record of the
range‘ specified range
The end-value can be changed during processing loop The end-value is sent to Adabas once at the start of the READ-loop.
Modifications of the end-value during loop-processing have no
effect
DESCENDING: the start-value has to be higher than the end-value to ASCENDING and DESCENDING: the end-value is always the higher
get into the loop-processing value to get into the loop-processing
If an incorrect range is defined, the READ-loop will not be processed An incorrect range results in an error, because the value-range must
and no record will be returned be defined in ascending order
MU-field or sub-/super-/hyper-descriptor are not allowed and will MU-field and sub-/super-/hyper-descriptor can be used
lead to syntax error NAT0160 at compilation time

352 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Limit Number of Records
and Direction

353 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Limit number of records for loop processing

READ ALL
Constant or numeric variable
(operand1)
Evaluated at beginning of loop
[RECORDS] [IN] [FILE] view-name
[sequence/range-specification ]
statement…
END-READ

354 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ direction - how Adabas processes it

Address
Converter

4312 EMPLOYEES-FILE

Inverted List
4313 FLETCHER
4312 1 5 SAMMET

4314 4313 2 SMITH 7 SMITH


NAME
4312
FLETCHER 2 1, 4 4314 4 FLETCHER 6 SMITH
4314
SAMMET 1 5
4313
SMITH 3 2, 6, 7

355 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ direction

READ [RECORDS] [IN] [FILE] view-name


ASCENDING -
default
ASCENDING BY descriptor …
VARIABLE
DESCENDING WITH when loop is
entered
VARIABLE operand5
DYNAMIC –
DYNAMIC operand5 within the loop

statement…
END-READ

356 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example READ direction

357 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
READ DESCENDING

358 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
WHERE Clause and
further Selection Criteria

359 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
WHERE clause

READ view-name [sequence/range-specification]

[WHERE logical-condition ]
All Logical operators possible
statement…
Complex logical condition
END-READ
Not necessarily descriptors

360 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
ACCEPT / REJECT statement

READ view-name [sequence/range-specification]

ACCEPT [ IF ] logical-condition Preceding statements


possible
REJECT
Combination of multiple
statement… statements possible
END-READ

361 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
AT START OF DATA statement

READ view-name

[sequence/range-specification/selection criteria ] After the first record has been


read and before that record is
[AT ] START [ OF ] DATA processed

statement …
Used only once

END-START
statement …
END-READ

362 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
AT END OF DATA statement

READ view-name

[sequence/range-specification/selection criteria ] After the last record has been


read and after that record is
[AT ] END [ OF ] DATA processed

statement …
Used only once
END-ENDDATA
statement …
END-READ

363 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example START & END OF DATA

364 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
List with Repositioning

365 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
List - more records than client can handle at once
CRUISE

CRUISE-ID Date Start-Harbor Destin

2095 2016-11-24 Lefkas Hydra

2058 2016-09-29 Santorini Rhodos

2043 2016-09-29 Syros Chios

First call 2012 2016-09-29 Samos Lefkas

2089 2016-09-22 Lefkas Hydra

2060 2016-09-29 Santorini Hydra

2040 2016-08-24 Naxos Chios

2032 2016-08-24 Samos Naxos

2096 2016-11-24 Lefkas Hydra

2059 2016-09-29 Santorini Rhodos

2044 2016-09-29 Syros Chios

Second 2097 2016-11-24 Lefkas Hydra

call
2158 2016-09-29 Santorini Rhodos

2143 2016-09-29 Syros Chios

3095 2016-11-24 Lefkas Hydra

3158 2016-09-29 Santorini Rhodos

2424 2016-09-29 Syros Chios

366 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
List with repositioning READ – variant I

Inverted List
1st call
START-DATE
READ (10) CRUISE BY START-
DATE 20160824 5 3, 19,20,27,247
STARTING FROM 20160824 20160825 3 7, 9,45
20160831 19 1, 4, 7,24,25,…
2nd call 20160901 9 5,12,49,…

READ (10) CRUISE BY START- 20160907 41 2, 6, and so on….


DATE
STARTING FROM 20160831
STARTING WITH ISN = 4 ISN is not necessary
when unique descriptor

367 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
List with repositioning READ – variant II

Inverted List
1st call
START-DATE-UNIQUE-CRUISE-ID
READ (3) CRUISE BY START-DATE
STARTING FROM
201608245101 1 3
201608240000
201608245107 1 19
201608245108 1 20
2nd call
201608245112 1 27
READ (3) CRUISE BY START-DATE 201608245300 1 247
STARTING FROM 201608315109
Adabas Systemfield
TIME with CR option
can be used

368 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Provide the list of available cruises

369 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
HISTOGRAM Statement

370 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
HISTOGRAM function

“The user wants to have a list of harbors where the cruises start,
and how many cruises start in Lefkas.”

CRUISE CRUISE

CRUISE-ID Date Start-Harbor Destin ID-YACHT


CRUISE-ID Date Start-Harbor Destin ID-YACHT

2095 2016-11-24 Lefkas Hydra 69


2095 2016-11-24 Lefkas Hydra 69

2058 2016-09-29 Santorini Rhodos 105


2058 2016-09-29 Santorini Rhodos 105

2043 2016-09-29 Lekas Chios 114


2043 2016-09-29 Lekas Chios 114

2012 2016-09-29 Kos Naxos 123


2012 2016-09-29 Kos Naxos 123

…….. …. ….. ….. …


…….. …. ….. ….. …

371 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
HISTOGRAM - how Adabas processes it

Inverted List
Start-Harbor
Lefkas 2 1, 4
Samos 1 5
Santorini 3 2, 6, 7

372 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
HISTOGRAM statement

HISTOGRAM [IN] [FILE] view-name


In the view only the
[VALUE] [FOR] [FIELD] operand1 descriptor field is
allowed
WITH operand5 THRU ENDING AT operand6
FROM TO Additional criteria
<
ASCENDING/
>= DESCENDING
….
statement…
END-HISTOGRAM

373 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Systemvariables & additional criteria

Systemvariable Description

*ISN Contains the ISN of the actual record

*COUNTER A counter which is increased for each loop processing step

*NUMBER For a HISTOGRAM statement the number of records for the actual selected
descriptor value

374 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Additional Criteria

Limit number of records for loop processing

ASCENDING / DESCENDING

WHERE clause (only descriptor)

Statements which are supported

ACCEPT / REJECT

AT START OF DATA

AT END OF DATA

375 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example HISTOGRAM

376 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
HISTOGRAM statement

377 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
15

Adabas FIND Access

378 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ FIND Statement
▪ Complex FIND and more Options
▪ FIND NUMBER and GET Statement
▪ Access in Portions with Repositioning
▪ Access Several Files
▪ When to use READ and when to use FIND

379 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND Statement

380 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Selective function

“The user identifies himself via his CustomerID and wants to see it´s name, birthday, and
other data´.

CUSTOMER

PERSON-ID BIRTH-DATE SURNAME FIRST-NAME-1


605 1975-03-19 Weise Heike …
590 1978-11-04 Bares Salia …
530 1976-07-29 Dietrich Claudia …
322 1980-09-28 Falter Heide …
792 1975-12-29 Blaettel Marianne …
2060 1977-06-15 Brosch Nadia …
… … … … …

381 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND statement

FIND
[RECORDS] [IN] [FILE] view-name

[WITH] basic-search-criterion

statements….

END-FIND

382 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example Simple FIND – one selected record

383 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example Simple FIND – list of selected records

384 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Interesting systemvariables

Systemvariable Description

*ISN Contains the ISN of the actual record

*COUNTER A counter which is increased for each loop processing step

*NUMBER For a HISTOGRAM statement the number of records for the actual selected
descriptor value

*NUMBER For a FIND statement the number of records which were selected

385 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
IF NO RECORDS FOUND clause

FIND [RECORDS] [IN] [FILE] view-name Loop will be executed once


[WITH] basic-search-criterion Statements:, afterwards loop will
be entered (-> ESCAPE
IF NO [RECORDS] [FOUND] BOTTOM prevent this)

ENTER ENTER – enter loop

statements…

END-NOREC
statements….
END-FIND

386 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example FIND – no record

Change
Changeitit
to
to333
333

387 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
FIND IF NO RECORDS FOUND clause

388 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Complex FIND and more
options

389 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Selective function – many selection values

“The HR manager wants to see which employees work in the sales department
of Region 20 and are born before 1970.“

EMPLOYEE

BIRTH NAME DEPARTMENT


1967-01-30 Adam VENT59 …
1970-05-05 Samuelson SALE20 …
1964-08-28 Bart VENT07 …
1969-05-05 Welke SALE20 …
1957-12-11 Forest TECH08 …
1965-07-04 Premo SALE20 …
… … … …

390 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND - how Adabas processes it

BIRTH
19690505 1 2
Inverted Lists 19960224 1 4 Address DATA Storage
19650704 1 6 Converter
DEPTARTMENT 19991222 1 7
MGMT10 1 1 19950422 1 1 4312
MGMT40 2 3, 8 19771113 1 3
4314
SALE20 3 2, 6, 7 19690905 1 8
4313 4312 1 FLETCHER 5 SAMMET
TECH10 1 4, 5 19740219 1 5
4315 4313 3 SMITH 7 EVANS

4312 4314 2 WELKE 8 SMITH


2 2 4315 4 FLETCHER 6 PREMO
6 6 4315
7 8 4313
4314
2
Resulting ISN List 6

391 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Complex search criteria

Any number of descriptors

Many Operators

Equal, not equal

Greater, greater equal

Less, less equal

OR / AND / NOT

THRU…BUT NOT THRU

392 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example complex FIND

393 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND STARTING WITH ISN

FIND [(operand1)] [RECORDS] [IN] [FILE] view-name

[WITH] basic-search-criterion

[STARTING WITH ISN= operand2]

statements….

END-FIND

394 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND SORTED BY

FIND [(operand1)] [RECORDS] [IN] [FILE] view-name


Up to 3 descriptors
[WITH] basic-search-criterion

[SORTED [BY] descriptor … 3 [DESCENDING] NO descriptor from within PE group

statements….
Significant performance overhead
sorting many values
END-FIND -> use SORT statement

395 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example FIND SORTED

396 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Additional Criteria

Limit number of records for loop processing

WHERE clause

Statements which are supported

ACCEPT / REJECT

AT START OF DATA

AT END OF DATA

397 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
NON-DESCRIPTOR search

398 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND - how Adabas processes it

Address
Converter
BIRTH
19690505 1 2 4312
Inverted Lists 19960224 1 4 4314
19650704 1 6 4313 1 FLETCHER 5 SAMMET
DEPTARTMENT 19991222 1 7
4315 3 SMITH 7 EVANS
MGMT10 1 1 19950422 1 1
4312 2 WELKE 8 SMITH
MGMT40 2 3, 8 19771113 1 3
4 FLETCHER 6 PREMO
SALE20 3 2, 6, 7 4315
19690905 1 8
TECH10 1 4, 5 4313
19740219 1 5
4314

2
6
7
2
Resulting ISN List 6

399 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DDM definition for NON-DE FIND

Descriptor - Information on whether the field is a descriptor

Empty Field is not a descriptor


D Field is a descriptor

N Field is not a descriptor, but can be used


as a search field for a non-descriptor
search

S Sub- or superdescriptor
H Hyperdescriptor

P Phonetic descriptor

400 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example NON-DE search

In case this is not marked as NON-DE in Natural DDM

401 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
Complex FIND

402 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND NUMBER and
GET Statement

403 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND NUMBER statement without loop processing

FIND NUMBER
First phase

[RECORDS] [IN] [FILE] view-name NO

acess to record
[WITH] [LIMIT (operand1) ] basic-search-criterion
END-FIND

IF NO RECORDS FOUND

404 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example FIND NUMBER

405 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
GET statement

GET [IN] [FILE] view-name

USAGE

[RECORD] operand3 Get more data

*ISN
Part of transaction

406 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example GET

407 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Get the correct price of a cruise

408 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Access in Portions with
Repositioning

409 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
List - more records than client can handle at once
CRUISE

CRUISE-ID Date Start-Harbor Destin

2095 2016-11-24 Lefkas Hydra

2058 2016-09-29 Santorini Rhodos

2043 2016-09-29 Syros Chios

First call 2012 2016-09-29 Samos Lefkas

2089 2016-09-22 Lefkas Hydra

2060 2016-09-29 Santorini Hydra

2040 2016-08-24 Naxos Chios

2032 2016-08-24 Samos Naxos

2096 2016-11-24 Lefkas Hydra

2059 2016-09-29 Santorini Rhodos

2044 2016-09-29 Syros Chios

Second 2097 2016-11-24 Lefkas Hydra

call
2158 2016-09-29 Santorini Rhodos

2143 2016-09-29 Syros Chios

3095 2016-11-24 Lefkas Hydra

3158 2016-09-29 Santorini Rhodos

2424 2016-09-29 Syros Chios

410 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
List with repositioning FIND – variant I

1st LIST
CRUISE-ID Date
FIND (4) CRUISE WITH START- 23, 6, 45, 2012 20160824
9,12,17,21,3,
DATE > 20160824 and CRUISE-ID 23,5,.. 2043 20160929
GT 0 SORTED BY CRUISE-ID 2054 20161012
2059 20160929

2060 20160829
2nd LIST
2071 20161001
2088 20160829
FIND (4) CRUISE WITH START- 12,17,21,3,
2099 20160913
DATE > 20160824 and CRUISE-ID 23,5,..
GE 2059 SORTED BY CRUISE-ID..
STARTING WITH ISN = 9

411 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
List with repositioning FIND – variant II

1st LIST FINDLIST

CRUISE-ID Date
FIND CRUISE WITH START-DATE > 23, 6, 45, 2012 20160824
9,12,17,21,3,
20160824 RETAIN AS FINDLIST 23,5,.. 2043 20160929
2054 20161012
2059 20160929
FINDLIST 2060 20160829
2nd LIST
2071 20161001
23, 6, 45,
2088 20160829
FIND CRUISE WITH FINDLIST 9,12,17,21,3,
23,5,.. 2099 20160913
STARTING WITH ISN = 9

412 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Access Several Files

413 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Selective function – selection values in different files

“The booking agent wants to see for a specific contract the name of the yacht
and the name of the customer who has booked.“
CRUISE

CRUISE-ID Date Start-Harbor ID-YACHT


2095 2016-11-24 Lefkas 69
1319 2016-09-29 Santorini 105
2043 2016-09-29 Syros 114

CONTRACT
YACHT
Contract-ID Price Date-Reservation ID-Customer ID-Cruise YACHT-ID Yacht-Name Yacht-Type
985 5985.00 20160904 605 2095 105 Kassandra Pacific 34

1151 21036.00 20160801 590 1319 114 Eurydike Pacific 44


125 Aurora Pacific 315
1147 14476.00 20160801 530 2043

CUSTOMER

Person-ID Birthday Surname Firstname


605 1975-03-19 Weise Heike
590 1978-11-04 Bares Salia
530 1976-07-29 Dietrich Claudia
322 1980-09-28 Falter Heide

414 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
Example for nested FIND

415 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
List for selection values in different files

“The booking agent wants to see all contracts which have been created within
a certain period and for each of them the yacht names and the customer
names. “
CRUISE
CRUISE-ID Date Start-Harbor ID-YACHT
1319 2016-11-24 Lefkas 105
2095 2016-09-29 Santorini 105
2043 2016-09-29 Syros 114

CONTRACT

Contract-ID Price Date-Reservation ID-Customer ID-Cruise YACHT


YACHT-ID Yacht-Name Yacht-Type
985 5985.00 20160904 605 2095 105 Kassandra Pacific 34
1151 21036.00 20160801 590 1319 114 Eurydike Pacific 44
1147 14476.00 20160801 322 2043 125 Aurora Pacific 315

CUSTOMER

Person-ID Birthday Surname Firstname


605 1975-03-19 Weise Heike
590 1978-11-04 Bares Salia
530 1976-07-29 Dietrich Claudia
322 1980-09-28 Falter Heide

416 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
Example for nested FIND nested in a READ loop

417 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Selection values in different files – result from one file

“The booking agent wants to see all contracts with the contract details which
were created this year for cruises with a specific start-date and from a specific
start-harbor.”

CONTRACT
CRUISE
Contract-ID Price Date-Reservation ID-Customer ID-Cruise CRUISE-ID Date Start-Harbor ID-YACHT
985 5985.00 20160904 605 2099 2095 2016-11-24 Lefkas 69
1319 2016-02-11 Samos 105
1151 21036.00 20160801 590 1319
2043 2016-09-29 Syros 114
1147 14476.00 20160801 530 2043

CRUISE

CRUISE-ID Date Start-Harbor ID-YACHT


2095 2016-11-24 Lefkas 69
1319 2016-02-11 Samos 105
2043 2016-09-29 Syros 114

418 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
FIND with Coupling-clause

FIND view-name WITH basic-search-criteria Only data fields from base view are
available
{AND | OR} COUPLED [TO] [FILE]
Not same file in two couple clauses
view-name2
Physical / Logical coupling
[VIA descriptor1 = descriptor2 ] Logical Coupling
WITH basic-search-criteria VIA clause

statement... Coupling clause up to 42


times
END-FIND

419 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example FIND COUPLED

420 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
When to use READ and
when to use FIND?

421 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Differences between READ and FIND

READ FIND
One descriptor Complex criteria with many descriptors and non-descriptors

Only sorted by descriptor Default sorted by ISN, can be sorted by 3 descriptors

One record at a time Resulting ISN list is generated, afterwards one record at a time

If specific record is not there the next record in sequence If specific record is not there (*NUMBER=0) NO RECORDS found
will be passed back (or end of list) clause available

422 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
When to use READ or FIND

READ FIND
If selection criterion is not to complex and post-selection Complex selection criteria, use WHERE clause only for non-
criterion satisfy and applies to most records descriptors
If ´end user´ typically does not scroll down Bigger effort in phase I when creating the ISN list, afterwards only
access via ISN, keep contention in mind
In outer loop, for inner loop use FIND To find one specific record

Preferable for re-posititioning For small intermediate and resulting ISN lists, avoid HUGE ISN lists

If sorted by descriptor is needed SORT is ´expensive´

-> think about creation of a descriptor, superdesriptor or subdescriptor

-> think about using HISTOGRAM to find more out about the data

423 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example FIND COUPLED and alternative I

424 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example FIND COUPLED and alternative II

425 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
Data access using READ or FIND

426 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Access one record to list a customer

427 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
16

Data Manipulation and


Contention

428 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
What we will cover

▪ Transaction Processing
▪ DELETE Statement
▪ UPDATE Statement
▪ STORE Statement
▪ Contention Access / Modification
▪ Contention Modification / Modification
▪ Transaction with Multiple Updates

429 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Transaction Processing

430 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Data Manipulation Statements

CRUISE

CRUISE-ID Date Start-Harbor Destin

2095 2016-11-24 Lefkas Hydra

2058 2016-09-29 Santorini Rhodos Kos UPDATE


2043 2016-09-29 Syros Chios

2012 2016-09-29 Samos Lefkas STORE

2089 2016-09-22 Lefkas Hydra

2060 2016-09-22 Santorini Hydra

2040 2016-08-24 Naxos Chios DELETE


20032 2016-08-24 Samos Naxos

431 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
Database transaction definition

Database in a
Transfer of data from a consistent state into
consistent state
Start of transaction another consistent state

Indivisible
Database in
Execution of
inconsistent
transaction Single unit of work which must succeed or fail
state
as complete unit

Process invoked by a user


End of transaction Database in a
consistent state

time

432 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Database transaction in Adabas

Starts with command that locks a record

Called HOLD
Update
Customer #1
implicit when UPDATE / DELETE
FIND CUSTOMER #1
statement is used in
DISPLAY
CUSTOMER
READ/FIND/GET processing
Type-in
changes

Ends with transaction end processing


UPDATE one
logical
End Transaction (commit)
END TRANSACTION
transaction
END-FIND
Backout Transaction (rollback)
Session close
Timeout

433 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
END TRANSACTION and BACKOUT TRANSACTION

END [OF] TRANSACTION [ operand1 … ]

BACKOUT [TRANSACTION]

434 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hold Logic

A record can only be modified when it is in


HOLD status

At access time, the intention to modify will


cause the record to be locked (HOLD status)

The decision is made when the module is


compiled

At the end of the transaction, the lock on the


records is released

435 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Contention definition

Contention is a competition of resources


STORE access parallel to manipulation
customer
STORE manipulation parallel to manipulation
customer

Update Anomalies (misbehavior of the database which is


cruise GET not expected by the user)
Update yacht Dirty read (read ‘uncommitted’ data)
LIST
cruise cruise
LIST Lost updates (parallel overwrite of
cruise update)

Natural Non-repeatable read (two reads -> two


results)

Adabas Phantom read (data changed in


selection list

436 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hold logic and contention

Parallel Read access is possible

Parallel modification is not possible (access is


already prohibited)

Options if concurrent process encounters a


locked record
Wait until the record is released

Issue an error message (Adabas response


code 145 – NAT3145).

Session parameter
WH (Wait on Hold) = ON/OFF

time time

437 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DELETE Statement

438 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
DELETE statement

Data, all index values and AC entry is deleted

DELETE [RECORD] [IN] [FILE] [(r)] The statement refers to

to the current access loop (default)

with a label to

▪ any access loop

▪ GET statement
▪ STORE statement

Immediately after the delete the record is no


longer accessible

439 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example DELETE Statement

440 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
UPDATE Statement

441 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
CHANGE - one record of the customer file

“The customer wants to change his address.“

CUSTOMER

Birthday Surname City

1975-03-19 Weise Paris …….

1978-11-04 Bares New York …….

1976-07-29 Dietrich Frankfurt …….

1980-09-28 Falter Munich …….

1975-12-29 Blaettel Berlin …….

1977-06-15 Brosch Monaco …….

442 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
UPDATE statement

UPDATE [RECORD] [IN] [STATEMENT [(r)] Fields which are not changed remain as they
are
Index values are updated
Maybe AC entry (RABN) is changed, but ISN is
same
The statement refers to

to the current access loop (default)

with a label to

▪ any access loop

▪ GET statement

▪ STORE statement

443 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example UPDATE statement

444 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Demo:
UPDATE Statement

445 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
STORE statement

446 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
NEW – add a record to the customer file

“The user adds a new record with all his data including his email address
and will get internally an unique customer Id.“

CUSTOMER

Birthday Surname Firstname

1975-03-19 Weise Heike …….

1978-11-04 Bares Salia …….

1976-07-29 Dietrich Claudia …….

1980-09-28 Falter Heide …….

1975-12-29 Blaettel Marianne …….

1977-06-15 Brosch Nadia …….

447 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
STORE statement

STORE [RECORD] [IN] [FILE] Assign values to fields before the STORE

view-name Fields from the view which do not have an


assigned value are stored with their initial value
[ [USING | GIVING] NUMBER operand3 ]

Descriptor values are added

View needs to be specified

GIVING NUMBER can specify an ISN

448 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example STORE Statement

449 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Contention handling

For a STORE statement the record cannot be


locked in front

NEW ISN is automatically unique


Customer NEW
DISPLAY screen to Customer
enter data DISPLAY screen to Same Person-ID for two different users
enter data
Adabas unique descriptor
Type-in
new data
Type-in Lock other resource for synch
new data

STORE
STORE

END TRANSACTION

END TRANSACTION

450 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Example STORE with unique customer-id

451 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Add a new customer record

452 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Contention
Access / Modification

453 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Contention access / modification

READ/FIND without update does not lock a


record

Record can be locked in parallel and updated


LIST (another field or also DE is updated)
Customer
READ/FIND Updated data is moved to the access user, no
CUSTOMER Modify matter of transaction status
Customer
READ/ FIND
Move data to an CUSTOMER #1
array
UPDATE
“Anomalie” - Dirty read and non-repeatable
read
END TRANSACTION
one user reads data which is in the
END-READ / END-
FIND process of change from another user

two consecutive reads are passing


back different results.

454 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ with UPDATE contention

Address
Converter

4312 EMPLOYEES-FILE
4313
Inverted List 4312 1 FLETCHER
TYLER 5 SAMMET

4314 4313 2 SMITH 7 SMITH


NAME
4312
FLETCHER 12 41, 4 4314 4 FLETCHER 6 SMITH
4314
SAMMET 1 5 1 FLETCHER
4313
SMITH 3 2, 6, 7

TYLER 1 1

455 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
READ with UPDATE contention

Address
Converter

4312 EMPLOYEES-FILE

Inverted List
4313 FLETCHER,10
4312 1 5 SAMMET,7

4314 4313 2 SMITH,16


SMITH, 3 7 SMITH,5
NAME
4312
FLETCHER 2 1, 4 4314 4 FLETCHER,1 6 SMITH,4
4314
SAMMET 1 5
4313
SMITH 3 2, 6, 7
∑ of all values
30
∑ of all values
43

456 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Solution for READ and UPDATE contention

Solution – Change the access to a transaction

LIST
Add a ‘pseudo’ update in the READ
Customer loop to put each record in hold
READ CUSTOMER
Modify
Customer
´pseudo´ Side effects
UPDATE FIND CUSTOMER #1
UPDATE Longer wait times (more rsp-145), not
Move data to an
array END TRANSACTION only for update but also for parallel
access
END-READ
Maybe Adabas Holdqueue needs to be
END TRANSACTION
longer

457 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND with UPDATE contention

Inverted Lists BIRTH Address DATA Storage


19690505 1 2 Converter
DEPTARTMENT 19960224 1 4
MGMT10 1 1
19650704 1 6 4312
MGMT40 2
3 3, 8
6, 8
19991222 1 7 4314
SALE20 23 2,
2, 76, 7 19950422 1 1 4313 4312 1 FLETCHER 5 SAMMET
TECH10 1 4, 5 19771113 1 3
19690905 1 8
2 4315 4313 3 SMITH 7 EVANS

19740219 1 5
6 4312 4314 2 WELKE 8 SMITH

4315 4315 4 FLETCHER


6 MGMT40
PREMO, SALE20
4313
Resulting 4314
ISN List

458 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Contention access / modification

For a FIND, records are locked when accessed


ADABAS REUSEISN in phase-2
1st
LIST Customer
FIND CUSTOMER UPDATE -> keep ISN, update values in record
RETAIN ISN_list

Move data to an array DELETE -> remove record -> remove ISN
END-FIND Modify
Customer STORE -> new record -> new ISN
FIND CUSTOMER #1
UPDATE
2nd END TRANSACTION
LIST Customer Anomaly - Phantom read
FIND CUSTOMER from
ISN_list a selection list becomes ´invalid´
Move data to an array
due to parallel updates
END-FIND

459 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Solution

Solution
1st
LIST Customer
FIND CUSTOMER
checking the selection criteria again, if
RETAIN ISN_list
invalid
Move data to an array skip this record
Modify
END-FIND Customer re-do the whole FIND
FIND CUSTOMER #1
UPDATE
2nd END TRANSACTION
LIST Customer
FIND CUSTOMER from
ISN_list

Check selection criteria


and decide next step

Move data to an array

END-FIND

460 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND/READ with SHARED HOLD

FIND view-name Many users can have shared hold on same


record in parallel
WITH basic-search-criteria
An exclusive lock in parallel is not possible
[[IN] SHARED HOLD [MODE=option]]
Independent of UPDATE statement in
END-FIND READ/FIND loop

If many users have a shared hold the record


stays in shared hole until all of the specific
READ view-name shared holds are expired
[[IN] SHARED HOLD [MODE=option]]
END-READ

461 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
SHARED HOLD options

FIND view-name ‘C’ : check if some other user has this record in
hold – will not set a record into shared hold
WITH basic-search-criteria
[[IN] SHARED HOLD [MODE=option]]
‘Q’ : set a shared hold until next record in
END-FIND sequence is read, or end of loop or ET or BT

‘S’: set a shared hold until transaction end


READ view-name
[[IN] SHARED HOLD [MODE=option]]
END-READ

462 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
FIND/READ with SKIP RECORDS

FIND view-name Parameter WH=OFF is set

WITH basic-search-criteria
User tries to lock a record which is locked by
[SKIP [RECORDS] IN HOLD] another user

END-FIND
Instead of rsp-145 the record will be skipped
and the next record will be read and locked

READ view-name
[SKIP [RECORDS] IN HOLD]
END-READ

463 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Contention
Modification /
Modification
464 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Competition for a record

Initiate HOLD by specifying UPDATE statement within the loop

HOLD released with transaction end processing

Options if concurrent process encounters a locked record WH (Wait on Hold) = ON/OFF

Wait until the record is released

Issue an error message (Adabas rsp-145)

465 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Contention modification / modification

Modify Modify
Customer Modify Customer
Pessimistic Locking Optimistic Locking
FIND CUSTOMER #1 Customer FIND CUSTOMER #1
Modify
FIND CUSTOMER #1 END-FIND
Customer
FIND CUSTOMER #1
Type-in changes
END-FIND
..waits.. Type-in changes

UPDATE GET / FIND


CUSTOMER #1
END TRANSACTION Type-in changes

UPDATE
END-FIND
Type-in changes END TRANSACTION GET / FIND
CUSTOMER #1
END-FIND
UPDATE
UPDATE
END TRANSACTION
END TRANSACTION
END-FIND
END-FIND

466 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Locking strategy

Pessimistic Locking Optimistic Locking


Record is locked a long time Record is only locked short time

Longer wait time, or more rsp-145 Less wait time, lesser contention situations

No additional effort by checking again Additional effort for second check, including handling when check
´fails´

467 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Optimistic locking approach

GET CUSTOMER
Add a field for a timestamp which is changed
Customer every time the record is updated
Surname timestamp
FIND CUSTOMER #1
END-FIND
Weise ……. 56756758 First access: get the timestamp and keep this
Bares …….59875869

Dietrich …….19876584
Second access: get the timestamp and check
this against the previous timestamp
Type-in changes
CUSTOMER
Same timestamp
Surname timestamp
Modify No contention, continue
Customer Weise ……. 86112113

Bares …….59875869
GET CUSTOMER #1
Dietrich …….19876584
Different timestamp
Check timestamp
update contention, pass back error
UPDATE

END TRANSACTION
´56756758´ = ´86112113´ ? Use Natural variable *TIMESTMP or Adabas
END-FIND systemfield TIME

468 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Optimistic Locking
Hand-on Lab description

Surname timestamp
GET
Frontend Customer
RDCRUISP [Link] [Link] Weise ……. [Link]
[Link]

Surname timestamp
Modify
P-SELECTION.P-TIMESTAMP Customer [Link]
Weise ……. [Link]

same?
Surname timestamp

yes
Weise ……. [Link]
[Link]
Update incl.
*TIMESTMP
[Link]

469 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Modify an existing customer

470 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Transaction with Multiple
Updates

471 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
NEW and MODIFY – Update of several files

“The user wants to book a cruise.“

CONTRAC
T

Contract-ID Price Date-Reservation ID-Customer ID-Cruise

985 5985.00 20160904 605 1319

1151 21036.00 20160801 590 2058

1147 14476.00 20160801 530 2043

CRUISE

CRUISE-ID Date Start-Harbor Destin CRUISE-STAT

2095 2016-11-24 Lefkas Hydra 5

2058 2016-09-29 Santorini Rhodos 2

2043 2016-09-29 Syros Chios 1

472 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
© Software AG Training
Create Contract – two services

In each service there is an END


Modify Cruise
Modify Cruise and
TRANSACTION
FIND CRUISE
subtract x from Check timestamp
availability Avail = Avail - x
Update
The caller checks after each service if the
END TRANSACTION service was successful and if not, then the caller
has still the data to roll-back the transaction
Create contract

Create Contract
STORE CONTRACT
UnSucessfull ? END TRANSACTION If the rollback from the caller does not work,
then there is no easy solution to solve this.

Modify Cruise and


add x to
Modify Cruise
availability FIND CRUISE
Avail = Avail + x
Update
END TRANSACTION

473 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Business Function ´Book Cruise´

List Cruise
List all cruises and display it
READ CRUISE

Get specific cruise #10 and display it


Show me all cruises Get Cruise
FIND CRUISE - Check availability
Check email already entered ?
I select a specific cruise and like
to see it.
No, ask for email yes Register Customer
I press ´booking´ FIND
Customer already there ? (maybe) STORE
END TRANSACTION
No, ask for details yes
I specify my registered
email address / or Modify Cruise
register Modify Cruise FIND CRUISE
Check availability
Update availability
Put all data together and show it to user
I see the whole contract and END TRANSACTION
acknowledge by pressing
´buy´
Create contract Create Contract
STORE CONTRACT
Unsucessfull ? Sucessfull END TRANSACTION

474 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Create Contract – one service

Put all data together and


Modify Cruise and Create Contract are in one
show it to user service

Modify Cruise
Encapsulated & self-contained & independent
FIND CRUISE
Modify Cruise and Create Check availability
Contract Update Transaction is handled by database, incl. roll-
back

Create Contract
The time between the first access to the Cruise
STORE CONTRACT
and the store of the contract is much longer.
END TRANSACTION
It might come more often to a failure of booking.
Unsucessfull

Database will
handle this

475 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Business Function ´Book Cruise´

List all cruises and display it List Cruise


READ CRUISE

Get specific cruise #10 and display it


Show me all cruises
Get Cruise
I select a specific cruise and like Check email already entered ? FIND CRUISE
to see it.
No, ask for email yes
I press ´booking´ Register Customer
Customer already there ? FIND
(maybe) STORE
I specify my END TRANSACTION
registered email No, ask for details yes
address

Put all data together and show it to user


Modify Cruise and Create
Contract
FIND CRUISE
I see the whole contract and Modify Cruise and create
Check availability
Contract
acknowledge by pressing Update
´buy´
STORE CONTRACT
Unsucessfull ? Sucessfull END TRANSACTION

476 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.
Hands-On Lab:
Book a cruise

477 © 2024 Software AG. All rights reserved. For internal use only and for Software AG Partners.

You might also like