430 likes | 1.32k Views
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.
E N D
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
Declaration 01 USER-ID. 05 PROGRAM-NAME PIC X(08) VALUE 'ICS3000 '. 05 FILLER PIC X(24) VALUE SPACES. 01 A20-REQ-AREA. 05 A20-REQ-COMMAND PIC X(05) VALUE SPACES. 05 A20-REQ-FILENAME PIC X(03) VALUE 'A20'. 05 A20-REQ-KEYNAME PIC X(05) VALUE SPACES. 05 A20-REQ-RETURNCD PIC X(02) VALUE SPACES. 05 A20-REQ-DBID PIC X(02) VALUE SPACES. 05 A20-REQ-REC-ID PIC X(07). 05 A20-REQ-KEY-VALUE PIC X(180).
Declaration 01 A20-WORK-AREA. 05 A20-WORK-AREA-0 PIC X(274). 05 A20-WORK-AREA-6 PIC X(300). 01 A20-ELEMENT-LIST. 05 A20-ELM-1 PIC X(05) VALUE 'A20A0'. 05 FILLER PIC X(01). 05 A20-ELM-2 PIC X(05) VALUE 'A20A6'. 05 FILLER PIC X(01). 05 FILLER 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 TO A20-REQ-KEY-VALUE. MOVE 'BRNCH’ TO A20-REQ-KEYNAME. MOVE 'REDKY’ TO A20-REQ-COMMAND. MOVE A20-REQ-AREA 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 Description ABEND Abnormal Termination Command ADDIT Add Record CLOSE Close User Requirements Table CNTKR Count For Key Value Range CNTKY Count For Equal Key Value CNTTB Count For Table COMIT Commit Transaction
Datacom Commands Command Description DELET Delete Record GETIT Retrieve Next Sequential Record GETPS Get Next Physical Sequential Record GSETL Set To Starting Key GSETP Set Physical Sequential Record INQIN Inquire CA
Datacom Commands Command Description LOCBR Locate Backwards LOCKG Locate Key Equal Or Higher LOCKI Test For Logical Intersections Of Two Keys LOCKL Locate Key Equal Or Lower LOCKR Locate a Record in a Specified Range LOCKX Locate Key Exact LOCKY Locate Key Equal Or Higher
Datacom Commands Command Description LOCNE Locate Next Equal Key Value LOCNK Locate Next Key LOCNR Locate Next Record in Specified Range LOCNX Locate Next LOGCP Checkpoint the Task LOGCR Log Checkpoint With Release LOGDR Log Directed Read LOGDW Log Directed Write
Datacom Commands Command Description LOGIT Add Data To Log Area LOGLB Read Back a LOGIT Record LOGTB Back Out Transactions NOOPS No Operation OPEN Open User Requirements Table
Datacom Commands Command Description REDBR/RDUBR Read Backwards REDID/RDUID Read Record By Id REDKG/RDUKG Read Record Greater Than / EqualTo Key REDKL/RDUKL Read Record Less Than / Equal To Key REDKR/RDUKR Read Record in a Specified Range
Datacom Commands Command Description REDKX/RDUKX Read Key Exact REDKY/RDUKY Read Key Exact REDLE/RDULE Read Located Entry REDNE/RDUNE Read Next Equal Key Value REDNK/RDUNK Read Record With the Next Sequential Key Value REDNR/RDUNR Read the Next Record in a Specified Range
Datacom Commands Command Description REDNX/RDUNX Read Next RELES Release Record RELFL Release Table ROLBK Rollback Transaction SELCN Continue Set Record Selection SELFR Select Set And Return First Record SELNR Select Next Record
Datacom Commands Command Description SELPR Release Set SELSM Select Same Record SELST Stop Set Record Selection TEST Test Option Command UPDAT Update Record
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