Académique Documents
Professionnel Documents
Culture Documents
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
MODULE - 1
Database
Concepts
Database Concepts
Database Goals
Database Goals
Database Goals
Database Goals
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.
Database Goals
Database Goals
INCREASE INDEPENDENCE
REDUCE REDUNDANCY
MAINTAIN DATA INTEGRITY
INCREASE DATA SECURITY
Types of Databases
HIERARCHICAL
NETWORK
RELATIONAL
Database Types
HIERARCHICAL Database
STUDENT
REGISTARTION
COURSES
DEGREES
COMMENTS
HIGH SCHOOL
REPORTS
Database Types
HIERARCHICAL Database
In a Hierarchical database
Database Types
NETWORK Database
COMPANY
BUILDING
VEHICLE
CLUB
PERSON
Database Types
NETWORK Database
In a network database structure . . .
Database Types
RELATIONAL Database
SSN #
DOB
Key Field
DEPT
Sex
DEPT
Dept
Name
Employee
Record
Designatio
n
Timing
s
DEPT Record
Database Types
ADABAS Database
Which type of data base management system do you think ADABAS is
closest to?
RELATIONAL
MODULE - 2
ADABAS Overview
ADABAS - Overview
Its legendary reliability in combination with its low cost of ownership makes it a firstchoice database for any mission-critical business application
Built-in utilities
Distributed computing
Web support
Administration
ADABAS - Overview
Adabas is available for a wide range of platforms, including Windows NT, UNIX, Open
VMS and mainframe.
Access to Adabas
Bolero, Software AGs application factory, and from every 3GL and 4GL that is
equipped with a call interface.
ADABAS Overview
ADABAS Overview
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
Features of ADABAS
ADABAS
Database Overview
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
COLOR
BLACK
RED
RED
BLACK
BLUE
RED
Database Overview
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
..
..
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
..
..
Database Overview
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..
..
..
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
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.
fields
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.
ADABAS 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
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
Learning Objective
_
_
_
_
MODULE - 3
ADABAS Architecture
ADABAS Database
Associator
Work
Data
ADABAS
Database
Associator
Work
Data
Operating System
ADABAS Nucleus
MPM
Application 1
Application 2
ASSOCIATOR
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.
Address Converter
To understand how the Address Converter works, we need to know how the
data records are organized
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
:
COLOR
ORANGE
MAROON
MAROON
:
ORANGE
BLUE
BLUE
:
GREEN
BLUE
GREEN
:
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
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
Work
Data
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
After knowing the ADABAS environment , lets see the organization of data
in the database
We will look at
Datasets
Records
Fields
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
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
87%
MU/PE Fields
When you have user views that relate directly to one of the other user views in a
one-to-many relationship
Learning Objective
MODULE - 4
Fields
&
Descriptors
Data Organization
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:
The information about each field in the database is kept in the FDT (Field
Definition Table)
Sample information of FDT looks like ...
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
A
A
P
16
16
10
DATA Compression
----
Data Compression
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.
in them have a
length byte
added.
================================================================================
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
+-------------------+
DATA Compression
DATA Compression
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).
DATA Compression
DATA Compression
6JERRYC 086
4424C
The count indicates 4 empty fields
Default compression saves 50%
NU compression saves 75%
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.
Super Descriptor
In an employee data base, a search using "LAST NAME" will not always find a
unique record
Sub Descriptor
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
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.
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.
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:
Learning Objective
MODULE - 5
Accessing
ADABAS
ADABAS Constraints
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
Simple Find
Sorted Find
Complex Find
Getting by ISN
SEQUENTIAL Approach
READ PHYSICAL
In this method sequential access is to read in the physical order that the records
are stored
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,.
Employee Dataset
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.
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
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
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 .
.
RANDOM Approach
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.....
+-------------------------
+------------------------------
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
11
14
FIND - Complex
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.
FIND Complex
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
---+-------+-------+-----+---- :
:
: :
1,4
66752 1
5
+-------------------------
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
+-----+
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
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
MAKE = FORD .
+------------------------+
--------------------------The ISNs that match in
these 2 lists are 1 and 12
---------------------------
RANDOM Approach
17 1,3,7,12 ...
GREEN
14 4,5,14,18 ..
MAROON
19 6,8,9,13 ...
ORANGE
2 2,11
+--------+-------+------------ 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
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.
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
ADABAS Accessing
Apart from the above ADABAS has other access command like
UPDATE
DELETE
ADD
DIRECT CALLS
ADABAS SQL
NATURAL
ADAPREP
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
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
Learning Objective
MODULE - 6
Data Protection
Security
Data Protection
____________________________
1. Read customer record
ET - END Transaction
+------------------------------------------------------+
As a logical transaction proceeds, changes are being
made in the data base and in the work dataset.
+------------------------------------------------------+
+-------------+--------+
Logical
FIND
Transaction
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
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
Machine failure
Non-activity time limit
Transaction time limit
+--------------------------------------------------------------+
+--------------------------------------------------------+
Details kept about the fields include:
_ name
_ format
_ length
_ descriptor status
_ compression
+--------------------------------------------------------+
When a data base is first loaded, the elements of the datasets must be
defined indicating the characteristics of each field.
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
Data Security
Dataset Level
Field Level
Security by Value in Field
Ciphered Datasets
+---------------------------------------------------------------------------+
ACCESS/UPDATE LEVELS
--------------------------------------------------------
-----------+----------+----------+---------+---------------------------------------------------
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
on this file.
+----------------------------------------------+
Access
Update
+---------------------------------------------------+
Learning Objective
MODULE - 7
ADABAS
NUCLEUS
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
ADABAS Buffers
CONTROL BLOCK
SEARCH BUFFER
RECORD BUFFER
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
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.
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
NATURAL
101
Data Definition
Data Access
Data Manipulation
Data Modification
Data Reporting
Loop Execution Statements
Screen Statements
Logical Check Statements
Routine Invoking Statements
File Control Statements
102
NATURAL STATEMENTS
DEFINE DATA
.. END-DEFINE
103
NATURAL STATEMENTS
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
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.
106
Group Fields
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
108
DATABASE VIEWS
109
110
READ
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
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.)
113
STORE
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
115
DELETE
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.
---------------------------------------
MADISON
3
1
MADRID
41
2
MAILLY LE CAMP
1
3
MAMERS
1
4
MANSFIELD
4
5
117
09:05:06
User M6919
DDM DBID 0
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
T
L
DB
Name
F
Leng
S
D
Remarks
Natural screen
prints sample
120
THE END