Vous êtes sur la page 1sur 121

ADABAS

Adaptable DAta BAse System

RBC Induction - Proprietary and Confidential

CONTENTS
Day-1
Database Concepts
ADABAS Overview
ADABAS Architecture
Day-2
Fields & Descriptors
Accessing ADABAS
Data Protection/Security

Day-3
ADBAS Nucleus
ADAPREP commands
Day-4
ADABAS programming
Day-5
Test the knowledge

RBC Induction - Proprietary and Confidential

MODULE - 1

Database
Concepts

RBC Induction - Proprietary and Confidential

Database Concepts

A data base is not really anything new. It is just a concept, or a


way of organizing data and software, to solve some of the
problems found in conventional file processing.

The data base concept solves the problems of


Duplication of data and effort.
Programmers needs to know the exact file structure.
People looking at files to which they should not have
access.
Programs needs to be changed when the data is
organized differently.
Dynamic Reporting structure

RBC Induction - Proprietary and Confidential

Database Goals

Data bases are used to meet 4 main data- related goals

Increase Data Independence


Reduce Data Redundancy
Increase Data Security
Maintain Data Integrity

RBC Induction - Proprietary and Confidential

Database Goals

INCREASE DATA INPENDENCE


PROGRAM - A
INDEPENDENT
FILE SYSEM
PROGRAM - B

In database processing, the data and the programs


are INDEPENDENT. A change in the data organization
will NOT USUALLY affect the user programs.
If the format of the data is changed or re-organized,
the programs dependant on that data must be
changed. For example, if you need three lines for an
address instead of two, the data would have to be
changed as well as the programs.
Bottom line is users should not worry how the data is
actually stored. Instead, they can focus on the particular
part of data they want to access with an application
program.
RBC Induction - Proprietary and Confidential

Database Goals

REDUCE DATA REDUNDANCY


In a conventional file system, the same data may be stored in many different files to
meet the requirements of different applications. Thus some of the data is
unnecessarily repeated (redundant).
For example in conventional File processing system Customer address is repeatedly
found in
CUSTOMER RECORDS SYSTEM (CRS)
PURCHASE ORDER SYSTEM (POS)
ACCOUNTS RECEIVABLE SYSTEM (ARS)
This redundancy could cause problem when customer address changes. The address
must be changed in each of the files causing duplication of effort and more
opportunities of errors.
So it is better for different application systems to share same centralized database
thus avoiding
POS
the data redundancy.
CENTRALIZED
CRS
DATA BASE
ARS

RBC Induction - Proprietary and Confidential

Database Goals

INCREASE DATA SECURITY


Most databases have security features which authorize access to the data
and place restrictions on the operations that may be performed on the
data.

Eg: You may be allowed to read particular data, but not update it.
Eg: Only certain people may be allowed to look at salary data.

RBC Induction - Proprietary and Confidential

Database Goals

MAINTAIN DATA INTEGRITY

Maintaining accuracy (integrity) of the data is very important in a database


system because the database is shared by many users.
Without integrity, the data could end up to be invalid or unreliable.
Everyone who uses the database, from programmer to DBA, is responsible
for integrity of data.

RBC Induction - Proprietary and Confidential

Database Goals

As per understandings the four main goals of Database system are:

INCREASE INDEPENDENCE
REDUCE REDUNDANCY
MAINTAIN DATA INTEGRITY
INCREASE DATA SECURITY

RBC Induction - Proprietary and Confidential

Types of Databases

There are three types of data base management systems

HIERARCHICAL
NETWORK
RELATIONAL

RBC Induction - Proprietary and Confidential

Database Types

HIERARCHICAL Database
STUDENT

REGISTARTION

COURSES

DEGREES

COMMENTS

HIGH SCHOOL

REPORTS

Each Segment is directly dependent on one segment only

RBC Induction - Proprietary and Confidential

Database Types

HIERARCHICAL Database
In a Hierarchical database

There is always a basic or "root" segment.


A segment may relate downwards to one or more subordinate segments; these
subordinates are referred to as "child" segments.
A subordinate (child) segment may relate upward to only one superior or
"parent" segment.

RBC Induction - Proprietary and Confidential

Database Types

NETWORK Database
COMPANY

BUILDING

VEHICLE

CLUB

PERSON

Here data is organized so that the PERSON segment is


directly dependent on both COMPANY and CLUB.
Segments are equivalent to records in flat file structures.

RBC Induction - Proprietary and Confidential

Database Types

NETWORK Database
In a network database structure . . .

segments are related to one another as superiors and subordinates.


A segment may relate downwards to one or more subordinates.
A segment may relate upwards to one or more superiors. This is what
distinguishes a network structure from a hierarchical structure.
A network database structure can be considered an expansion of the
hierarchical structure

RBC Induction - Proprietary and Confidential

Database Types

RELATIONAL Database
SSN #

DOB

Key Field

DEPT

Sex

DEPT

Dept
Name

Employee
Record

Designatio
n

Timing
s

DEPT Record

In a Relational Database, fields in one record type are used to point to o


record types

RBC Induction - Proprietary and Confidential

Database Types

ADABAS Database
Which type of data base management system do you think ADABAS is
closest to?

RELATIONAL

RBC Induction - Proprietary and Confidential

MODULE - 2

ADABAS Overview

RBC Induction - Proprietary and Confidential

ADABAS - Overview

Adabas is a high-performance database for large, mission-critical applications. It is


specifically designed to support thousands of users in parallel while giving sub-second
response times.

Its legendary reliability in combination with its low cost of ownership makes it a firstchoice database for any mission-critical business application

Some Key Features

Relational and nested data structures

Native and SQL access

Built-in transaction concept

Minimal space consumption

Built-in utilities

Automated DBA tasks

Add-on products for special requirements, such as Text retrieval

Distributed computing

Web support

Administration

RBC Induction - Proprietary and Confidential

ADABAS - Overview

Adabas is available for a wide range of platforms, including Windows NT, UNIX, Open
VMS and mainframe.

Access to Adabas

Adabas can be accessed from Natural, Software AGs 4GL development


environment,

Bolero, Software AGs application factory, and from every 3GL and 4GL that is
equipped with a call interface.

In addition, Adabas can be accessed via standard interfaces such as ODBC or


JDBC and, of course, embedded SQL can be used

RBC Induction - Proprietary and Confidential

ADABAS Overview

RBC Induction - Proprietary and Confidential

ADABAS Overview

The Size of an Adabas Database

On the mainframe there is no size limit at all

On open-systems platforms the theoretical limit for Adabas databases is 128 TB a figure limited in practice only by the amount of hard disk space that can be
made available

Mainframe ADABAS supports around 65535 databases. Each Database in turn


contains FILES (maximum 5000). A FILE can contain around 4 Trillion records and
each record is collection of fields. Field is the last undivided level where data is
stored. Each record can have maximum 926 fields

RBC Induction - Proprietary and Confidential

Features of ADABAS

Inverted lists are used to define relationships in the data


Adabas is very flexible database management system
Can produce many different views for various users
In ADABAS, information can be logically interconnected (or related) through
the use of INVERTED LISTS
The inverted lists are lists of addresses for each record, and there is one
inverted list for every key field in every ADABAS dataset. (A file is referred
to as a dataset.)
Because relationships are defined in the keys, ADABAS is very FLEXIBLE or
ADAPTABLE
The name ADABAS reflects its flexible structure
ADAPTABLE DATA BASE SYSTEM

ADABAS

RBC Induction - Proprietary and Confidential

Database Overview

What is Inverted List ?


The inverted lists are lists of addresses or ISN (Internal Sequence Number)
numbers for each record, and there is one inverted list for every key field in
every ADABAS dataset.
In Adabas , information can be logically inter connected through the use of
Inverted lists.
Example Of Automobile Database
Let's see an example of how inverted lists provide a flexible system for
keeping data.

LICENSE
BDX 205
CHS 499
AMC 372
KEN 007
BPS 076
MPM 644

TYPE
FORD
OLDS
CHEVY
PORSHE
OLDS
FORD

MODEL
TAURUS
CUTLASS
MALIBU
928
SUPREME
TEMPO

RBC Induction - Proprietary and Confidential

COLOR
BLACK
RED
RED
BLACK
BLUE
RED

Database Overview

How ISN is supplied by Adabas


There are no key fields defined in the data. ADABAS assigns an Internal
Sequence Number (ISN) to each record for searching purpose

ISN
1
2
3
4
5
6
7
8

LICENSE
BDX 205
CHS 499
AMC 372
KEN 007
BPS 076
MPM 644
..
..

TYPE
FORD
OLDS
CHEVY
PORSHE
OLDS
FORD
..
..

MODEL
TAURUS
CUTLASS
MALIBU
928
SUPREME
TEMPO
..
..

RBC Induction - Proprietary and Confidential

COLOR
BLACK
RED
RED
BLACK
BLUE
RED
..
..

Database Overview

What is a Descriptor
When Key is defined, nothing is changed in the data, Instead an inverted
list is built for that key (Descriptor).
Which field you want to describe as Descriptor
LICENSE TYPE MODEL COLOR
Inverted List Based on LICENSE

DESCRIPTOR COUNT
AMC 372
1
BDX 205
1
BPS 076
1
CHS 499
1
KEN 007
1
MPM 644
1
..
..
..
..

ISNs
3
1
5
2
4
6
..
..

RBC Induction - Proprietary and Confidential

Database Overview

Inverted List based on TYPE

DESCRIPTOR COUNT ISNs


CHEVY
17
3,8,14,34..
FORD
29
1,6,17,23,..
OLDS
42
2,5,19,20,..
PORSHE
2
4,57,...
..
..
..
..
..
..

Inverted List based on MODEL

DESCRIPTOR
928
CUTLASS
MALIBU
SUPREME
TAURUS
TEMPO
..
..

COUNT
2
4
17
6
13
10
..
..

ISNs
4,57,...
2,20,46,47,..
3,8,34,63,..
5,19,38,42
1,17,32,40..
6,23,28,37..
..
..

RBC Induction - Proprietary and Confidential

Database Overview

Features of ADABAS
Another feature of ADABAS is the ability to produce many different views
of the data (using PREDICT / NATURAL)
Advantages of User Views are

Provides security for confidential data


Provides simple views to the users
Eliminates unnecessary information being presented
Data Compression
Allows data to be stored efficiently
Security Facilities
Provided for confidentiality of data

RBC Induction - Proprietary and Confidential

Database Overview

Data Compression
ADABAS has an option to store data on the disk in a compressed form. This
option saves disk space and reduces I/O.

leading zeros are removed from numeric fields


trailing spaces are removed from alphanumeric
null value fields are compressed to a single byte
numeric data is packed

fields

Compression reduces data storage almost by 50%


Secure Data
ADABAS maintains data security in four ways:
Dataset Level:
An entire dataset can be password protected to allow no access, or readonly access, or update access for different security levels.
Field Level:
An individual field can be protected from unauthorized access or
unauthorized updating. Up to 15 security levels can be set for a field

RBC Induction - Proprietary and Confidential

Database Overview

Security by Value
Access to a file can be restricted by the value of the field. For example,
managers could be restricted to personal information of employees in only
their own department.
Ciphered Data
Records can be ciphered or encrypted when information is highly
confidential. A ciphering key is entered by the user when records are stored.
It must be entered again to access the data.

RBC Induction - Proprietary and Confidential

ADABAS Environment

ADABAS can operate in one of two environment

Multi-User
Singe-User

Multi-User
This is the normal operation of a data base where many people in an
organization are reading, updating, adding and deleting data simultaneously.

ADABAS
DATABASE

Operating System
ADABAS Nucleus
--------------------------MPM
Application - 1
Application - 2

RBC Induction - Proprietary and Confidential

Multi Processing Module


Batch program
Online program

ADABAS Environment

Single User
This mode can be used when there is huge amount of processing (like
rearranging the
entire database). This could be done at night when no one else wants to use
Adabas.

ADABAS
DATABASE

Operating System
ADABAS Nucleus
Application - 1
Application - 2

RBC Induction - Proprietary and Confidential

Learning Objective

In this module you have learnt:

_
_
_
_

Advantages of a data base system


Three types of data bases
ADABAS features
ADABAS environment

RBC Induction - Proprietary and Confidential

MODULE - 3

ADABAS Architecture

RBC Induction - Proprietary and Confidential

Main components of ADABAS

ADABAS Database

Associator
Work
Data

RBC Induction - Proprietary and Confidential

Main components of ADABAS

ADABAS
Database

Associator
Work
Data

Operating System
ADABAS Nucleus
MPM
Application 1
Application 2

RBC Induction - Proprietary and Confidential

ASSOCIATOR

This dataset contains

A list of all ADABAS datasets in the database


Physical location of datasets (by block number)
Descriptions of all fields of each ADABAS dataset in the Field Description Table
Inverted lists for each descriptor
ADDRESS CONVERTER for relative record locations

A second important component of the Associator is the Address Converter

The Address Converter is an index to the physical storage location of the records,
giving the physical block in which each record is stored.
There is one Address Converter for every dataset in the database.

RBC Induction - Proprietary and Confidential

Address Converter

To understand how the Address Converter works, we need to know how the
data records are organized

The records are not necessarily stored sequentially by ISN


The records are grouped and stored in blocks on the disk and indexed by
Relative ADABAS
Block Numbers (RABNs - pronounced like Robin)

RBC Induction - Proprietary and Confidential

Inverted List & Address Converter

BLOCK 1

BLOCK 2

BLOCK 3

ISN
2
9
6
:
11
3
1
:
4
7
5
:

LICENSE
MAP 199
BLY 409
MBP 526
:
XOX 000
LNC 128
CHS 710
:
BDX 205
FMT 931
SRA 101
:

MAKE
FORD
DODGE
HONDA
:
PONTIAC
CHEVY
FORD
:
MERCURY
HONDA
OLDS
:

RBC Induction - Proprietary and Confidential

COLOR
ORANGE
MAROON
MAROON
:
ORANGE
BLUE
BLUE
:
GREEN
BLUE
GREEN
:

Inverted List & Address Converter

DESCRIPTOR
BLUE
GREEN
MAROON
ORANGE

COUNT
17
14
19
2

ISNs
1,3,7,12,..
4,5,14,18,..
6,8,9,13,..
2,11,..

ADDRESS
CONVERTER
2
1
2
3
3
The Address Converter is ordered sequentially by
1
ISN
3
in this example:
4
ISN#1 is in RABN 2
1
ISN#2 is in RABN 1
7
ISN#3 is in RABN 2 etc..
2
4
For an efficient search for the ISNs, the
Address
Converter is used

RBC Induction - Proprietary and Confidential

ISNs
1
2
3
4
5
6
7
8
9
10
11
12

WORK Dataset

This dataset is used to keep data protection information that is required for automatic
restarts and backouts after a system failure
It acts as a type of working scratch-pad area for ADABAS

Associator

Data Protection Information

Work

----------------------------------Temporary ISN list storage


-----------------------------------

Data

Resulting ISN lists

Besides storing DATA PROTECTION INFORMATION, the WORK


dataset acts as temporary storage during a SEARCH command. The
WORK dataset also acts as temporary storage for ISN lists
When ADABAS is finding records for you, it uses the WORK dataset
for intermediate results
Only partial or incomplete transactions are kept track of here. A log
of the commands is not kept in the WORK dataset

RBC Induction - Proprietary and Confidential

DATA Dataset

Data records are stored in the DATA dataset

In random order
compressed to save disk space
organized into fixed length blocks on disk

The DATA dataset contains the physical data stored in FIXED SIZE BLOCKS

Inverted List

Address
Converter

Block 1
Block 2

DATA

Block 3

WORK

ASSOCIATOR
RBC Induction - Proprietary and Confidential

ADABAS - Logs

After knowing the datasets lets see the two optional logs of ADABAS
These are

The Command Log keeps a record of every command that goes through
the ADABAS nucleus

COMMAND LOG
PROTECTION LOG

This log gives a basis for billing those who use the system
The log gives the valuable information for performance tuning
This log is also used for application program debugging

The Protection Log contains before and after images of any records that are
updated, deleted, or added between checkpoints

It is used for regeneration of the database


(eg. After a disk crash)
It is also used for backing out of a job
It is used for keeping an audit trail

RBC Induction - Proprietary and Confidential

ADABAS Database Organization

After knowing the ADABAS environment , lets see the organization of data
in the database
We will look at

An ADABAS database is made up of up to 255 data datasets (files)


An ADABAS file can have up to 16.7 million records
An ADABAS record can have up to 926 fields
Some special grouping fields in ADABAS are

Datasets
Records
Fields

MU fields (Multiple Value fields)


PE groups (Periodic group of fields)

These are like arrays within the records

MU fields are 1- dimensional arrays


PE fields are 2- dimensional arrays

RBC Induction - Proprietary and Confidential

MU/PE fields example

MU fields
This is a single dimensional array where ADABAS allows us to store multiple
values in that particular field. For example lets look at the following typical
employee record
If now we need Rajeevs record of positions before his attaining the current
Consultant designation we may use an MU Field to store this information
Rajeev

Sharma

Consultant

M.E

87%

Assc Const
Asst Const

This designation field constitutes an MU Field. The maximum numbers of


occurrences supported are 191.

RBC Induction - Proprietary and Confidential

MU/PE Fields
PE Fields
PE is a group of fields that repeat together in a record. A PE field can consist of
elementary fields as well as Multiple Value fields. For example I want to store the
following details about car
-Car Number
-Model
-Type
-Servicing Dates
All this information can be stored in a PE field consisting of elementary fields as Number,
Model and Type and a Multiple Value field Service Date. A PE field can store up to 191
occurrences. Maximum of 99 PE group occurrences per PE
Rajee
v

Consultan
t
Assc Cons
Asst Cons

M.E

DL3CM
9998

2005

ALTO

04/11/2008
04/11/2007
04/11/2006
04/11/2005

DL3C
4115

1999

Zen

09/09/2001
09/01/2000
09/01/1999

RBC Induction - Proprietary and Confidential

87%

MU/PE Fields

When should PE groups or MU fields be used?

When you have user views that relate directly to one of the other user views in a
one-to-many relationship

Databases with PE groups are more inflexible, acting more like a


hierarchical than relational
One should have a good reason for using PE groups (I.e. If you want all
occurrences of the PE group that relate to a record every time you access

RBC Induction - Proprietary and Confidential

Learning Objective

In this module you have learnt:


_
_
_
_

The three types of ADABAS datasets


Two optional logs in ADABAS
Data file architecture
MU and PE repeating fields

RBC Induction - Proprietary and Confidential

MODULE - 4

Fields
&
Descriptors

RBC Induction - Proprietary and Confidential

Data Organization

ADABAS Data Base

1 - 255 Datasets
0 - 16.7 million records

1 - 926 fields
RBC Induction - Proprietary and Confidential

ADABAS Fields

ADABAS keeps track of field-related information in the Field Definition Tables (FDT)
Here is some of the information that is kept:

_ ADABAS field name


_ Format
_ Level
_ Length
_ Type of compression
_ Type of field
Data Format of fields
Data in an ADABAS is in one of the 6 following formats, each with a one
letter code
F
P
U
A
B
G

Fixed point binary4 bytes


Packed numeric
15 bytes
Unpacked numeric
29 bytes
Alphanumeric
253 bytes
Binary
126 bytes
Floating point
8 bytes

RBC Induction - Proprietary and Confidential

Data Format of fields

The information about each field in the database is kept in the FDT (Field
Definition Table)
Sample information of FDT looks like ...

External Field Name


-------------------------This is the name that
would be used for a field
in an application program

ADABAS Field Name


-------------------------This is a two byte
alphanumeric code that
ADABAS will use to look
up the field

EMPLOYEE-NO
NAME
LAST-NAME
FIRST-NAME
DEPARTMENT
RBC Induction - Proprietary and Confidential

A1
A2
A3
A4
BB

FDT Information

Level
-------------------------The level of the fields as in
a PL/I declaration or a
COBOL data division

01
01
02
02
01

Format
Length
----------------------- -------------------------This indicates the type
of data in the field

The standard length of the


field in bytes

A
A
P

16
16
10

RBC Induction - Proprietary and Confidential

DATA Compression

ADABAS uses special compression techniques to


Conserve disk space
Reduce Input/Output
Increase performance

Field compression can be set in one of three different ways


FI
Default
NU

----

Fixed field with no compression


Compression of individual fields
Null suppression uses special
techniques to make compression
even greater than the default

RBC Induction - Proprietary and Confidential

Data Compression

Special Length bytes are added to the record when


compressed
=================================================================================

FI

Default

NU

======================================================
==========

No length bytes
A length byte is
One byte is use

are added.
added at the
to count empty

start of every
fields.

field.

Fields with data

in them have a

length byte

added.

================================================================================

RBC Induction - Proprietary and Confidential

DATA Compression

+-----------------------------------------------+

B A R B

+-----------------------------------------------+
This is a fixed alphanumeric field for "First Name".
Default or NU compression would add a length byte
and remove trailing spaces.

The length of
'5' counts the
characters and
includes itself.

+-------------------+

5 B A R B

+-------------------+

Compression of this field saved 7 bytes from a 12 byte field!

RBC Induction - Proprietary and Confidential

DATA Compression

RBC Induction - Proprietary and Confidential

DATA Compression

The following is an example of a compressed numeric field.


+---------------------------+

0 0 0 2 8 4 6

+---------------------------+
This is a standard unpacked numeric field for "Employee Number".
+-------------------------------------------------------+
Default or NU compression would store this as packed,
remove the leading zeroes and add a length byte.

+-------------------------------------------------------+
________________________________________________________
+---------------+

0 8 6
4 2 4 C
+---------------+
This 7 byte field is compressed into only 4 bytes. The 'C' on the end indicates the sign
of the number (positive).

RBC Induction - Proprietary and Confidential

DATA Compression

There is still wasted space that could be eliminated using NU


compression

RBC Induction - Proprietary and Confidential

DATA Compression

Under NU compression it looks like

6JERRYC 086
4424C
The count indicates 4 empty fields
Default compression saves 50%
NU compression saves 75%

RBC Induction - Proprietary and Confidential

DESCRIPTORS

In ADABAS, a key field is called a DESCRIPTOR , abbreviated to DE


An ADABAS file may have up to 200 descriptors. These descriptors may be
defined when the dataset is initially created, or at a later time using the ADAINV
utility
ADABAS has 5 types of DESCRIPTORS

Regular Descriptors
Super Descriptors
Sub Descriptors
Phonetic Descriptors
Hyper Descriptors
Regular Descriptor:
A regular descriptor is a regular field that can be used for search criteria.
Example:
In a file of employee records, the employee number would likely be defined as
a regular descriptor
A special feature of regular descriptors is the UNIQUE DESCRIPTOR option. This
ensures that there will be only one occurrence of each value in the data base
dataset.
Example:
If all employee numbers are to be unique, the unique descriptor option could
be used for the employee number field.

RBC Induction - Proprietary and Confidential

Super Descriptor

A super-descriptor is a concatenated or compound key, consisting of from 2


to 5 elements. These elements can come from other fields, from parts of
other fields, or from combinations of whole and partial fields.
Super-descriptors may not exceed 253 bytes in length
Example:

In an employee data base, a search using "LAST NAME" will not always find a
unique record

By using a super-descriptor combination of "LAST NAME", "FIRST NAME",


and "BIRTH DATE", a search should always find a unique record
If the users of the data base often search by two factors (for example, price
of FORD cars with SUPREME model), a super-descriptor combination of
"MAKE" and "MODEL" will make this combination search efficient
Super descriptors can be made up of any combination of descriptors or
non-descriptors
Up to 5 whole fields or parts of fields can be made as Super descriptor

RBC Induction - Proprietary and Confidential

Sub Descriptor

A Sub descriptor is a partial field that is used as a descriptor


Example:

An automobile repair shop may stock parts. The part numbers may be contained
in one field yet contain more than one piece of information.

Part Number

G85404003871

Car manufacturer (GM)


Year of car (85)
Model of car (Delta 88)
Part type (Hubcap)

Phonetic descriptors make use of a phonetic algorithm built into ADABAS.


You can look up alphanumeric fields with "sounds-like" searching criteria.

Example:
If sales personnel wanted to look up their customer records without knowing
how to
spell the customer's name, they could use a phonetic descriptor.

RBC Induction - Proprietary and Confidential

Phonetic Descriptor

The telephone companies use a phonetic descriptor for looking up names and
phone numbers in directory assistance.

Hyper Descriptors
Hyper-descriptors enable descriptor values to be generated based on a
user-supplied algorithm.

Example:
If sales personnel wanted to look up customer records in reverse collating
sequence in terms of latest sales date, they could use a hyper-descriptor.

RBC Induction - Proprietary and Confidential

Compression effects

Compression of records has an effect on the inverted lists built for each
descriptor.
For regular descriptors, null suppression will not find records when a search
is conducted for a zero value or a blank value.
No entry is made in the inverted list for a null value field under NU
compression
The effects of NU compression for regular descriptors also applies to subdescriptors and phonetic descriptors.
Further, the NU compression also affects super-descriptors.
If any component of a super-descriptor is a zero or a blank under NU
compression, the ISN for that record will not be listed in the inverted list
Here is how to handle this:

If zero or blank values may be meaningful in a descriptor field, use default


compression.
If zero or blank values are definitely not meaningful, it is fine to use NU
compression

RBC Induction - Proprietary and Confidential

Learning Objective

In this module you have learnt:


_ Contents of the Field Descriptor Table
_ Compression effects on fields
_ Five types of descriptors
_ Compression effects on descriptors

RBC Induction - Proprietary and Confidential

MODULE - 5

Accessing
ADABAS

RBC Induction - Proprietary and Confidential

ADABAS Constraints

Maximum of 255 files per data base.


Maximum of 16.7 million records per file.
4816 byte maximum compressed record length.
Up to 926 fields per record.
253 byte maximum field length (alpha).
Maximum of 99 PE group occurrences per PE.
Maximum of 191 MU values per MU field.
Maximum of 200 descriptors per file.
Up to 5 fields or parts of fields in a Super Descriptor

RBC Induction - Proprietary and Confidential

ADABAS Accessing

You may access data in an ADABAS database using one of two approaches

Sequential Approach

Random Approach

Physical Order
ISN Order
Logical Order

RBC Induction - Proprietary and Confidential

Simple Find
Sorted Find
Complex Find
Getting by ISN

SEQUENTIAL Approach

Sequential access is done by using READ commands

READ PHYSICAL

In this method sequential access is to read in the physical order that the records
are stored

Physical Order - READ PHYSICAL


ISN EMPNO
1
7
5
3
6
4

01037
15429
66725
41180
31622
09331

VALUE
ACCT
ADMIN
MIS
PROD

LAST
NAME
HARRIS
BULWARK
GUNNER
CONCH
WU
HOYTE

COUNT
30
14
7
52

FIRST
NAME
JILL
KEN
DOUG
TERRY
MATT
BRIAN

DEPT
PROD
ACCT
PROD
ADMIN
MIS
PROD

ISNs
2,7,17,19,.
3,8,11,14,.
6,10,18,34,.
1,4,5,9,.

RBC Induction - Proprietary and Confidential

Employee Dataset

Inverted List for Dept

Physical Order - READ PHYSICAL

A READ PHYSICAL command will read the records in the order in which they
are stored in the dataset.
So the records will be read in this order:
1

READ Physical
The first method for sequential access is to read in the physical order that the
records are stored. A READ PHYSICAL command will read the records in the order in
which they are stored in the dataset.

Example :EMPLOYEE Dataset


+------------------------------

LAST FIRST
ISNEMP. NO NAME NAME DEPT
+---+-------+-------+-----+---- 1
01037 HARRIS JILL PROD
7 15429 BULWARKKEN ACCT
5 66725 GUNNER DOUG PROD
---+-------+-------+-----+---- 3 41180 CONCH TERRY ADMI
6 31622 WU
MATT MIS
RBC Induction - Proprietary and Confidential

So the records will be read in


this order:
1 7 5 3 6 4

ISN Order - READ by ISN

A second method for sequential access is to read in the order of the ISN.
A READ by ISN will retrieve the records in ISN order
So the records will be read in this order:
1

READ BY ISN :A second method for sequential access is to read in the


order of the ISN
A READ by ISN will retrieve the records in ISN order
The records will be read in this order:
1
2
3
4
5
6...

RBC Induction - Proprietary and Confidential

Logical Order - READ LOGICAL

The third method for sequential access is to read in the order of ISNs of
the Inverted Lists
A READ LOGICAL will retrieve records in the order of listing in one of the
Inverted Lists
A READ LOGICAL by DEPT will be in this order
2 7 17 19 . . . 3 8
11 14 .
.
The third method for sequential access is to read in the order of
ISNs listed in one of the Inverted Lists. A READ LOGICAL will retrieve
records in the
order of listing in one of the Inverted Lists.
A READ LOGICAL by DEPT will be in this order:
2 7 17 19 . . . 3 8
11 14 .
.

RBC Induction - Proprietary and Confidential

RANDOM Approach

Random access is done by using the following commands

FIND
Simple
Complex
Sorted
GET
Using a specific ISN

FIND - Simple
Employee Dataset
Inverted List for DEPT.
+------------------------VALUE COUNT
ISNs
+------+-----+-----------ACCT 30 2,7,17,19...
ADMIN 14 3,8,11,14...
MIS

7 6,10,18,34..
PROD 52 1,4,5,9.....
+-------------------------

If a simple FIND command is given


FIND ALL RECORDS WITH DEPT = ADMIN
the following ISNs would be selected:

+------------------------------

LAST FIRST
ISNEMP. NO NAME NAME DEPT
+---+-------+-------+-----+---- 1 01037 HARRIS JILL PROD
7 15429 BULWARKKEN ACCT
5 66725 GUNNER DOUG PROD
---+-------+-------+-----+---- 3 41180 CONCH TERRY ADMI
6 31622 WU
MATT MIS
4 09331 HOYTE BRIAN PROD
---+-------+-------+-----+---- :
:

: :
3

RBC Induction - Proprietary and Confidential

11

14

FIND - Complex

Complex FINDs involve searching based on more than one descriptor.


Complex FINDs involve more processing.

EXAMPLE:
FIND ALL RECORDS WITH
EMPNO < 50000 AND DEPT = PROD

ISNs where
EMPNO < 50000

ISNs where
DEPT = PROD

:::::::::
:::::::::

:::::::::
:::::::::
:::::::::
:::::::::

A list of the selected ISNs is produced for each search parameter given. The lists are then me
into one list where both conditions are true.

RBC Induction - Proprietary and Confidential

FIND Complex

Inverted List for DEPT.


+------------------------VALUE COUNT
ISN's
+------+-----+-----------ACCT 30 2,7,17,19...
ADMIN 14 3,8,11,14...
MIS

7 6,10,18,34..
PROD 52 1,4,5,9.....
+------------------------Inverted List for EMPNO.
+------------------------VALUE COUNT
ISN's
+------+-----+-----------01037 1
1
09331

15429

31622

41189

Employee Dataset
+------------------------------

LAST FIRST
ISNEMP. NO NAME NAME DEPT
+---+-------+-------+-----+---- 1 01037 HARRIS JILL PROD
7 15429 BULWARKKEN ACCO
5 66725 GUNNER DOUG PROD
---+-------+-------+-----+---- 3 41180 CONCH TERRY ADMI
6 31622 WU
MATT MIS
4 09331 HOYTE BRIAN PROD
---+-------+-------+-----+---- :
:

: :

Which ISN's would be selected by the command:


FIND ALL RECORDS WITH EMPNO < 50000 AND DEPT=PROD

1,4

66752 1
5
+-------------------------

RBC Induction - Proprietary and Confidential

Let's see the ISN's selected by the command ...


FIND ALL RECORDS WITH
EMPNO < 50000 AND
DEPT = PROD.

ISN's with
ISN's with
DEPT = PROD EMPNO < 50000
+---------+ +-----------+
1

1
These 2 lists
4

4
will be
5

7
produced as
9

6
intermediate
:

3
results.
:
+-----------+
+---------+
This final list is a combination of the above two intermediate ISN lists.
+-----+
1
4
+-----+

RBC Induction - Proprietary and Confidential

Inverted List for Color


+----------------------------- VALUE COUNT ISN's
+--------+-------+------------ BLUE 17 1,3,7,12 ...
GREEN 14 4,5,14,18 ..
MAROON 19 6,8,9,13 ...
ORANGE 2 2,11

Automobile Dataset
+-----------------------------ISN LICENCE MAKE
COLOR ...
+----+-------+-------+-------- 2 MAP 199 FORD
ORANGE
9 BLY 409 DODGE
MAROON
6 MBP 526 HONDA
MAROON
: :
:
:
----+-------+-------+--------Inverted List for Make
11 XOX 000 PONTIAC ORANGE
+----------------------------- 3 LNC 128 CHEVY BLUE
VALUE COUNT ISN's
1 CHS 710 FORD
BLUE
+--------+-------+------------ : :
:
:
CHEVY 24 3,5,11,13...
----+-------+-------+-------- DODGE 10 9,17,23,28..
4 BDX 205 MERCURY GREEN
FORD 32 1,2,4,12....
7 FMT 931 HONDA
BLUE
HONDA 8 6,7,8,29....
5 SRA 101 OLDS
GREEN
: :
:
:
Which ISN's would be selected by the command:
FIND ALL RECORDS WITH MAKE=FORD AND COLOR=BLUE

RBC Induction - Proprietary and Confidential

Inverted List for Color


+----------------------------- VALUE COUNT
ISN's
+--------+-------+------------ BLUE

17 1,3,7,12 ...
GREEN
14 4,5,14,18 ..
MAROON
19 6,8,9,13 ...
ORANGE
2 2,11
Inverted List for Make
+----------------------------- VALUE COUNT
ISN's
+--------+-------+------------ CHEVY
24 3,5,11,13...
DODGE
10 9,17,23,28..
FORD

32 1,2,4,12....
HONDA
8 6,7,8,29....

+------------------------+
To determine the
selected ISN's, pick

the ISN's where

COLOR = BLUE then

pick the ISN's where

MAKE = FORD .

+------------------------+
--------------------------The ISNs that match in
these 2 lists are 1 and 12
---------------------------

Which ISN's would be selected by the command:


FIND ALL RECORDS WITH MAKE=FORD AND COLOR=BLUE

RBC Induction - Proprietary and Confidential

RANDOM Approach

A simple FIND involves little processing or I/O


A complex FIND takes much more processing and I/O since intermediate steps are involved
A FIND with SORT is very expensive command using even more processing and I/O
Eg:
FIND ALL RECORDS WITH COLOR > GREEN SORTED BY LICENSE
FIND - with SORT
Inverted List for Color
+----------------------------- VALUE COUNT
ISNs
+--------+-------+------------ BLUE

17 1,3,7,12 ...
GREEN
14 4,5,14,18 ..
MAROON
19 6,8,9,13 ...
ORANGE
2 2,11

FIND ALL RECORDS WITH COLOR = MAROON


SORTED BY MAKE in desc.
will first select all the ISNs where
COLOR = MAROON.

Inverted List for Make


+--------------------------------+
+----------------------------- Then a search through the MAKE
VALUE COUNT
ISNs
inverted list will find any

+--------+-------+------------ matches.

CHEVY
24 3,5,11,13...
+--------------------------------+
DODGE
10 9,17,23,28..
_________________________________
FORD

32 1,2,4,12....
HONDA
8 6,7,8,29.... The final list of ISNs produced would be:
13

RBC Induction - Proprietary and Confidential

GET

GET using specific ISN is the last method for accessing ADABAS records in
random order
This can be used to access specific records where the ISN is already known
In some ADABAS data bases the ISNs are given extra meaning.

- Using a specific ISN

For example: The ISNs could be used as the 5-digit employee number in a
Personnel data base. Then instead of using a command like
FIND ALL RECORDS WITH EMPNO = 23845
you could use a command like
GET ISN 23845 .

By setting up the data base this way, disk space is saved. (One field is
saved in the dataset)
By using the GET command instead of a FIND, processing time and I/O will
be saved

RBC Induction - Proprietary and Confidential

ADABAS Accessing

Apart from the above ADABAS has other access command like

UPDATE
DELETE
ADD

ADABAS can be accessed with the following access facilities

DIRECT CALLS
ADABAS SQL
NATURAL
ADAPREP

RBC Induction - Proprietary and Confidential

ADABAS Accessing

DIRECT CALLS
The Direct Calls from application programs use 2 character codes for commands
Here are some commands used in direct calls
S1
L2
L3
N1
E1

FIND
READ PHYSICAL
READ LOGICAL
ADD A NEW RECORD
DELETE A RECORD

Using direct calls is like programming in a low-level language.


With each command, control blocks and buffers must all be identified
Because of the detail involved, direct calls are rarely used. Occasionally a
Systems Programmer may use direct calls for some special purpose
ADABAS SQL
ADABAS SQL contains a subset of standard SQL, as well as extensions which are
not available within standard SQL.
ADABAS SQL relieves the user from having to define the data base's data areas
manually, and takes over data transfer to the program data areas automatically.

RBC Induction - Proprietary and Confidential

ADABAS Accessing

NATURAL
NATURAL is a powerful application programming language that is designed
for accessing ADABAS data bases.
NATURAL commands are easy to understand and use. Here are some
examples
FIND
GET
READ

UPDATE
DELETE

NATURAL programs can be either batch or on-line.


NATURAL can also be used for simple ad-hoc inquiries, for reports, and for
complex programs updating, deleting and adding records.
Programmers can save many lines of code using NATURAL instead of PL/I or
COBOL with ADABAS SQL or direct calls.
NATURAL has automatic error handling built-in, and includes a user-friendly
development environment.
A command to find ISNs that match certain criteria can be done in NATURAL,
ADABAS SQL, or by direct calls.
NATURAL takes about 1 line of code.
ADABAS SQL takes about 10 lines of code.
Direct Calls take about 25 lines of code.

RBC Induction - Proprietary and Confidential

Learning Objective

In this module you have learnt:


_ Sequential access logic
_ Random access logic
_ Direct Calls
_ ADBAS SQL
_ NATURAL

RBC Induction - Proprietary and Confidential

MODULE - 6

Data Protection
Security

RBC Induction - Proprietary and Confidential

Data Protection

Data protection must be built into a Data Base Management System to


ensure that the data base retains its integrity.

Let's examine a situation where data integrity could easily be lost.


When preparing a packing slip on-line for items to be sent to a customer, the
customer record is accessed and many item records are accessed and
updated

Packing Slip Transaction

____________________________
1. Read customer record

The packing slip transaction


is only meaningful when all
four physical transactions
take place.

2. Access item A record,


update inventory level
3. Access item B record,
update inventory level

This group of transactions is


referred to as one logical
transaction.

4. Access item C record,


update inventory level
__________________________________
Data Integrity loses If this logical transaction is not updated in database then

RBC Induction - Proprietary and Confidential

ET - END Transaction

An "End-Transaction" or "ET" statement is used with ADABAS to indicate


the end of a logical transaction.
One application program may involve several logical transactions
ET - How it takes place

+------------------------------------------------------+
As a logical transaction proceeds, changes are being
made in the data base and in the work dataset.

+------------------------------------------------------+
+-------------+--------+

Logical
FIND

Transaction

+------------- UPDATE ---------


Change in data base

ADD
---------
Change in data base

DELETE ---------
Change in data base

FIND

UPDATE ---------
Change in data base

ET
---------
Make all changes
+--------+
permanent.
RBC Induction - Proprietary and Confidential

ET - How it takes place

What would the effect be on the transaction if an ET did NOT occur?


This situation may occur when:

An operator does not complete entering a transaction.


A machine failure occurs.

BT - Back-out Transaction
If an operator leaves part-way through a transaction, ADABAS will back-out
the transaction (BT)
----------------------------------------------------------------+-------------

Logical

Transaction

+------------------+
+------------- FIND

Back to original
______________

state of the

UPDATE
data base.

+------------------+
ADD

+---------------------+
- Operator leaves -
+---------------------+
+------------------+
______________ _______

BT

+--------+
+------------------+
When the operator returns, the operator is informed that he/she was
backed-out
RBC Induction - Proprietary and Confidential

BT - Back-out Transaction

If a machine failure occurs, the back-out (BT) occurs automatically when


the database is brought up again
When records are being updated the record is "held". This means that no
other program can access that record for updating.(Use of this "hold" logic
ensures accurate data integrity)
The third situation is when the transaction time limit is exceeded. If two
programs request records that are being held by each other, a deadlock
situation will occur.
When the transaction time limit is reached, the transaction will be backed
out
A transaction may be backed out for one of three reasons we've discussed.

Machine failure
Non-activity time limit
Transaction time limit

RBC Induction - Proprietary and Confidential

PREDICT - Data Dictionary

ADABAS has a data dictionary called ....


PREDICT
+--------------------------------------------------------------+
The dictionary maintains information about
the data base, its datasets and fields.

+--------------------------------------------------------------+
+--------------------------------------------------------+
Details kept about the fields include:

_ name

_ format

_ length

_ descriptor status

_ repeating group information

_ compression

+--------------------------------------------------------+

RBC Induction - Proprietary and Confidential

What is the use of Data Dictionary

When a data base is first loaded, the elements of the datasets must be
defined indicating the characteristics of each field.

COBOL programs use the WORKING-STORAGE SECTION of the COBOL program


to define variables used in the program.
PL/I programs have DCL (declare) statements to define variables used in the
programs.
NATURAL programs use Data Definition Modules (DDMs) to define their variables.

The data dictionary is used to store the definitions for the variables that
will be used in the COBOL, PL/I or NATURAL programs
PREDICT can also be used to create reports cross-referencing fields,
datasets and programs

RBC Induction - Proprietary and Confidential

Data Security

ADABAS can provide security at many levels:

Dataset Level
Field Level
Security by Value in Field
Ciphered Datasets

All security is kept by a password system. Passwords are assigned to


individuals or groups, and the password is associated with a certain
security level.

RBC Induction - Proprietary and Confidential

The DBA sets the security level of each group of users of


the data base. The levels of access and update privileges
range from 0 (low) to 14 (high).

+---------------------------------------------------------------------------+

ACCESS/UPDATE LEVELS

--------------------------------------------------------

EMPLOYEE PROJECT AUTOMOBILE


NAME
PASSWORD DATASET DATASET DATASET

-----------+----------+----------+---------+---------------------------------------------------
J. BROWN HAT
14/8
14/8
10/5
----+
S. STEELE STOL
10/6
10/5
14/9

+-------------------------------------------------------------+
+----------------------------------------------+
+----------------------------------------------+
Sam Steele has access level

From this table, what are Joan

10 for the employee dataset. He +--+ Brown's access and update levels
has level 6 update privileges

for the automobile dataset?

on this file.

+----------------------------------------------+

Access

Update

+---------------------------------------------------+

RBC Induction - Proprietary and Confidential

Learning Objective

In this module you have learnt:


_ Data Protection procedures
_ Data Dictionary features
_ Security features

RBC Induction - Proprietary and Confidential

MODULE - 7

ADABAS
NUCLEUS

RBC Induction - Proprietary and Confidential

ADABAS Nucleus

For each ADABAS database there an ADABAS nucleus which resides in its
own partition and responsible for all database requests by application
programs
It handles control of concurrent access and update (online transactions),
buffering of database records, back out and recovery in case of system
crashes
ADABAS Buffers
ADABAS maintains following buffers while accessing the database
CONTROL BLOCK
SEARCH-BUFFER
VALUE-BUFFER
FORMAT-BUFFER
RECORD-BUFFER
ISN-BUFFER

RBC Induction - Proprietary and Confidential

ADABAS Buffers

CONTROL BLOCK

SEARCH BUFFER

List of the fields one wants to retrieve


Can be specified in any order
(independent of physical location)

RECORD BUFFER

Contains descriptor names used for search criteria


Value supplied dynamically for complex search

FORMAT BUFFER

Contains the names of the descriptors by which the search is made along with
the search criteria

VALUE BUFFER

Contains Command-ID
Database and File-IDs
Return codes

After retrieving the record the data values of the requested fields are kept here
Arranged in the order as specified in FORMAT buffer

ISN BUFFER

List of the ISNs resulting from a successful FIND operation

RBC Induction - Proprietary and Confidential

ADABAS UTILITES

ADASAV
A utility to dump database datasets onto tape or disk and retrieve them again.

ADARES
A utility to reapply or remove updates to the database using the protection log
facility.

ADACMP
A utility to compress and decompress the datasets.

ADALOD
A utility to load compressed data into database.

ADAULD
A utility to unload data from database to a dataset .

ADAORD
This utility has many options:
Reorder the Associator for 1 or more datasets
Reorder data storage for 1 or more datasets
Unload 1 or more datasets for relocation to another device.

RBC Induction - Proprietary and Confidential

ADABAS UTILITIES

ADADBS
To modify the characteristics of an ADABAS dataset, ADADBS may be used. Here
are some:
Delete a dataset
Recover unused space in the data base
Increase the size of a data base
Rename or renumber datasets
Change the length of a field
Add new fields to the dataset
Release a field from being a descriptor

ADAINV
The INVERT function of ADAINV creates a descriptor, sub descriptor, super
descriptor, hyper descriptor, phonetic descriptor.
ADAREP
Which datasets are in database
The size of each dataset
Physical space usage
Field definition table information

RBC Induction - Proprietary and Confidential

NATURAL

NATURAL is a proprietary programming language developed and marketed by


Software AG
Applications developed using NATURAL are modular, which contributes to its success
as a tool for Rapid Application Development
A NATURAL program can execute in either batch or on-line mode, with full access to
database files.
In online mode, NATURAL programs can process user input in real-time.
In batch mode, NATURAL programs can read and write sequential (i.e. nondatabase) files.

RBC Induction - Proprietary and Confidential

101

DESCRIPTION OF NATURAL STATEMENTS

Data Definition
Data Access
Data Manipulation
Data Modification
Data Reporting
Loop Execution Statements
Screen Statements
Logical Check Statements
Routine Invoking Statements
File Control Statements

RBC Induction - Proprietary and Confidential

102

NATURAL STATEMENTS

DEFINE DATA

.. END-DEFINE

This statement along with its closing structure END-DEFINE explicitly


defines the data area.
It must be the first statement in a program.
Only comment lines can be placed before DEFINE DATA statement.
All fields (Database fields as well as user-defined variables) are defined in
this statement
The fields can be defined either inside the defined data segment or
outside. When it is defined out side it is defined in
1.Local data area LDA
2.Global data area GDA
3.Paramater data area PDA

RBC Induction - Proprietary and Confidential

103

NATURAL STATEMENTS

1.Local data area LDA


A local data area (LDA) defines data that becomes local to any module
that uses the LDA.
2.Global data area GDA
The term global data describes data that occupies space outside of
any executable module. Programs and external subroutines (including any
in-line subroutines within them) have direct access to global data, whereas
subprograms and help routines (including any in-line subroutines within
them) do not.
3. Parameter data area PDA.
The term parameter data describes data that is passed between a
subprogram and the calling module.

RBC Induction - Proprietary and Confidential

104

USER-DEFINED VARIABLES

Format

Maximum length

A = Alphanumeric

1-253

N = Numeric

1-29 (default = 7)

P = Packed Numeric

1-29 (default = 7)

I = Integer

1 or 2 or 4

B = Binary

1-126

C = Attribute Control

D = Date

6 (stored in 4 bytes)

T = Time

12 (stored in 7 bytes)

F = Floating point

4 or 8

L = Logical

RBC Induction - Proprietary and Confidential

105

USER-DEFINED VARIABLES

Variables Initialization:
The default initial value for various formats is
B,F,I,N,P
0
A
Blank
L
F(alse)
D
D''
T
T'00:00:00'
C
(AD=D)
Used within the DEFINE DATA statement to indicate the structure and grouping of the
definitions.
Relevant to view definitions, redefinition's and field groups.
Range from 1 to 9.
Generally, variable definitions are on level 1.
The level numbering in view definitions, redefinitions, and groups must be sequential.
No level numbers may be skipped.
If you redefine a field, the REDEFINE option must be on the same level as the original
field, and the fields resulting from the redefinition must be one level lower.

RBC Induction - Proprietary and Confidential

106

Group Fields

DEFINE DATA LOCAL


1 #FIELDA (N2.2)
1 #FIELDB (I4)
1 #GEMP
2 #EMPNO
(N5)
2 #BIRTH
(D)
2 #EMPADDR (A10)
1 #FIELDF (A2)
.
END-DEFINE
Used within the DEFINE DATA statement to indicate the structure and grouping of the
definitions.
Relevant to view definitions, redefinition's and field groups.
Range from 1 to 9.
Generally, variable definitions are on level 1.
The level numbering in view definitions, redefinitions, and groups must be sequential.
No level numbers may be skipped.
If you redefine a field, the REDEFINE option must be on the same level as the original
field, and the fields resulting from the redefinition must be one level lower.

RBC Induction - Proprietary and Confidential

107

Group Fields

The fields #EMPNO, #BIRTH, EMPADDR are defined under the common group name
#GEMP. #GEMP only serves as a group name and is not a field in its own and
therefore does not have a format/length definition

ARRAYS
Single dimensional array
DEFINE DATA LOCAL
1 #ARRAY (A10/1:3)
END-DEFINE
Multi dimensional array
DEFINE DATA LOCAL
1 #ARRAY (A10/1:3,1:4)
END-DEFINE

RBC Induction - Proprietary and Confidential

108

DATABASE VIEWS

DDM (Data Definition Module).


For Natural to be able to access a database file, a logical definition of the
physical database file is required. Such a logical file definition is called a
DDM (data definition module). A DDM contains the database-internal field
name (which is a two letter mnemonic) as well as the "external" field name
(English like names).

RBC Induction - Proprietary and Confidential

109

DATA ACCESS / MODIFICATION STATEMENTS

Various Statements used with Natural:


READ
FIND
GET
HISTOGRAM
STORE
UPDATE
DELETE
READ
READ is used to retrieve records from a database sequentially. READ & END-READ defines the
top & bottom of loop respectively
Read physical
In the order in which they are physically stored in the database
Read logical==> preferred
In the order of the values of a descriptor field
Read by ISN
In the order of Adabas Internal Sequence Numbers

RBC Induction - Proprietary and Confidential

110

READ

** Example 'READX01': READ


*******************************************************************
****
DEFINE DATA LOCAL
1 MYVIEW VIEW OF EMPLOYEES
2 NAME
2 PERSONNEL-ID
2 JOB-TITLE
END-DEFINE
*
READ (6) MYVIEW BY NAME
DISPLAY NAME PERSONNEL-ID JOB-TITLE
END-READ
END

RBC Induction - Proprietary and Confidential

111

FIND

The FIND statement is used to select a set of records from the database based on a
search criterion consisting of fields defined as descriptors (keys). Various relational
operators like (EQ, GT, LT, LE, GE, NE) or (=, >, >=, <, <=, =) are used along with
clause to filter the records
************************************************************************
DEFINE DATA LOCAL
1 MYVIEW VIEW OF EMPLOYEES
2 PERSONNEL-ID
2 NAME
2 JOB-TITLE
2 CITY
END-DEFINE
*
FIND MYVIEW WITH CITY = 'PARIS'
WHERE JOB-TITLE = 'INGENIEUR COMMERCIAL'
DISPLAY NOTITLE CITY JOB-TITLE PERSONNEL-ID NAME
END-FIND
END

RBC Induction - Proprietary and Confidential

112

GET

A GET statement presents a single record for processing when the ISN is
known. Unlike READ and FIND, there is no associated processing loop
DEFINE DATA LOCAL
1 EMPLOY-VIEW VIEW OF EMPLOYEES
2 NAME
2 SALARY (1)
END-DEFINE
*
RD. READ EMPLOY-VIEW BY NAME
DISPLAY EMPLOY-VIEW
IF SALARY (1) > 1500000
/*
GE. GET EMPLOY-VIEW *ISN (RD.)
/*
WRITE '=' (50) 'RECORD IN HOLD:' *ISN(RD.)
COMPUTE SALARY (1) = SALARY (1) * 1.15
UPDATE (GE.)

RBC Induction - Proprietary and Confidential

113

STORE

STORE inserts/adds one record to a database file. One has to


populate the data fields with relevant values of the record before
STORing it with the file.
DEFINE DATALOCAL
1 #CLIENT-ID (N8)
1 #CNAME (A20)
1 RECEVIEW VIEW OF RECEIVABLE
2 CLIENT-ID
2 CNAME
END-DEFINE
INPUT #CLIENT-ID #CNAME
RECEVIEW .CLIENT-ID := #CLIENT-ID
RECEVIEW .CNAME := #CNAME
STORE RECEVIEW
END TRANSACTION

RBC Induction - Proprietary and Confidential

114

UPDATE

UPDATE modifies one existing record with a database file. One has to select
the particular record by using READ/FIND/GET statement before updating
the record. If we READ/FIND a number of records before UPDATing one
particular record, then all the records selected by READ/FIND get locked. To
avoid this, GET can be used to select the record we want to update so that,
only that record gets locked.

Example
DEFINE DATA
1 RECEVIEW VIEW OF RECEIVABLE
2 SALARY
END-DEFINE
RD1.
READ RECEVIEW WHERE SALARY GT 10000
IF SALARY EQ 14900
GET-REC.
GET *ISN(RD1.)
ADD 100 TO RECEVIEW .SALARY
UPDATE (GET-REC.)
END-IF
END TRANSACTION
END

RBC Induction - Proprietary and Confidential

115

DELETE

DELETE physically removes records from a database file. Before deleting


the particular record, one has to select the record by using READ/FIND/GET
statement.
DEFINE DATA
1 RECEVIEW VIEW OF RECEIVABLE
2 ACTIVE
END-DEFINE
GET-REC.
READ RECEVIEW WHERE ACTIVE=FALSE
DELETE (GET-REC.)
END TRANSACTION
END

RBC Induction - Proprietary and Confidential

116

HISTOGRAM

The HISTOGRAM statement is used to either read only the values of one
database field, or determine the number of records which meet a specified
search criterion.

DEFINE DATA LOCAL


1 MYVIEW VIEW OF EMPLOYEES
2 CITY
END-DEFINE
*
LIMIT 8
HISTOGRAM MYVIEW CITY STARTING FROM 'M'
DISPLAY NOTITLE CITY 'NUMBER OF/PERSONS' *NUMBER *COUNTER
END-HISTOGRAM
END
RESULT:
CITY
NUMBER OF PERSONS CNT

---------------------------------------
MADISON
3
1

MADRID
41
2

MAILLY LE CAMP
1
3

MAMERS
1
4

MANSFIELD
4
5

RBC Induction - Proprietary and Confidential

117

Data Definition Module

09:05:06
User M6919
DDM DBID 0

***** NATURAL LIST COMMAND *****


- List DDM SHIPMENT DDM FNR 66

VSAM Name

2001-11-08
Library SYSTEM

Default Sequence

Page

T L DB Name
F Leng S D Remarks
- - -- -------------------------------- - ---- - - -----------------------G 1 JK SH-SHIPMENT-KEYS
CONTAINS THE 4 BASIC
2 BK SH-BOOKING-NO
A
9 N D S/L ASSIGNED RESERVA
2 ZP SH-FILLER-31
A
1 N
2 BL SH-BILL-NO-SHIPMENT-COUNT
N 12.0 N D CONTAINS BILL OF LAD
2 CN SH-CONTAINER-NO
A
10 N D IDENTIFIER OF A CONT
2 JG SH-SHIP-NO
A
12 N D UNIQUE IDENTIFIER OF
2 OU EQP-CHK-DGT
A
1 N
ONE BYTE DIGIT DERIV
P 1 QE SH-VVD-DEPENDENT-INFO
CONTAINS INFO SPECIF
2 OP SH-OP-VVD-POL-POD
A
68 N
COMPOSITE FIELD ON S
G 1 JL SH-SELECTION-GROUP
DENOTES FIELDS THAT
2 RQ REQ-EQUIP-LTL-CANC
A
19 N
COMPOSITE FIELD ON S
2 ZQ SH-FILLER-32
A
1 N
2 DS SH-DEST-ORIGIN-AROT
A
55 N
COMPOSITIE FIELD ON
Top of List.
Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--Help Print Exit Long
-+
++
Canc

RBC Induction - Proprietary and Confidential

Data Definition Module

T L DB Name F Leng S D Remarks

T
L
DB
Name
F
Leng
S
D
Remarks

- Type (Group, MU,PE )


- Level
- 2 byte ADABAS field name
- Field name
- Data format
- Length of the field
- Storage compression type
- Descriptor usage
- Field comments

RBC Induction - Proprietary and Confidential

NATURAL SCREEN PRINTS SAMPLE

Natural screen
prints sample

RBC Induction - Proprietary and Confidential

120

THE END

RBC Induction - Proprietary and Confidential

Vous aimerez peut-être aussi