Datacom and Dataquery

Download Report

Transcript Datacom and Dataquery

Datacom
An Introduction
What is Datacom?
Datacom is a Database Manager developed by
Computer Associates for MVS
 Data is stored in the form of databases, which can
have one or more keys
 Access is through ‘embedded” datacom calls in
high level languages, or through dataquery

Datacom
This is NOT a Relational Database Manager or
even a sophisticated database manager
 This is a filing system, for better organization of
data
 It has the basic features of a filing system - keys,
indexes etc.
 It has locking features, to prevent “lost updates”
 It does not have features such as referential
integrity

Databases
Databases are known by a user name
E.g. FED-PROFILE

Internally, in the system, they are referred to by a
3 character id
E.g. F11


It is important to remember the 3-character ID that is how datacom knows this database
Database structure
Each database consists of records (Rows)
 Each Record has Fields (Columns)

One or more fields can combine in several ways to
form several keys
 There is no concept of a primary key or alternate
keys - all keys are “on par”

Datacom with COBOL
The structure (definition) of the databases used
must be declared in the program
 This is done by a “COPYDD” statement, which
“embeds” a COBOL declaration of the database
structure
 The embedded item may be a view, defined with a
particular structure, and a key, for a specific
purpose

COPYDD

The COPYDD statement looks like
01 A01A0
COPYDD
COMPANY.A01A0(PROD),2,N.
The first item is the required level of the structure
 The next item is the group name


If this is left blank, the default name is taken

Then next is the dataview to be used

A pattern can be given here, to prefix all elements
01 *R2
COPYDD
FED-PROFILE.A13A0(PROD),2,N.
In this case, all elements will have a R2- prefix
Passing values

The next step is to fill up the desired values to the
call interface

The interface consists of
User ID
 Request area
 The “embedded” structure
 The element list

Calling interface

The user id is either the ID of the User, or that of
the program ID


These Ids need to be authorized by the database
Admin, for accessing this database
The request area contains
The command name (Commands are in a later slide)
 The name of the file - 3 characters
 The name of the KEY used
 The value(s) of the LOW key (mandatory), and High key
(if applicable)

The DB Call

The database access call is in the form of the
following command
CALL ‘DBNTRY’ USING USER-ID
F11-REQ-AREA
F11F0
F11-ELEMENT-LIST
An example
Declaration
01 USER-ID.
05 PROGRAM-NAME
05 FILLER
PIC X(08) VALUE 'ICS3000 '.
PIC X(24) VALUE SPACES.
01 A20-REQ-AREA.
05
05
05
05
05
05
05
A20-REQ-COMMAND
A20-REQ-FILENAME
A20-REQ-KEYNAME
A20-REQ-RETURNCD
A20-REQ-DBID
A20-REQ-REC-ID
A20-REQ-KEY-VALUE
PIC X(05) VALUE SPACES.
PIC X(03) VALUE 'A20'.
PIC X(05) VALUE SPACES.
PIC X(02) VALUE SPACES.
PIC X(02) VALUE SPACES.
PIC X(07).
PIC X(180).
Declaration
01 A20-WORK-AREA.
05 A20-WORK-AREA-0
05 A20-WORK-AREA-6
PIC X(274).
PIC X(300).
01 A20-ELEMENT-LIST.
05
05
05
05
05
A20-ELM-1
FILLER
A20-ELM-2
FILLER
FILLER
PIC X(05) VALUE 'A20A0'.
PIC X(01).
PIC X(05) VALUE 'A20A6'.
PIC X(01).
PIC X(05) VALUE SPACES.
Declaration
01 A20A0-A20A6.
03 A20A0 COPYDD BRANCH.A20A0(PROD),2,N.
03 A20A6 COPYDD BRANCH.A20A6(PROD),2,N.
01 *BILL-
COPYDD BRANCH.A20A0(PROD),2,N.
Assigning values
MOVE WS-NEXT-KBRANCHCD
MOVE 'BRNCH’
MOVE 'REDKY’
MOVE A20-REQ-AREA
TO A20-REQ-KEY-VALUE.
TO A20-REQ-KEYNAME.
TO A20-REQ-COMMAND.
TO LKBO099-DB-REQ-AREA.
Here, the command name is “REDKY” - read key exact
The keyname used is BRNCH, and the value of the key comes from
the WORKING-STORAGE variable
The DB Call
CALL 'DBNTRY’ USING
USER-ID
A20-REQ-AREA
A20-WORK-AREA
A20-ELEMENT-LIST.
Thus the data required for the DB call is filled up,
and the database access is completed.
Datacom Commands
Command
ABEND
ADDIT
CLOSE
CNTKR
CNTKY
CNTTB
COMIT
Description
Abnormal Termination Command
Add Record
Close User Requirements Table
Count For Key Value Range
Count For Equal Key Value
Count For Table
Commit Transaction
Datacom Commands
Command
DELET
GETIT
GETPS
GSETL
GSETP
INQIN
Description
Delete Record
Retrieve Next Sequential Record
Get Next Physical Sequential Record
Set To Starting Key
Set Physical Sequential Record
Inquire CA
Datacom Commands
Command
LOCBR
LOCKG
LOCKI
LOCKL
LOCKR
LOCKX
LOCKY
Description
Locate Backwards
Locate Key Equal Or Higher
Test For Logical Intersections Of Two
Keys
Locate Key Equal Or Lower
Locate a Record in a Specified Range
Locate Key Exact
Locate Key Equal Or Higher
Datacom Commands
Command
LOCNE
LOCNK
LOCNR
LOCNX
LOGCP
LOGCR
LOGDR
LOGDW
Description
Locate Next Equal Key Value
Locate Next Key
Locate Next Record in Specified Range
Locate Next
Checkpoint the Task
Log Checkpoint With Release
Log Directed Read
Log Directed Write
Datacom Commands
Command
LOGIT
LOGLB
LOGTB
NOOPS
OPEN
Description
Add Data To Log Area
Read Back a LOGIT Record
Back Out Transactions
No Operation
Open User Requirements Table
Datacom Commands
Command
REDBR/RDUBR
REDID/RDUID
REDKG/RDUKG
REDKL/RDUKL
REDKR/RDUKR
Description
Read Backwards
Read Record By Id
Read Record Greater Than /
EqualTo Key
Read Record Less Than /
Equal To Key
Read Record in a Specified
Range
Datacom Commands
Command
REDKX/RDUKX
REDKY/RDUKY
REDLE/RDULE
REDNE/RDUNE
REDNK/RDUNK
REDNR/RDUNR
Description
Read Key Exact
Read Key Exact
Read Located Entry
Read Next Equal Key Value
Read Record With the Next
Sequential Key Value
Read the Next Record in a
Specified Range
Datacom Commands
Command
REDNX/RDUNX
RELES
RELFL
ROLBK
SELCN
SELFR
SELNR
Description
Read Next
Release Record
Release Table
Rollback Transaction
Continue Set Record Selection
Select Set And Return First
Record
Select Next Record
Datacom Commands
Command
SELPR
SELSM
SELST
TEST
UPDAT
Description
Release Set
Select Same Record
Stop Set Record Selection
Test Option Command
Update Record
Dataquery
What is Dataquery?
Dataquery is a query tool to access the contents
of the databases directly
 It uses a language called dataquery language
(DQL)
 Structured Query Language (SQL) is also
supported.

Dataquery
Dataquery runs as an application under CICS
 It has a menu-driven interface
 It allows creating / modifying queries, viewing
public queries etc.
 It also allows query execution in batch, by setting
up a JCL header and an environment

Components

The components of a query are
The VERB (FIND, ERASE etc.)
 The Database / dataview name
 The condition(s) (WHERE clause)
 The columns to be included in the output, with column
titles if required
 The title for the overall query

Query creation /
execution
You can create a new query / edit an existing
query
 The query editor will show up
 You can enter the qurery data and press PF4 to
save it
 It you are editing an existing query, press PF9 to
save it
 PF3 is for execution, PF2 is EXIT

An Example
FIND AGY-DISB-MTHD-2 WHERE N-A-CODE-SFX
= '3102'
PRINT YEAR N-A-CODE-SFX 'N&A' PROFILE-DISB
'PD'
TITLE “Agency Disbursement Methods”
This query has a database name, condition, fields to
be printed, and headings for those fields.
There is also an overall title for the query results