Datacom Presentation
Datacom Presentation
VIJAYKUMAR.R
Data Areas:
A data area provides the physical storage for data tables. A database can
have multiple data areas. Each data area can support 1 to 240 tables, but
a database is limited to 240 tables as well. Every data area is a data set
or file. You can assign several tables to the same area or each table to a
separate area.Placing multiple tables in the same area can increase
Processing speed when Applications normally access the tables together
with the same key.
Index Area (IXX): The Index Area provides fast access to the data. Each
database contains one Index Area which provides accessibility to all data
areas within that database. The index allows any table in the database to
be retrieved based on the contents of the table. CA-Datacom/DB places
an entry in the index for each key within each table in the database.
Keys: Keys are structures used to optimize data access or order data
Retrieval. A key is composed of columns. The columns can be in any
sequence. Each key can be up to 180 characters long.
You can define up to 99 keys per table or 999 per database. Any key can
be defined as unique, that is, requiring that each row in the table have a
unique value for the key.
All tables must have a Master Key and a Native Key defined. The Master
Key functions as any other key but it can be defined as updateable or non-
updateable. The Native Key dictates the physical sequence in which the
data is stored. The Native Key can be the same as the Master Key.
This option differs from the KEY attribute UNIQUE in the following ways:
DUPE-MASTER-KEY can only be defined through Datadictionary.
UNIQUE can be defined through Datadictionary or SQL.
It may only be specified for one key (the Master Key) per table. UNIQUE
may be specified for any number of keys.
Attempted violations to DUPE-MASTER-KEY receive CA-Datacom/DB
return code 10. Attempted violations to a UNIQUE KEY receive CA-
Datacom/DB return code 94 (internal return code 193).
Dataviews:
Dataviews are special structures used by CA-Ideal and CA-Meta
COBOL+. Dataviews provide a logical view of the data. They can
be composed of elements or keys.
Foreign Keys:
Foreign keys define relationships between tables. The column(s) of a
foreign key in one table are related to the primary or unique key of some
table. Every foreign key is related to a primary or unique key. A primary
or unique key can be related to zero, one, or many foreign keys.
• Single User: The Single User mode allows only one region to
access a database.
When you are backing up a table or area, suspend all update activity
to it.
RAAT:
The record-at-a-time commands access data rows (records) and Index
entries.The rows are selected by specifying a previously defined key name
and a key value.
SAAT:
With the set-at-a-time access technique, a set of records is defined based on the
data values contained in a table. A set can be just one record, or an entire table.
Once a set has been defined, individual records within the set can be accessed.
Records contained in a set are selected by specifying a search condition. A
search condition is a compound Boolean expression composed of predicates
joined by the logical operators AND and OR.
Relational operators used in the search are : EQ, LT, GT, LE, GE, NE
CA-Ideal: CA-Ideal enables you to develop and maintain applications that can
access CA-Datacom/DB databases. CA-Ideal passes CA-Datacom/DB
commands to the CA-Datacom/DB entry point. It uses both record-at-a-time and
set-at-a-time access techniques. CA-Ideal also offers you the option of using
SQL statements within your CA-Ideal programs.
• Use Datadictionary to define the databases, areas, tables, columns, keys and
elements.
• Allocate and initialize the required data areas and Index Areas.
• DATE, TIME, and TIMESTAMP are special SQL data types that
are stored and manipulated in CA-Datacom/DB as binary data
with lengths 4, 3, and 10 respectively.
DATE CCYYMMDD
TIME HHMMSS
TIMESTAMP CCYYMMDDHHMMSSNNNNNN
CC Century
YY Year
MM Month
DD Day
HH Hour
MM Minute
SS Second
NNNNNN Microseconds
Example :
You can specify in the User Requirements Table that CA-Datacom/DB open the
User Requirements Table before control is passed to your program, and close the
User Requirements Table when your program returns control to CA-Datacom/DB.
Alternately, your program can open and close the User Requirements Table itself
by issuing OPEN and CLOSE commands.
//*
//TOC DD DSN=K1C.KFS.K1CSTMTS.K1CTOC2N,
// DISP=SHR
//SPX DD DSN=K1C.KFS.K1CSTMTS.K1CPRT2N,
// DISP=SHR
//*
//LASER DD DSN=K1C.KFS.PRINTW.K1CSTMTL.K1CSTM02,
// DISP=(NEW,CATLG,DELETE),
// UNIT=PRDPK,SPACE=(TRK,(2250,150),RLSE),
// DCB=(RECFM=FBA,LRECL=255,BLKSIZE=0)
//*
Example:
DBURTBL X
ACCESS=RAN, X
AUTODXC=YES, X
BYPOPEN=NO, X
DBID=&POLICY, X
ELMCHG=NO, X
GBMAXR=255, X
GETBLK=15000, X
SEQBUFS=00, X
SYNONYM=NO, X
TBLNAM=AGT, X
UPDATE=NO
EJECT
BYPOPEN=value
Default Value: NO
UPDATE=No means, The program cannot update this table and cannot
hold the rows under exclusive control.
UPDATE=No means, The program can update this table and can hold
the rows under exclusive control.
Example :
DBUREND X
SYSTEM=OS, X
USRINFO=KFBATCH
CSECT
DC CL50'L1ABATU193/03/0111:04:0698/06/16NONE 0000100001'
END
SYNTAX
CALL 'DBNTRY' USING USER-INFO
REQUEST-AREA
Example:
PROCEDURE DIVISION.
ENTRY 'DBMSCBL'.
EJECT
0000-MAINLINE.
Example :
CALL 'DBNTRY' USING AFB-USER-INFO
AFB-REQUEST-AREA
I-AFB-TABLE
AFB-ELEMENT-LIST.
Assembler uses a CALL macro, while PL/I and FORTRAN use a CALL statement.
Using the DBNTRY entry point, provide the appropriate User Information Block, the
Request Area address, the work area address, the element list address, and the
Request Qualification Area address in the call.
• Assembler Format
CALL DBNTRY,(userinfo,reqarea,wrkarea,elmlst,qualarea)
• PL/I Format
CALL DBNTRY(userinfo,reqarea,wrkarea,elmlst,qualarea)
DECLARE DBNTRY ENTRY OPTIONS(ASSEMBLER)
• FORTRAN Format
CALL DBNTRY(userinfo,reqarea,wrkarea,elmlst,qualarea)
You may even use more than one Request Area for the same table. For
example, one Request Area might be used to sequentially read an
employee table, and another to read the employee record for each
employee's manager.
The work area is used with record update and add commands to pass
the elements listed in the element list, in the order listed, to CA-
Datacom/DB. The work area is also used, in conjunction with record
retrieval commands, to receive those elements back from CA-
Datacom/DB.
This area must be large enough to accommodate the combined length
of all the elements specified in the element list. If this area is too small,
record retrieval commands overlay whatever follows this area.
Eg:
01 I-AFB-TABLE.
COPY AFBTBL REPLACING ==:TAG:== BY ==I-AFB-==.
EJECT
RETURN CODES:
The DELET command deletes a record from a table and deletes all keys
associated with the record. DELET also releases exclusive control of the
record.
Return code
22 ELEMENT NAME NOT FOUND
REDBR and RDUBR return actual data elements from a database by reading
the next record with the previous sequential entry in the index. RDUBR
acquires exclusive control for update purposes. REDBR does not obtain
exclusive control.
You identify the starting point at which to read backwards by issuing any
LOCKX command or any REDKX/RDUKX command.
RDUKG acquires exclusive control of the record for update purposes. REDKG
does not obtain exclusive control.
Use the REDKL/RDUKL command to obtain the first record in a table that has a
key value in the index less than or equal to the key value specified in the request.
RDUKL acquires exclusive control of the record for update purposes. REDKL
does not obtain exclusive control.
The beginning and ending key values of the range in a 360-byte key
Area has to be specified. REDKR/RDUKR uses these two values as boundaries
and locates the first record within the range.
REDNE reads the next record with a key value equal to the key value specified.
RDUNE reads for update the next record with an equal key value.