60485300
CONTRpL DATA
J ^ s v
DMS-170
CYBER DATABASE
CONTROL SYSTEM
VERSION 2
APPLICATION PROGRAMMING
REFERENCE MANUAL
CDC® OPERATING SYSTEMS:
NOS 2
REVISION RECORD
Revision A (05/14/82)
B (08/26/83)
C (02/20/84)
D (04/23/86)
D e s c r i p t i o n
Initial release under NOS 2 and NOS/BE 1; PSR level 564. This manual represents a complete reorganization of documentation of the COBOL 5, FORTRAN, and Query Update application programming interfaces to CDCS. This manual supersedes the FORTRAN Data Base Facility (FDBF) 1 reference manual (Pub. No. 60482200). This manual also documents new features of CDCS (namely, data base transactions, data base versions, and the immediate return option) at product levels as follows: CDCS 2.3, COBOL 5.3, FDBF 1.3, Query Update 3.4.
Released at PSR level 587. This revision documents improved duration loading capabilities of CDCS and miscellaneous technical corrections.
Released at PSR level 599. This revision documents FORTRAN interface support of concatenated keys and miscellaneous technical corrections.
Released at PSR level 647. This revision removes references to FORTRAN 4.
REVISION LETTERS I, 0, Q, AND X ARE NOT USED
©COPYRIGHT CONTROL DATA CORPORATION 1982, 1983, 1984, 1986
All Rights Reserved
Printed in the United States of America
Address comments concerning this manual to: CONTROL DATA CORPORATION
Publications and Graphics Division P. 0. BOX 3492
SUNNYVALE, CALIFORNIA 94088-3492
or use Comment Sheet in the back of this manual
LIST OF EFFECTIVE PAGES
New features, as well as changes, deletions, and additions to information in this manual are indicated by bars in the margins or by a dot near the page number if the entire page is affected. A bar by the page number indicates pagination rather than content has changed.
Page Revision
Front Cover Title Page
i i i i i / i v
V
v i v i i v i i i i x / x x i 1-1 1-2 1-3
1-4 thru 1-8 2-1 thru 2-11 2-12
2-13 thru 2-22 3-1
3-2 thru 3-4 3-5
3-6 3-7
3-8 thru 3-18 3-18.1 3-18.2 3-19
3-20 thru 3-26 4-1 thru 4-16 5-1 thru 5-22 6-1
6-2 thru 6-5 7-1 thru 7-6 8-1 thru 8-4 A-l thru A-4 B - l
B-2 B-3 B-4
B - 4 . 1 / B - 4 . 2 B-5
B-6 B-7
B-8 thru B-l2 B-13
B-l4 thru B-16 B-16.1/B-16.2 B-17 thru B-22 B-23
B-24
B-24.1/B-24.2 B-25 thru B-29 B-30
B-31
Page R e v i s i o n
C - l C-2 C-3 C-4 C-5
C-6 thru C-9 D-l thru D-3 D-4 thru D-7 E-l thru E-3 F - l
G-l G-2 G-3 G-4 H - l
H-2 thru H-4 H-5 thru H-l2
1-1 1-2 J - l J - 2 J - 3
Index-1 thru -3 Index-4
Index-5
J ^ * \
PREFACE
T h i s m a n u a l d e s c r i b e s a p p l i c a t i o n p r o g r a m i n t e r faces to CONTROL DATA® CYBER Database Control S y s t e m ( C D C S ) Ve r s i o n 2 . C D C S i s o n e o f t h e principal components of the DMS-170 data management system. The primary function of CDCS is to control access by an application program to a data base. For an application program to interface with CDCS, i t m u s t b e c o d e d i n o n e o f t h e f o l l o w i n g p r o g r a m m i n g l a n g u a g e s : C O B O L Ve r s i o n 5 , F O RT R A N Ve r s i o n 5 , o r Q u e r y U p d a t e Ve r s i o n 3 . F O R T R A N programs must also be coded with Data Manipulation Language (DML) statements which are provided by the FORTRAN Data Base Facility (FDBF) Version 1.
T h e p r o d u c t s t h a t m a k e u p t h e C D C S - a p p l i c a t i o n program interface are CDCS 2.3, FDBF 1.3, COBOL 5 . 3 , a n d Q u e r y U p d a t e 3 . 4 . A s d e s c r i b e d i n t h i s manual, these products operate under control of the following operating systems:
NOS 2 for the CONTROL DATA CYBER 180 Computer System; CYBER 170 Computer System; CYBER 70 Computer System Models 71, 72, 73, and 74; and 6000 Computer Systems
NOS/BE 1 for the CDC® CYBER 180 Computer Sys tem; CYBER 170 Computer System; CYBER 70 Computer System Models 71, 72, 73, and 74; and 6000 Computer Systems
T h i s m a n u a l i s d e s i g n e d f o r u s e b y a p p l i c a t i o n programmers. The programmers are assumed to be experienced programmers who are familiar with the COBOL or FORTRAN application programming languages or the Query Update processing language. The pro grammers are also assumed to be familiar with data management concepts and with Control Data computers and software products.
Detailed information for the application programmers about subschemas is contained in the CDCS 2 Data A d m i n i s t r a t i o n r e f e r e n c e m a n u a l . R e l a t e d m a t e r i a l is contained in the publications listed below.
The NOS Manual Abstracts and the NOS/BE Manual A b s t r a c t s a r e i n s t a n t - s i z e d m a n u a l s c o n t a i n i n g b r i e f d e s c r i p t i o n s o f t h e c o n t e n t s a n d i n t e n d e d audience of all NOS and NOS product set manuals, and NOS/BE and NOS/BE product set manuals, respec t i v e l y. T h e a b s t r a c t s m a n u a l s c a n b e u s e f u l i n determi ni ng w hi ch manual s are of greatest interest t o a p a r t i c u l a r u s e r . T h e S o f t w a r e P u b l i c a t i o n s R e l e a s e H i s t o r y s e r v e s a s a g u i d e i n d e t e r m i n i n g w h i c h r e v i s i o n l e v e l o f s o f t w a r e d o c u m e n t a t i o n corresponds to the Programming Systems Report (PSR) l e v e l o f i n s t a l l e d s i t e s o f t w a r e .
T h e p u b l i c a t i o n s a r e l i s t e d a l p h a b e t i c a l l y i n g r o u p i n g s t h a t i n d i c a t e r e l a t i v e i m p o r t a n c e t o readers of this manual.
The following manuals are of primary interest:
P u b l i c a t i o n
P u b l i c a t i o n Number
COBOL Version 5 Reference Manual 60497100
CYBER Record Manager
Advanced Access Methods Reference Manual 60499300
DMS-170
CYBER Database Control System Version 2
Data Administration Reference Manual 60485200
DMS-170
CYBER Database Control System Version 2 FORTRAN Application Programming User Guide FORTRAN Version 5 Reference Manual
Query Update Version 3 Reference Manual
The following manuals are of secondary interest:
P u b l i c a t i o n
P u b l i c a t i o n N u m b e r
Network Products
T r a n s a c t i o n F a c i l i t y V e r s i o n 1 R e f e r e n c e M a n u a l 6 0 4 5 9 5 0 0 N O S V e r s i o n 2 M a n u a l A b s t r a c t s 6 0 4 8 5 5 0 0 NOS Version 2 Reference Set, Volume 3 System Commands 60459680
N O S / B E V e r s i o n 1 M a n u a l A b s t r a c t s 8 4 0 0 0 4 7 0 N O S / B E V e r s i o n 1 R e f e r e n c e M a n u a l 6 0 4 9 3 8 0 0 S o f t w a r e P u b l i c a t i o n s R e l e a s e H i s t o r y 6 0 4 8 1 0 0 0
C D C m a n u a l s c a n b e o r d e r e d f r o m C o n t r o l D a t a C o r p o r a t i o n , L i t e r a t u r e a n d D i s t r i b u t i o n S e r v i c e s , 3 0 8 N o r t h D a l e S t r e e t , St. Paul, Minnesota 55103.
T h i s p r o d u c t i s i n t e n d e d f o r u s e o n l y a s d e s c r i b e d i n th i s d o c u m e n t. C o n tr o l D a ta c a n n o t b e r e s p o n s i b l e f o r t h e p r o p e r f u n c t i o n i n g . of undescribed features or parameters.
CONTENTS
NOTATIONS
1.
0^>\.
INTRODUCTION TO DATA BASE PROCESSING WITH DMS-170
x i
1-1
Data Base Definition 1-1
Schema Definition 1-2
Subschema Definition 1-2
M a s t e r D i r e c t o r y D e fi n i t i o n 1-2
Data Base Processing 1-3
COBOL Processing 1-3
FORTRAN Processing 1-3
Query Update Processing 1-3
Special Features Involved in CDCS
Processing 1-5
Concurrency 1-5
F i l e P r i v a c y 1-5
Relations 1-5
C o n s t r a i n t s 1-5
Data Base Versions 1-5
Data Base Procedures 1-5
Recovery 1-6
Data Base Transaction 1-6
Immediate Return 1-7
Input/Output Processing 1-7
Processing Through CDCS and TAF 1-7
2 . C O B O L I N T E R F A C E 2 - 1
C O B O L S u b s c h e m a 2 - 1
S u b s c h e m a L i s t i n g 2 - 1
Information Provided by Data Administrator 2-4 S u b s c h e m a D i r e c t o r y 2 - 5
P r o g r a m C o d i n g 2 - 5
E n v i r o n m e n t D i v i s i o n 2 - 5 S U B - S C H E M A C l a u s e 2 - 5 F i l e - C o n t r o l E n t r y 2 - 5
D a t a D i v i s i o n 2 - 5
P r o c e d u r e D i v i s i o n 2 - 8
C L O S E S t a t e m e n t 2 - 8
C . D M R S T R o u t i n e 2 - 8
C . I O S T R o u t i n e 2 - 8
C . L O K R o u t i n e 2 - 9
C . U N L O K R o u t i n e 2 - 9
D B $ A S K R o u t i n e 2 - 9
D B $ B E G R o u t i n e 2 - 1 0
D B $ C M T R o u t i n e 2 - 1 0
D B $ D B S T R o u t i n e 2 - 1 0
D B $ D R O P R o u t i n e 2 - 1 0
D B $ G T I D R o u t i n e 2 - 1 0
D B $ L K A R R o u t i n e 2 - 1 1
D B $ R P T R o u t i n e 2 - 1 1
D B $ S I R R o u t i n e 2 - 1 2
D B $ V E R S R o u t i n e 2 - 1 2
D B $ W A I T R o u t i n e 2 - 1 2
D E L E T E S t a t e m e n t 2 - 1 2
O P E N S t a t e m e n t 2 - 1 3
R E A D S t a t e m e n t 2 - 1 4
R E W R I T E S t a t e m e n t 2 - 1 5
S T A R T S t a t e m e n t 2 - 1 5
USE FOR ACCESS CONTROL Declarative
S t a t e m e n t 2 - 1 6
USE FOR DEADLOCK Declarative Statement 2-17
W R I T E S t a t e m e n t 2 - 1 8
C O B O L S u b p r o g r a m s 2 - 1 8
C o m p i l a t i o n a n d E x e c u t i o n 2 - 1 9 R e c o m p i l a t i o n G u i d e l i n e s 2 - 1 9
S t a t u s C h e c k i n g 2 - 1 9
D a t a B a s e S t a t u s B l o c k 2 - 1 9 A d d i t i o n a l S t a t u s C h e c k i n g E l e m e n t s 2 - 2 0
P r o g r a m D e b u g g i n g 2 - 2 0
3 . F O R T R A N I N T E R F A C E 3 - 1
F O R T R A N S u b s c h e m a 3 - 1
S u b s c h e m a L i s t i n g 3 - 1
Information Provided by Data Administrator 3-4 S u b s c h e m a D i r e c t o r y 3 - 5
F O R T R A N D M L 3 - 5
L a n g u a g e E l e m e n t s 3 - 5
K e y w o r d s 3 - 5
C o n s t a n t s 3 - 5
V a r i a b l e s 3 - 5
D M L S t a t e m e n t s 3 - 5
S y n t a x R e q u i r e m e n t s 3 - 5 A S S I G N I D S t a t e m e n t 3 - 8 B E G I N T R A N S t a t e m e n t 3 - 8
C L O S E S t a t e m e n t 3 - 8
C O M M I T T R A N S t a t e m e n t 3 - 8
D E L E T E S t a t e m e n t 3 - 9
D M L D B S T R o u t i n e 3 - 9
D M L R P T R o u t i n e 3 - 1 0
D M L S I R R o u t i n e 3 - 1 0
D R O P T R A N S t a t e m e n t 3 - 1 0 F I N D T R A N S t a t e m e n t 3 - 1 1 I N V O K E S t a t e m e n t 3 - 1 1
L O C K S t a t e m e n t 3 - 1 1
N E W V E R S I O N S t a t e m e n t 3 - 1 2
O P E N S t a t e m e n t 3 - 1 3
P R I V A C Y S t a t e m e n t 3 - 1 4
R E A D S t a t e m e n t 3 - 1 4
R E W R I T E S t a t e m e n t 3 - 1 6
S T A R T S t a t e m e n t 3 - 1 7
S U B S C H E M A S t a t e m e n t 3 - 1 8 T E R M I N A T E S t a t e m e n t 3 - 1 8 . 1 U N L O C K S t a t e m e n t 3 - 1 8 . 1 W R I T E S t a t e m e n t 3 - 1 8 . 1 L i s t i n g C o n t r o l D i r e c t i v e s 3 - 1 8 . 2 D M L C o n t r o l S t a t e m e n t 3 - 1 9
D M L C o n t r o l S t a t e m e n t P a r a m e t e r s 3 - 1 9 D M L C o n t r o l S t a t e m e n t E x a m p l e 3 - 2 0 C o m p i l a t i o n / E x e c u t i o n 3 - 2 0 S a m p l e J o b S t r u c t u r e s 3 - 2 1 R e c o m p i l a t i o n G u i d e l i n e s 3 - 2 1
S t a t u s C h e c k i n g 3 - 2 1
4. QUERY UPDATE INTERFACE
Query Update Subschema Subschema Listing
Information Provided by Data Administrator Subschema Directory
Directive Syntax ACCESS CREATE DISPLAY EXHIBIT EXTRACT INVOKE MODIFY RECOVERY REMOVE STORE UPDATE VERSION VIA
Query Update Processing With CDCS Execution
Catalog File
Record Locking Mechanism Error Processing
USER-ID Register
Recompilation Guidelines
5. CDCS FEATURES AND PROCESSING CONSIDERATIONS
Execution Time Processing Error Processing
CDCS Diagnostics User Error File Relations Defined
Hierarchical Tree Structure Ranks of a Relation Parent/Child Relationship R e c o r d Q u a l i fi c a t i o n
CDCS Relation Processing Opening a Relation Positioning a Relation Reading a Relation
Reading a Relation Randomly Reading a Relation Sequentially Reading Relations in Parallel Reading a Relation Defined With
Re co rd Qu a l i fic a ti o n s
Reading a Relation When Data Base Versions Exist
Updating Files Joined in a Relation Closing a Relation
Informative Conditions Null Record Occurrence Control Break
Example of Null Record and Control Break Conditions
Transaction Processing Processing Operations Processing Considerations
Examples of Transaction Processing CDCS Processing in Transaction Mode Concurrent Access to a Data Base
CDCS Locking
Locking Outside of a Transaction Locking Within a Transaction Processing Considerations Deadlock 4-1 4-1 4-1 4-5 4-5 4-6 4-6 4-8 4-9 4-9 4-10 4-11 4-11 4-12 4-12 4-13 4-13 4-13 4-14 4-14 4-14 4-15 4-16 4-16 4-16 4-16 5-1 5-1 5-1 5-1 5-2 5-2 5-3 5-3 5-4 5-4 5-5 5-5 5-5 5-5 5-5 5-6 5-6 5-7 5-7 5-8 5-8 5-8 5-8 5-8 5-8 5-10 5-10 5-11 5-11 5-11 5-12 5-14 5-14 5-15 5-16 5-16
Immediate Return Feature Resource Conflicts
Using the Immediate Return Feature Processing Considerations
Constraints Defined S i n g l e - F i l e C o n s t r a i n t Two-File Constraint CDCS Constraint Processing
Guidelines for File Creation Guidelines for Insertion Operations Guidelines for Deletion Operations Guidelines for Modification Operations TAF-CDCS Processing
6. COBOL EXAMPLE
7. FORTRAN EXAMPLES FORTRAN 5 Example
8. QUERY UPDATE EXAMPLE
APPENDIXES
Standard Character Sets Diagnostic Messages Glossary
Syntax Summaries
Future System Migration Guidelines Keyword Used in DML Statements and
Variables and Common Blocks Generated by the DML Preprocessor
CDCS Batch Test Facility
Data Base Environment for Examples Collating Sequences for Data Base Files Summary of Data Definitions in DMS-170
INDEX
FIGURES
1-1 Defining a Data Base
1-2 Subschema Describing a Portion of the Data Base
1-3 Relationship of the Elements Involved in Processing a Data Base
1-4 Processing Using Data Base Versions 1-5 CDCS/TAF Interface
2-1 Sample COBOL Subschema 2-2 SUB-SCHEMA Clause Format 2-3 CLOSE Statement Format 2-4 C.DMRST Routine Format 2-5 C.IOST Routine Format 2-6 C.LOK Routine Format 2-7 C.UNLOK Routine Format 2-8 DB$ASK Routine Format 2-9 DB$BEG Routine Format 2-10 DB$CMT Routine Format •2-11 DB$DBST Routine Format
2-12 DB$DR0P Routine Format 2-13 DB$GTID Routine Format
5-17 5-18 5-18 5-18 5-18 5-19 5-19 5-20 5-20 5-20 5-21 5-21 5-22 6-1 7-1 7-1 8-1
A - l B - l C - l D - l E - l
F - l G-l H - l 1-1 J - l
2-14 DB$LKAR Routine Format 2-15 DB$RPT Routine Format 2-16 DB$SIR Routine
2-17 DB$VERS Routine Format
2-18 COBOL Example Showing Use of Version Master and an Alternate Version 2-19 DB$WAIT Routine Format
2-20 DELETE Statement Format 2-21 OPEN Statement Format 2-22 READ Statement Format 2-23 REWRITE Statement Format 2-24 START Statement Format
2-25 USE FOR ACCESS CONTROL Declarative Statement
2-26 USE FOR ACCESS CONTROL Procedure Example
2-27 USE FOR DEADLOCK Declarative Statement 2-28 USE FOR DEADLOCK Procedure Example 2-29 WRITE Statement Format
2-30 Example of a COBOL Description of a Data Base Status Block
3-1 Sample FORTRAN Subschema 3-2 ASSIGNID Statement Format 3-3 BEGINTRAN Statement Format 3-4 CLOSE Statement Format 3-5 COMMITTRAN Statement Format 3-6 DELETE Statement Format
3-7 Example of Use of the DELETE Statement 3-8 DMLDBST Routine Format
3-9 DMLRPT Routine Format 3-10 DMLSIR Routine
3-11 DROPTRAN Statement Format 3-12 FINDTRAN Statement Format 3-13 INVOKE Statement Format 3-14 LOCK Statement Format 3-15 NEWVERSION Statement Format 3-16 Example of Use of the NEWVERSION
Statement
3-17 OPEN Statement Format
3-18 Example of Use of OPEN Statement 3-19 PRIVACY Statement Format
3-20 PRIVACY Statement Examples 3-21 READ Statement Format
3-22 Example of Use of READ Statement 3-23 REWRITE Statement Format
3-24 START Statement Format 3-25 SUBSCHEMA Statement Format 3-26 TERMINATE Statement Format 3-27 UNLOCK Statement Format 3-28 WRITE Statement Format
3-29 Example of Use of the WRITE Statement 3-30 Example of Listing Control Statements
in a FORTRAN Program 3-31 DML Control Statement Format
3-32 Program Compilation and Execution With CDCS at a System Control Point 3-33 Example of a Data Base Status Block
Used for Deadlock Processing 4-1 Sample Query Update Subschema 4-2 Format of an Expression 4-3 ACCESS Directive Format 4-4 ACCESS Directive Examples 4-5 CREATE Directive Format 4-6 CREATE Directive Examples 4-7 DISPLAY Directive Format 4-8 EXHIBIT Directive Format
2-11 4-9 2-11 4-10 2-12 4-11 2-12 4-12 4-13 2-12 4-14 2-12 4-15 2-12 4-16 2-13 4-17 2-14 4-18 2-15 4-19 2-16 4-20 5-1 2-16 5-2 5-3 2-17 2-17 5-4 2-18 2-18 5-5 5-6 2-20 3-2 5-7 3-8 3-8 5-8 3-8 5-9 3-9 3-9 5-10 3-9 5-11 3-10 3-10 5-12 3-10 5-13 3-11 5-14 3-11 5-15 3-11 5-16 3-12 6-1 3-12 6-2 6-3 3-13 7-1 3-13 7-2 3-13 7-3 3-14 8-1 3-14 8-2 3-15 3-16 3-16 3-17
TABL
3-18 3-18.1 2-1 3-18.1 2-2 3-18.1 3-18.1 2-3 3-1 3-18.2 3-2 3-19 3-2.1 3-21 3-3 3-22 3-4 4-2 4-1 4-6 4-7 4-2 4-7 4-3 4-8 4-4 4-8 4-9 4-9 5-1E X H I B I T D i r e c t i v e E x a m p l e s 4 - 1 0 E X T R A C T D i r e c t i v e F o r m a t 4 - 1 1 I N V O K E D i r e c t i v e F o r m a t 4 - 1 1 I N V O K E D i r e c t i v e E x a m p l e s 4 - 1 1 M O D I F Y D i r e c t i v e F o r m a t 4 - 1 2 R E C O V E R Y D i r e c t i v e F o r m a t 4 - 1 2 R E M O V E D i r e c t i v e F o r m a t 4 - 1 2 S T O R E D i r e c t i v e F o r m a t 4 - 1 3 U P D A T E D i r e c t i v e F o r m a t 4 - 1 3 V E R S I O N D i r e c t i v e F o r m a t 4 - 1 3 V I A D i r e c t i v e F o r m a t 4 - 1 4 E x a m p l e s o f U s i n g a C a t a l o g F i l e 4 - 1 5 T w o - F i l e R e l a t i o n s h i p E x a m p l e 5 - 2 T h r e e - F i l e R e l a t i o n s h i p E x a m p l e 5 - 3 Tree Structure for
CONTRACTS-PRODUCTS-E M P L O Y CONTRACTS-PRODUCTS-E CONTRACTS-PRODUCTS-E S R e l a t i o n s h i p 5 - 3 Complex Tree Structure for
CONTRACTS-P R O D U C T S - E M CONTRACTS-P L O Y E E S R e l a t i o n s h i p 5 - 4 F i l e P o s i t i o n i n g E x a m p l e 5 - 5 Record Occurrences for Three Related
F i l e s 5 - 6
Record Occurrences in User's Work
A r e a s A f t e r R e a d i n g 5 - 6 T h r e e R e l a t i o n E x a m p l e 5 - 7 Example of Files Joined by a Relation
a n d G r o u p e d b y V e r s i o n 5 - 7 N u l l R e c o r d O c c u r r e n c e E x a m p l e s 5 - 9 Example of Null Occurrence and
C o n t r o l B r e a k C o n d i t i o n s 5 - 9 T r a n s a c t i o n P r o c e s s i n g S i t u a t i o n 5 - 1 2 T r a n s a c t i o n P r o c e s s i n g U s i n g C O B O L 5 - 1 3 D e a d l o c k S i t u a t i o n 5 - 1 7 S i n g l e - F i l e C o n s t r a i n t E x a m p l e 5 - 1 9 T w o - F i l e C o n s t r a i n t E x a m p l e 5 - 2 0
C O B O L S u b s c h e m a 6 - 2
C O B O L P r o g r a m 6 - 3
R e p o r t G e n e r a t e d b y C O B O L P r o g r a m 6 - 5 F O R T R A N 5 S u b s c h e m a 7 - 2
F O R T R A N 5 P r o g r a m 7 - 3
Report Generated by FORTRAN 5 Program 7-6 Q u e r y U p d a t e S u b s c h e m a 8 - 2 Q u e r y U p d a t e A p p l i c a t i o n 8 - 3
C O B O L S t a t e m e n t s a n d R o u t i n e s 2 - 6 Schema Access Control Lock and
Corresponding ON Phrase Usage Option 2-17 C o n t e n t s o f D a t a B a s e S t a t u s B l o c k 2 - 2 1 FORTRAN DML Statements and Routines 3-6 Schema Access Control Lock and
C o r r e s p o n d i n g M o d e O p t i o n U s a g e 3 - 1 4 3-2.1 Syntax Correspondence to Read
C h a r a c t e r i s t i c s 3 - 1 5
Contents of the Data Base Status Block 3-23 I n f o r m a t i v e D i a g n o s t i c C o d e s 3 - 2 5 Corresponding Subschema and Query
U p d a t e D a t a T y p e s 4 - 4 Q u e r y U p d a t e D i r e c t i v e s 4 - 6 R e c o m m e n d e d Q u e r y U p d a t e D i r e c t i v e s 4 - 6 Schema Access Control Locks and
Corresponding ACCESS Directive
U s a g e O p t i o n s 4 - 7
NOTATIONS
R e f e r e n c e f o r m a t s a r e p r e s e n t e d t h r o u g h o u t t h e m a n u a l t o i l l u s t r a t e e s s e n t i a l e l e m e n t s o f s y n t a x .
The notations used in the reference formats follow t w o c o n v e n t i o n s : t h e C O B O L c o n v e n t i o n a n d t h e FORTRAN convention. The COBOL convention is used i n f o r m a t s t h a t d e s c r i b e s y n t a x f o r C O B O L s t a t e ments and Query Update directives. The FORTRAN convention is used in formats that describe syntax for the FORTRAN Data Manipulation Language (DML) s t a t e m e n t s a n d f o r a l l c o n t r o l s t a t e m e n t s . T h e d i f f e r e n c e s i n t h e c o n v e n t i o n s a r e i n t h e i n t e r p r e t a t i o n o f u p p e r c a s e w o r d s , t h e o m i s s i o n o f underlined uppercase words from the FORTRAN con vention, and the use of punctuation.
T h e n o t a t i o n s u s e d i n r e f e r e n c e f o r m a t s a r e d e scribed as follows:
UPPERCASE COBOL convention. Uppercase words are reserved words and must appear exactly as shown. Reserved words c a n b e u s e d o n l y a s s p e c i fi e d i n t h e r e f e r e n c e f o r m a t s . I f n o t u n d e r l i n e d , t h e y a r e o p t i o n a l . F O R T R A N c o n v e n t i o n . U p p e r c a s e words are keywords and must appear exactly as shown. Keywords can be u s e d o n l y a s s p e c i fi e d i n t h e reference formats.
U N D E R L I N E D C O B O L c o n v e n t i o n . U n d e r l i n e d UPPERCASE uppercase words are required when the format in which they appear is used.
{ } B r a c e s e n c l o s e o n e i t e m o r s e v e r a l v e r t i c a l l y s t a c k e d i t e m s i n a r e f e r e n c e f o r m a t . W h e n o n e i t e m is enclosed in braces and followed b y e l l i p s e s , t h e i t e m c a n b e r e peated at the user's option. When s e v e r a l i t e m s a r e e n c l o s e d i n b r a c e s , o n l y o n e o f t h e e n c l o s e d items must be used.
Ve r t i c a l b a r s e n c l o s e tw o o r m o r e v e r t i c a l l y s t a c k e d i t e m s i n a reference format when at least one of the enclosed items must be used. E a c h o f t h e v e r t i c a l l y s t a c k e d items can be used once.
V e r t i c a l b a r s w i t h i n b r a c k e t s e n c l o s e t w o o r m o r e v e r t i c a l l y s t a c k e d i t e m s i n a r e f e r e n c e f o r mat when each of the stacked items can be used once or omitted. Any
items can be used in any order.
E l l i p s e s i m m e d i a t e l y f o l l o w a p a i r o f b r a c k e t s o r b r a c e s t o i n d i c a t e that the enclosed material can be repeated at the user's option.
P u n c t u a t i o n u s e d i f f e r s f o r t h e c o n v e n t i o n s a s f o l l o w s :
F O R T R A N c o n v e n t i o n . U n d e r l i n e d uppercase words are not used. L o w e r c a s e L o w e r c a s e w o r d s a r e g e n e r i c t e r m s
t h a t r e p r e s e n t t h e w o r d s o r s y m b o l s s u p p l i e d b y t h e u s e r. W h e n g e n e r i c t e r m s a r e r e p e a t e d i n a f o r m a t , a n u m b e r i s a p p e n d e d t o t h e t e r m f o r i d e n t i fi c a t i o n .
COBOL convention
Punctuation symbols shown within the formats a r e r e q u i r e d u n l e s s e n c l o s e d i n b r a c k e t s a n d s p e c i fi c a l l y n o t e d a s o p t i o n a l . I n general, commas and semicolons are optional. One or more spaces separate the elements in a reference format.
[ ]
B r a c k e t s e n c l o s e o p t i o n a l p o r t i o n s o f a r e f e r e n c e f o r m a t . A l l o f t h e f o r m a t w i t h i n t h e b r a c k e t s c a n b e o m i t t e d o r i n c l u d e d a t t h e u s e r ' s o p t i o n . I f i t e m s a r e s t a c k e d v e r t i c a l l y w i t h i n b r a c k e t s , o n l y o n e o f t h e s t a c k e d i t e m s c a n b eused.
FORTRAN convention
P u n c t u a t i o n s y m b o l s s h o w n w i t h i n f o r m a t s a r e r e q u i r e d u n l e s s e n c l o s e d i n b r a c k e t s a n d s p e c i fi c a l l y n o t e d a s o p t i o n a l .
# ^
INTRODUCTION TO DATA BASE PROCESSING
WITH DMS-170
DMS-170 is a data management system for Control Data computer systems. Through this data manage ment system, a data base can be defined, maintained,
a n d c o n t r o l l e d i n a n e n v i r o n m e n t t o t a l l y i n d e p e n d e n t o f t h e a p p l i c a t i o n s t h a t a r e a c c e s s i n g i t . Conventional files otherwise owned and processed by a number of distinct applications can be described t h r o u g h t h e d a t a d e s c r i p t i o n l a n g u a g e f a c i l i t i e s o f D M S - 1 7 0 . C o n s e q u e n t l y , t h e r e s p o n s i b i l i t y f o r t a s k s s u c h a s d a t a d e s c r i p t i o n , d a t a c o n v e r s i o n , a n d v a l i d i t y c h e c k i n g i s t r a n s f e r r e d f r o m t h e application programmer to the data administrator.
The DMS-170 data management system is composed of the following elements:
Data Description Language (DDL), which creates t h e s c h e m a d e fi n i t i o n , a s w e l l a s t h e C O B O L , FORTRAN and Query Update subschema definitions.
CDC CYBER Database Control System (CDCS), which c o n t r o l s , m o n i t o r s , a n d i n t e r p r e t s d a t a b a s e requests from COBOL, FORTRAN, and Query Update application programs.
Processing of the data base involves retrieval and updating of the data by application programs through
the facilities of CDCS.
The DMS-170 environment defines two roles: the data a d m i n i s t r a t o r a n d t h e a p p l i c a t i o n p r o g r a m m e r. T h e d a t a a d m i n i s t r a t o r i s r e s p o n s i b l e f o r t h e d e fi n i
t i o n o f a d a t a b a s e . T h e d a t a a d m i n i s t r a t o r i s a person or group of persons who develop and define t h e d a t a b a s e a s w e l l a s m o n i t o r a n d c o n t r o l t h e d a y - t o - d a y p r o c e s s i n g o f t h a t d a t a b a s e . T h e a p p l i c a t i o n p r o g r a m m e r u s e s t h e i n t e r f a c e c a p a bilities of COBOL, FORTRAN, and Query Update to d e v e l o p p r o g r a m s f o r d a t a b a s e p r o c e s s i n g . T h e a p p l i c a t i o n p r o g r a m s u s e t h e d e t a i l e d d e s c r i p t i o n s a n d f a c i l i t i e s o f C D C S w h e n p e r f o r m i n g d a t a b a s e p r o c e s s i n g .
C D C o ff e r s g u i d e l i n e s f o r t h e u s e o f t h e s o f t w a r e d e s c r i b e d i n t h i s m a n u a l . T h e s e g u i d e l i n e s a p p e a r in appendix E. Before using the software described i n t h i s m a n u a l , t h e r e a d e r i s s t r o n g l y u r g e d t o review this appendix. The guidelines recommend use o f t h i s s o f t w a r e i n a m a n n e r t h a t r e d u c e s t h e e f f o r t r e q u i r e d t o m i g r a t e a p p l i c a t i o n p r o g r a m s t o future hardware or software systems.
r
CDC CYBER Record Manager (CRM), which handles a l l i n p u t / o u t p u t p r o c e s s i n g r e q u e s t s o n a d a t a base from an application program.
Data Manipulation Languages (DML), which pro vide for data base access through the COBOL and
FORTRAN programming languages. The COBOL DML consists of features within the COBOL language. The FORTRAN DML consists of DML statements that are used within a FORTRAN-coded program and p r e p r o c e s s e d b y a D M L p r e p r o c e s s o r b e f o r e FORTRAN compilation.
Query Update language, which provides for data b a s e a c c e s s i n b o t h i n t e r a c t i v e a n d b a t c h modes. Query Update is a language that enables i n d i v i d u a l s w i t h v a r y i n g l e v e l s o f t e c h n i c a l e x p e r t i s e t o a c c e s s a n d m a n i p u l a t e t h e d a t a base and to produce special-purpose reports.
DATA BASE DEFINITION
To define a data base, the data administrator uses the DDL. Through this language, four types of data descriptions can be created: the schema, the COBOL subschema, the FORTRAN subschema, and the Query Update subschema. Each of these data descriptions f o l l o w s s p e c i fi c s t r u c t u r i n g c o n v e n t i o n s , i n c l u d e s unique clauses and statements, and conforms to an i n d i v i d u a l s e t o f r u l e s .
T h e r e l a t i o n s h i p o f t h e e l e m e n t s i n v o l v e d i n d e fi n ing a data base is shown in figure 1-1. The figure i n d i c a t e s t h a t t h e s c h e m a d i r e c t o r y m u s t b e a v a i l a b l e t o t h e D D L c o m p i l e r t o g e n e r a t e s u b s c h e m a d i r e c t o r i e s .
The data descriptions in the schema and subschema a r e o r g a n i z e d i n t o fi l e - l i k e s t r u c t u r e s . B y c o n vention, the following terms are used when referring t o t h e s e s t r u c t u r e s :
Each element of the DMS-170 system is used either i n t h e d e fi n i t i o n o r i n t h e p r o c e s s i n g o f a d a t a b a s e . T h e d e fi n i t i o n o f t h e d a t a b a s e i s a c c o m plished through the capabilities of DDL and CDCS.
Schema Source
Subschema Source
DDL Compiler
I
Schema D i r e c t o r y
L i s t i n g s
Subschema L i b r a r i e s
Figure 1-1. Defining a Data Base
T h e s c h e m a d e s c r i p t i o n o f a n a r e a a p p l i e s t o a l l d a t a w i t h i n t h e s t r u c t u r e . T h e s u b s c h e m a d e fi n i
t i o n o f a r e a l m u s u a l l y a p p l i e s t o a p o r t i o n o f d a t a w i t h i n t h e s t r u c t u r e b u t c a n a p p l y t o a l l t h e d a t a . T h e a r e a p r o v i d e s t h e a c t u a l d e s c r i p t i o n o f t h e d a t a ; t h e r e a l m p r o v i d e s t h e d e s c r i p t i o n o f data from the standpoint of the application program. The term file is often used in this manual to refer
to either an area or a realm.
SCHEMA DEFINITION
T h e s c h e m a i s a d e t a i l e d d e s c r i p t i o n i n E n g l i s h like syntax of the data in a data base. The schema description is created by DDL statements that name the schema, organize the schema into areas, describe e a c h r e c o r d t y p e t o g e t h e r w i t h t h e c h a r a c t e r i s t i c s o f t h e d a t a c o m p r i s i n g t h e r e c o r d , a n d d e s c r i b e r e l a t i o n s h i p s a n d c o n s t r a i n t s a m o n g a r e a s . T h e s c h e m a a l s o i n c l u d e s a c c e s s c o n t r o l l o c k s t h a t provide privacy at the area level. The DDL source statements describing the data are used as input to the DDL compiler and are compiled into an object s c h e m a , o r s c h e m a d i r e c t o r y. T h e d a t a a d m i n i s trator then uses the schema to define any number of subschemas.
The subschema specifies realms and the contents and s t r u c t u r e o f r e c o r d s . T h e s u b s c h e m a i n d i c a t e s c h a n g e s i n d a t a f o r m a t r e q u i r e d b y a n a p p l i c a t i o n program, identifies relations to be used, and speci fi e s r e c o r d q u a l i fi c a t i o n f o r r e l a t i o n p r o c e s s i n g . Th e d a ta d e s c r i p ti o n s i n th e s u b s c h e m a a r e o r g a n i z e d i n t o r e a l m s t h a t c o r r e s p o n d t o a r e a s i n t h e schema. The realms included in a subschema can be a s u b s e t o f t h e a r e a s i n t h e s c h e m a . T h e d a t a i t e m s w i t h i n t h e r e a l m i n a s u b s c h e m a c a n b e a s u b s e t o f t h e d a t a i t e m s d e s c r i b e d f o r t h e c o r r e sponding area in the schema. Figure 1-2 illustrates t h e s i t u a t i o n i n w h i c h a s u b s c h e m a d e s c r i b e s a portion of a data base.
Although only one schema is allowed for each data base, any number of subschemas can be defined to m e e t t h e n e e d s o f d i ff e r e n t t y p e s o f a p p l i c a t i o n s . S u b s c h e m a s a r e d e fi n e d b y t h e d a t a a d m i n i s t r a t o r for use by application programs written in COBOL, FORTRAN, and Query Update.
The data administrator should provide the applica t i o n p r o g r a m m e r w i t h a l i s t i n g o f t h e s u b s c h e m a . T h e l i s t i n g i s u s e d t o o b t a i n t h e n a m e s a n d d e scriptions of the data referenced by the application program.
SUBSCHEMA DEFINITION
A s u b s c h e m a i s a d e t a i l e d d e s c r i p t i o n o f s e l e c t e d portions of data described by a schema. The sub schema defines the portion of the data base avail a b l e t o t h e a p p l i c a t i o n p r o g r a m ; t h e a p p l i c a t i o n program uses the subschema descriptions to access t h e d a t a b a s e . T h e s u b s c h e m a i s b a s e d o n t h e schema.
MASTER DIRECTORY DEFINITION
The data administrator must create a master direc tory before any application program accessing data b a s e fi l e s c a n e x e c u t e . T h e m a s t e r d i r e c t o r y c o n t a i n s i n f o r m a t i o n f o r a l l t h e e l e m e n t s o f t h e data base known to CDCS. These elements include the schema, subschema, descriptions of data base fi l e s , a n d d e fi n i t i o n s o f a n y d a t a b a s e v e r s i o n s . ( D a t a b a s e v e r s i o n s a r e d e s c r i b e d l a t e r i n t h i s s e c t i o n . )
[image:14.610.47.544.51.262.2]Physical Data Base (Data Base Files)
Shows schema d e s c r i p t i o n .
Logical Data Base ( D e s c r i p t i o n )
Schema Areas A, B, C, D
Shows schema and
subschema descriptions. SubschemaRealms A, C/ D
A schema describes all data base files with a r e a d e s c r i p t i o n s .
A subschema describes portions of data base fi l e s w i t h r e a l m d e s c r i p t i o n s .
Figure 1-2. Subschema Describing a Portion of the Data Base
DATA BASE PROCESSING
[image:15.610.66.562.54.281.2]O n c e a d a t a b a s e h a s b e e n d e fi n e d b y t h e d a t a a d m i n i s t r a t o r, i t c a n b e a c c e s s e d b y t h e f o l l o w i n g | a p p l i c a t i o n l a n g u a g e s : C O B O L 5 , F O RT R A N 5 , a n d Q u e r y U p d a t e 3 . P r o c e s s i n g o f t h e d a t a b a s e b y COBOL, FORTRAN, and Query Update programs is c o n t r o l l e d a n d m o n i t o r e d b y C D C S . T h e s e a p p l i c a t i o n l a n g u a g e s c a n b e u s e d i n e i t h e r b a t c h o r interactive mode.
F i g u r e 1 - 3 s h o w s t h e r e l a t i o n s h i p b e t w e e n t h e elements involved in processing a data base through CDCS.
COBOL PROCESSING
A COBOL program accesses data base files through c o n v e n t i o n a l i n p u t / o u t p u t s t a t e m e n t s . T h e fi l e s are opened and closed and records are read, written, d e l e t e d , a n d u p d a t e d u s i n g s i m i l a r m e a n s a s f o r fi l e s t h a t a r e n o t p a r t o f a d a t a b a s e . R e l a t i o n p r o c e s s i n g i s a l s o a c c o m p l i s h e d b y c o n v e n t i o n a l COBOL statements. Data retrieved by the program is a c c e s s e d a c c o r d i n g t o t h e w a y i t i s d e s c r i b e d i n the COBOL subschema.
When a COBOL program utilizing CDCS is to be com p i l e d , t h e fi l e c o n t a i n i n g t h e s u b s c h e m a d i r e c t o r y m u s t fi r s t b e a t t a c h e d . O n c e t h e p r o g r a m i s c o m piled using the subschema, it can be executed later without reattaching the subschema directory.
E x e c u t i o n o f a n i n p u t / o u t p u t s t a t e m e n t f o r a d a t a b a s e fi l e i n a C O B O L p r o g r a m c a u s e s t h e C O B O L object-time routines to route I/O calls to CDCS.
FORTRAN PROCESSING
A FORTRAN program accesses data base files through DML statements coded within the FORTRAN program. The DML consists of FORTRAN-like statements. These statements allow the FORTRAN user to access and modify data base files.
Before a program containing FORTRAN DML statements i s c o m p i l e d , t h e D M L p r e p r o c e s s o r i s c a l l e d v i a a c o n t r o l s t a t e m e n t t o t r a n s l a t e t h e D M L s t a t e m e n t s i n t o F O R T R A N s p e c i fi c a t i o n s t a t e m e n t s a n d C A L L s t a t e m e n t s . D a t a d e s c r i p t i o n s a r e o b t a i n e d f r o m the FORTRAN subschema directory, which must be attached during the preprocessing phase. Following t h e p r e p r o c e s s i n g , c o m p i l a t i o n o f t h e F O R T R A N p r o g r a m p r o c e e d s a s f o r a c o n v e n t i o n a l F O RT R A N program; the translated DML statements are compiled like other FORTRAN statements. Once the program is preprocessed using the subschema, it can be com p i l e d a n d e x e c u t e d l a t e r w i t h o u t r e a t t a c h i n g t h e subschema directory.
QUERY UPDATE PROCESSING
COBOL User
FORTRAN User
Query Update User
COBOL P r o g r a m
FORTRAN-DML Program
DML
Preprocessor
Query Update
Directives
COBOL
Subschema
Directory
COBOL
Compiler
FORTRAN
Subschema
Directory
FORTRAN
Compiler
'Query Update/
Subschema
Directory
<
> -
Query
Update
Executing
COBOL
Job
Executing
FORTRAN
Job
<
i >
«< «*
■
CDCS
CYBER Record
Manager
[image:16.610.45.544.48.680.2]Data Base
Files
Figure 1-3. Relationship of the Elements Involved in Processing a Data Base
SPECIAL FEATURES INVOLVED IN CDCS PROCESSING
T h e s p e c i a l f e a t u r e s d e s c r i b e d i n t h e f o l l o w i n g s u b s e c t i o n s c a n a f f e c t t h e w a y a n a p p l i c a t i o n p r o g r a m e x e c u t e s . S o m e f e a t u r e s a r e u s e d a u t o m a t i c a l l y w i t h a l l C D C S p r o c e s s i n g ; o t h e r f e a t u r e s must be specifically requested by the data adminis
t r a t o r d u r i n g d a t a b a s e d e fi n i t i o n .
Concurrency
An important feature provided by CDCS is the con c u r r e n c y f e a t u r e . C o n c u r r e n c y m e a n s t h a t t w o o r more application programs can access the same data b a s e fi l e a n d t h e s a m e d a t a a t t h e s a m e t i m e . P r o g r a m s c a n a c c e s s a fi l e c o n c u r r e n t l y f o r r e t r i e v a l o r u p d a t e p u r p o s e s . D u r i n g c o n c u r r e n t update operations, CDCS provides a locking mecha nism by which files and records can be locked and u n l o c k e d a t a p p r o p r i a t e t i m e s . A u t o m a t i c l o c k i n g and unlocking are performed by CDCS when certain i n p u t / o u t p u t o p e r a t i o n s a r e s p e c i fi e d . I n a d d i t i o n , e x p l i c i t l o c k a n d u n l o c k r e q u e s t s c a n b e issued from the application program.
A deadlock situation can occur when two programs a t t e m p t t o a c c e s s fi l e s o r r e c o r d s t h a t h a v e b e e n l o c k e d b y C D C S o r b y o t h e r p r o g r a m s . W h e n t h i s situation occurs, CDCS selects one of the contend ing programs, releases all locked resources held by t h a t p r o g r a m , a n d i s s u e s a n e r r o r s t a t u s c o d e . Appropriate code to handle recovery from a deadlock should be included in application programs.
File Privacy
A n o t h e r v a l u a b l e f e a t u r e p r o v i d e d b y C D C S i s t h e a c c e s s c o n t r o l ( p r i v a c y c h e c k i n g ) m e c h a n i s m . Through this mechanism, access to data base files c a n b e c o n t r o l l e d o n t h e b a s i s o f c r i t e r i a s p e c i fi e d b y t h e d a t a a d m i n i s t r a t o r . W h e n t h e d a t a a d m i n i s t r a t o r h a s s p e c i fi e d c o n t r o l l e d a c c e s s t o a data base file, an application program must specify the appropriate access control key (privacy key) to g a i n a c c e s s t o t h e c o n t r o l l e d d a t a b a s e fi l e . T h e data administrator should provide the user with any i n f o r m a t i o n n e c e s s a r y t o a c c e s s c o n t r o l l e d d a t a b a s e fi l e s .
Relations
The relation processing component of CDCS allows d a t a b a s e fi l e s t o b e l i n k e d t o g e t h e r i n t o a l o g i c a l s t r u c t u r e c a l l e d a r e l a t i o n . A r e l a t i o n i s d e fi n e d i n t h e s c h e m a b y t h e d a t a a d m i n i s t r a t o r. A n y r e l a t i o n t h a t i s a v a i l a b l e t o t h e a p p l i c a t i o n program is defined by the data administrator in the
subschema.
An appl ica ti on c a n a c ce ss a r el ati o n b y spec i fy i ng a single read request (a display or extract request for Query Update). When the request Is processed by CDCS, CDCS returns a record occurrence from each fi l e i n t h e r e l a t i o n t o t h e a p p l i c a t i o n ' s w o r k i n g storage area.
Limitations can be placed on a relation by restric tions Included in the subschema. These restrictions a r e i n t h e f o r m o f q u a l i fi c a t i o n c r i t e r i a t h a t m u s t b e s a t i s fi e d b e f o r e a r e c o r d o c c u r r e n c e i s m a d e a v a i l a b l e t o t h e a p p l i c a t i o n .
A subschema listing provides the name of any rela t i o n a n d i n d i c a t e s w h a t s p e c i fi c r e s t r i c t i o n s a p p l y.
Constraints
The constraint component of CDCS is an independent feature that allows controls to be placed on update o p e r a t i o n s i n v o l v i n g l o g i c a l l y a s s o c i a t e d fi l e s . C o n s t r a i n t s p r o t e c t t h e i n t e g r i t y o f t h e d a t a b a s e b y a l l o w i n g u p d a t e s t o b e p e r f o r m e d o n l y w h e n s p e c i fi c c o n d i t i o n s a r e s a t i s fi e d . C o n s t r a i n t s a r e s p e c i fi e d b y t h e d a t a a d m i n i s t r a t o r i n t h e s c h e m a and are enforced by CDCS. Information concerning constraints should be provided by the data adminis trator to the application programmer.
Data Base Versions
T h e d a t a b a s e v e r s i o n f e a t u r e o f C D C S a l l o w s a n a p p l i c a t i o n p r o g r a m t o u s e t h e s a m e s c h e m a a n d subschema to access more than one group of perma nent files corresponding to the areas in the schema, e a c h g r o u p o f w h i c h i s d e fi n e d a s a d a t a b a s e v e r s i o n . D a t a b a s e v e r s i o n s a r e d e fi n e d b y t h e d a t a a d m i n i s t r a t o r i n t h e m a s t e r d i r e c t o r y. I f n o d a t a b a s e v e r s i o n s a r e d e fi n e d , a v e r s i o n n a m e d M A S T E R i s a s s u m e d b y d e f a u l t . I f a l t e r n a t e d a t a base versions are defined, one version named MASTER exists along with the alternate data base versions. B y s p e c i f y i n g u s e o f d i f f e r e n t v e r s i o n s , a n a p p l i c ati o n pr ogr am c an per f or m ope ra ti ons on diff erent g r o u p s o f fi l e s , e a c h g r o u p f o r m i n g a d a t a b a s e v e r s i o n . W i t h i n a s i n g l e e x e c u t i o n , a n a p p l i c a t i o n program can perform processing on any number of d a t a b a s e v e r s i o n s . H o w e v e r, a n a p p l i c a t i o n p r o gram can perform processing on only one data base version at a given time.
F i g u r e 1 - 4 i l l u s t r a t e s t h e u s e o f d a t a b a s e v e r s i o n s . W h e n t h e a p p l i c a t i o n p r o g r a m s p e c i fi e s a version name, CDCS makes available to the program a l l t h e fi l e s o f t h a t d a t a b a s e v e r s i o n t h a t a r e a s s o c i a t e d w i t h t h e r e a l m s i n c l u d e d i n t h e s u b s c h e m a b e i n g u s e d . T h e i l l u s t r a t i o n s h o w s fi l e M l being shared by the versions MASTER and TEST.
Data Base Procedures
Example 1. Application Program AP1
Using Version MASTER Data Base Files
AP1 Subschema SS
Ve r s i o n MASTER
Master D i r e c t o r y with Version D e fi n i t i o n s t
Example 2. Application Program AP1
Using Version TEST Data Base Files
Master D i r e c t o r y with Version . D e fi n i t i o n s t
' Ve r s i o n D e fi n i t i o n s :
Version Area Area B Area C
MASTER File
M
1
File M2 File M3TEST File
M
1
File T2 File T3Figure 1-4. Processing Using Data Base Versions
Recovery
The recovery feature of CDCS provides for recon s t r u c t i o n o f a d a m a g e d o r i n c o n s i s t e n t d a t a b a s e and provides for the removal of updates made with erroneous logic. The data administrator can restore t h e d a t a b a s e t o a p r e v i o u s c h e c k p o i n t o r t h e b e g i n n i n g o f a j o b w h e n a n a p p l i c a t i o n p r o g r a m f a i l u r e o r l o g i c e r r o r o c c u r s . T h e a p p l i c a t i o n p r o g r a m c a n d e fi n e r e c o v e r y p o i n t s a s a n a i d t o recovery operations.
1-6
The transaction feature of CDCS is the application p r o g r a m m i n g i n t e r f a c e t o a u t o m a t i c r e c o v e r y. T h e t r a n s a c t i o n f e a t u r e o f C D C S i s d e s c r i b e d i n t h e f o l l o w i n g s u b s e c t i o n .
Data Base Transaction
[image:18.610.42.545.48.597.2]^
\
T he appli ca ti o n p ro g ram spe ci fi es th e begi nni ng of t h e t r a n s a c t i o n , p e r f o r m s t h e u p d a t e o p e r a t i o n s , and specifies the end of the transaction, which can be either a commit or a drop. When the application p r o g r a m s p e c i fi e s a c o m m i t o p e r a t i o n , a l l u p d a t e s made within the transaction become permanent. When the application program specifies a drop operation, a l l u p d a t e s w i t h i n t h e t r a n s a c t i o n a r e u n d o n e ; t h e r e f o r e , t h e d a t a b a s e r e m a i n s i n t h e s t a t e i t was in before the beginning of the transaction.
I f t h e a p p l i c a t i o n p r o g r a m f a i l s t o c o m m i t a t r a n s a c t i o n b e c a u s e o f s y s t e m o r p r o g r a m f a i l u r e , a u t o m a t i c r e c o v e r y i s p e r f o r m e d ; t h a t i s , t h e t r a n s a c t i o n i s d r o p p e d a n d t h e d a t a b a s e i s r e s t o r e d t o i t s s t a t e b e f o r e t h e b e g i n n i n g o f t h e t r a n s a c t i o n .
Transaction processing also provides an application p r o g r a m w i t h t h e a b i l i t y t o d e t e r m i n e t h e p o i n t a t w h i c h t o r e s t a r t p r o c e s s i n g a f t e r a s y s t e m f a i l u r e . T h e a p p l i c a t i o n p r o g r a m c a n u s e t h i s f e a t u r e t o d e t e r m i n e t h e l a s t t r a n s a c t i o n t h a t w a s c o m m i t t e d b e f o r e t h e s y s t e m f a i l u r e o c c u r r e d . T h e p r o g r a m c a n t h e n d e t e r m i n e t h e p o i n t a t w h i c h processing should be restarted.
Immediate Return
The immediate return feature of CDCS provides COBOL and FORTRAN application programs with the ability to receive an immediate response from CDCS when e i t h e r a r e s o u r c e c o n fl i c t o r a f a t a l e r r o r o c c u r s . When this feature is utilized, CDCS returns control to the application program.
Resource conflicts occur when CDCS attempts to gain access to realms or records locked by other users. Normally, the application program waits for CDCS to g a i n a c c e s s t o t h e s e r e a l m s o r r e c o r d s ; h o w e v e r, w h e n t h e i m m e d i a t e r e t u r n f e a t u r e i s e n a b l e d , t h e a p p l i c a t i o n p r o g r a m c a n c o n t a i n l o g i c t o d e t e r m i n e t h e a c t i o n t a k e n i n t h i s s i t u a t i o n .
When a fatal error occurs and the immediate return f e a t u r e i s e n a b l e d , C D C S d i s c o n n e c t s t h e a p p l i c a t i o n p r o g r a m a n d d i s a b l e s t h e i m m e d i a t e r e t u r n feature. A FORTRAN or COBOL program can complete any processing necessary before program termination. T h e i m m e d i a t e r e t u r n f e a t u r e c a n n o t b e e n a b l e d before CDCS is invoked.
INPUT/OUTPUT PROCESSING
T h e i n p u t / o u t p u t c a p a b i l i t i e s o f C R M h a n d l e a l l o p e r a t i o n s c o n c e r n i n g t h e p h y s i c a l s t o r a g e a n d access of data in a data base. When an application p r o g r a m r e q u e s t s e x e c u t i o n - t i m e p r o c e s s i n g o f i n p u t / o u t p u t s t a t e m e n t s f o r d a t a b a s e fi l e s , C D C S
d i r e c t s t h e r e q u e s t t o C R M . C R M p r o c e s s e s t h e requests according to the requirements and restric t i o n s f o r c o n v e n t i o n a l fi l e s . B e c a u s e C R M h a n d l e s a l l t h e i n p u t a n d o u t p u t p r o c e s s i n g , a n a p p l i c a t i o n program might receive CRM errors.
All data base files supported by CDCS are conven t i o n a l e x t e n d e d C Y B E R R e c o r d M a n a g e r A d v a n c e d A c c e s s M e t h o d s ( A A M ) fi l e s . F i l e o r g a n i z a t i o n i n f o r m a t i o n i s s t o r e d i n t h e s c h e m a d i r e c t o r y . T h i s i n f o r m a t i o n i n c l u d e s t h e d a t a i t e m t h a t i s d e fi n e d a s t h e p r i m a r y k e y. R e c o r d s a r e s t o r e d i n t h e d a t a b a s e b y t h e v a l u e o f t h e p r i m a r y k e y. Duplicate primary keys are not permitted in a data b a s e fi l e .
T h e d a t a a d m i n i s t r a t o r c a n a l s o d e fi n e a l t e r n a t e k e y s . T h e v a l u e o f t h e p r i m a r y o r a l t e r n a t e k e y s can be used to access records in data base files.
PROCESSING THROUGH CDCS AND TAF
CDCS supports the Transaction Facility (TAF), which allows processing through TAF under NOS. Process ing through TAF provides for high speed handling or r e p e t i t i v e e x e c u t i o n s o f a r e l a t i v e l y s m a l l n u m b e r of jobs called tasks. The tasks can be executed by m a n y d i ff e r e n t p e o p l e f r o m m a n y l o c a t i o n s . A t a s k usually performs one of the following manipulations on a data base:
Stores a new record
Alters or deletes an existing record Produces formatted output
A n e x a m p l e o f TA F - t r a n s a c t i o n p r o c e s s i n g i s a n o n l i n e b a n k i n g s y s t e m . Te l l e r s i n m a n y l o c a t i o n s u s e t e r m i n a l s c o n n e c t e d o n l i n e t o a c e n t r a l p r o c essor to make deposits or withdrawals for an account a n d t o p r i n t c o n fi r m a t i o n s . A t a s k ( a d e p o s i t o r w i t h d r a w a l ) i s i n i t i a t e d b y a t e l l e r ; o n c e i n i
tiated, the task is executed through TAF and CDCS. The task can communicate with the terminal through TAF and the Network Access Method (NAM) and can i n i t i a t e s u b s e q u e n t t a s k s .
Figure 1-5 shows the CDCS/TAF interface. Access to the data base through TAF is concurrent with access in both batch and interactive modes. All access to the data base is monitored by CDCS.
Special commands must be used for processing through TA F. R e f e r t o t h e T r a n s a c t i o n F a c i l i t y r e f e r e n c e manual for information about these commands.
TASK J.IBRARYJ
NAM TAF CDCS D ATABASE
LOG FILES
Figure 1-5. CDCS/TAF Interface
COBOL INTERFACE
/ 0 ^ \
COBOL application programs can be used to access and manipulate a data base controlled by CYBER Data Base Control System (CDCS). The COBOL interface with CDCS consists of the COBOL subschema, the COBOL statements and routines used to access the data base, and the status checking elements avail able to a COBOL program.
I n t h i s s e c t i o n a b a s i c k n o w l e d g e o f C O B O L i s a s s u m e d . T h e C O B O L r e f e r e n c e m a n u a l s h o u l d b e consulted for detailed information about COBOL.
COBOL SUBSCHEMA
The DMS-170 data base files that are to be accessed by a COBOL application program must be described in a d i r e c t o r y c a l l e d a C O B O L s u b s c h e m a . T h e d a t a administrator, working with the application program mers, is responsible for creating the subschemas. When the subschema is compiled, a listing is pro d u c e d . T h e l i s t i n g p r o v i d e s i n f o r m a t i o n r e q u i r e d by the application programmer to code the COBOL a p p l i c a t i o n p r o g r a m . T h e d a t a a d m i n i s t r a t o r s h o u l d provide the application programmer with a compila tion listing of the subschema.
Some information required to access data base files i s n o t i n c l u d e d i n t h e s u b s c h e m a l i s t i n g . I t i s t h e r e s p o n s i b i l i t y o f t h e d a t a a d m i n i s t r a t o r t o provide the application programmer with any neces s a r y a d d i t i o n a l i n f o r m a t i o n .
This subsection documents the information provided b y t h e s u b s c h e m a l i s t i n g a n d t h e a d d i t i o n a l i n f o r m a t i o n t h a t t h e d a t a a d m i n i s t r a t o r m u s t p r o v i d e w h e n t h e i n f o r m a t i o n i s n e c e s s a r y f o r d a t a b a s e
processing.
SUBSCHEMA LISTING
A s u b s c h e m a c o m p i l a t i o n l i s t i n g c a n b e u s e d t o o b t a i n d a t a n a m e s , i t e m d e s c r i p t o r s , a n d o t h e r i n f o r m a t i o n n e e d e d t o p r o c e s s a r e a l m . I f a l i s t ing of the subschema used by the application program is not available, the parameter LO=M can be speci fied on the C0B0L5 control statement. Specification o f t h i s p a r a m e t e r r e s u l t s i n a l i s t i n g t h a t c o n t a i n s t h e d e s c r i p t i o n o f e a c h d a t a i t e m d e fi n e d i n the referenced subschema.
The information provided by the subschema is indi c a t e d b y t h e f o l l o w i n g a l p h a b e t i c l i s t o f i t e m s . N o t a l l i t e m s a r e i n c l u d e d i n e v e r y s u b s c h e m a ; t h o s e i t e m s t h a t a l w a y s a p p e a r i n t h e s u b s c h e m a l i s t i n g a r e s o i n d i c a t e d . F i g u r e 2 - 1 s h o w s a n example of each item in a sample subschema.
Alias names
T h e A l i a s D i v i s i o n i d e n t i fi e s t h e d a t a names and the names of records and realms that are used in the subschema in place of the name used in the schema. The name that follows the keyword BECOMES in the AD clause i s t h e n a m e t h a t m u s t b e r e f e r e n c e d i n a COBOL application program.
Alternate key
The notation ALTERNATE KEY indicates a data i t e m t h a t i s a n a l t e r n a t e r e c o r d k e y. T h e r e a l m f o r w h i c h t h e d a t a i t e m i s a n a l t e r nate key is also indicated.
Checksum
Always present. A checksum is a one-word attribute generated by the DDL compiler for t h e s u b s c h e m a . T h e c h e c k s u m o f t h e s u b schema referenced by the COBOL application p r o g r a m i s i n c o r p o r a t e d i n t h e o b j e c t program at compilation time and must agree at execution time with the checksum asso c i a t e d w i t h t h e s u b s c h e m a i n t h e m a s t e r d i r e c t o r y. R e f e r t o t h e s u b s e c t i o n R e c o m p i l a t i o n G u i d e l i n e s f o r m o r e i n f o r m a t i o n . Data description entry (name and description)
A l w a y s p r e s e n t . D a t a d e s c r i p t i o n e n t r i e s are entries identified by a level number 02 o r g r e a t e r . D a t a d e s c r i p t i o n e n t r i e s i d e n t i f y t h e n a m e a n d d e s c r i p t i o n o f d a t a items. For any data name described by only a PICTURE clause, the usage of DISPLAY is assumed. Any USAGE clause in the subschema indicates usage as described in the COBOL r e f e r e n c e m a n u a l . T h e s a m p l e s u b s c h e m a includes only a few of the data description e n t r i e s t h a t c o u l d b e i n a s u b s c h e m a . F o r d e t a i l e d i n f o r m a t i o n a b o u t d a t a d e s c r i p t i o n entries, refer to the CDCS 2 Data Adminis tration reference manual.
O n l y d a t a b a s e i t e m s r e p r e s e n t e d b y d a t a d e s c r i p t i o n e n t r i e s a r e a v a i l a b l e t o t h e a p p l i c a t i o n p r o g r a m . D a t a r e a d f r o m t h e data base and received in the working stor age area of an application program is mapped according to the subschema description. Group item
A group item is made up of other data items. T h e l o w e r l e v e l n u m b e r , 0 3 i n t h e s u b schema, denotes the group item name. The group item name can be used in COBOL state m e n t s t o q u a l i f y t h e n a m e o f a d a t a i t e m
that is in the group item.
O J 4 - >
I O I O to U 01
o»
O J o O J
oo
U - C J • 2 I u u o
■a c o c i x i m
K I K h
O X t I < 3 QC CL CJ" " O
to UJ
z u
O 3
f t C t
t n ©
E tn tn tn o UJ UJ UJ
O E E £ UJ o o o ffi o o o
UJ UJ UJ -j m oo m
ft
< u u u i I- UJ UJ A uj ae ae o
Q C Q Q . U
oo o e i o - > u i o
a a _i
C O « C C J C J I —
C t C t C t C t
tn < < < <
§.— a> to
J Z t o t s c o c (/) •!- <o <o
J Q X J - P 4 - > 3 i . i d i d ( / > O Q O
• a i -OJ 4-> a.
« 0 3
>
>
c o 0J OJ s- . M + j t s( 0 J -u o E 1 0 O i—
17
o o o o
I E o O on C J •
>
/■nf ^ t o o
■
/
*
oo >o »-*OJ »* s ^\*
«*•
n«* X O n U J <o UJ U l <t UJ UJ ae ec tn oc ae 3 3 3 3 t - t - H i -c j
t-« t - l a . a . a . a .
f t O C
t n • l « c »h cj a. -J
> U 1 £ < H K U I V ) O I
< -J z <
I f t
I I
a. a.
E E UJ ui
oj to **• m »o r-oo
■ i f ■ i i i i
szszsz3e.szsz.szsz
fi fi f t f t f t f t fi fi C t C t C t C t C t C t C t C t
oc oc oc oc oc oc oc oc
o o o o o o o o
* * * * * * * *
* * * * * * * *
oz
U J z0 • •
x • » o > < - . 0 1 o n o » o > - 4 " on o> o» • • ^ V ) O > C N 0 > < O > X UJ
Z IXI UJ UJ UJ UJ UJ m ae oe ae ae ae oe U . 3 3 3 3 3 3 UJ I- I- I- i- i-
t-C t t-C J t-C J < J O t-C J t-C J U I H H H H H H
ae a. a. a. a. a. Ol i - o •h ae ae 3 O O
UJ
\
.
t o ■« * m n o N o o o ^ o
—i i i ■ i
<c <x < < < z z z z z
C t C t C t C t
oc oc oc oc
o o o o
C t C t C t C t C t
oc oc oc oc oc o o o o o
«- I- o» o»o>
O . O J > > >
o» o* o« on 5» >
^\0'*N E^~ ^ <^ /"N ^N <"N CO <~N C/>^N t \ j o t o • # t o
N»» cj CO s* sw «•*>
x oe o< On o«
CO 3 uj i-i cj uj uj uj ae cj ae ae ae 3 U I O 3 3 3 t- to I— I— I— c_> «C cj cj cj
CO
a. a. a. 3
t n
oc oc ft -I
O C t > - f t Z M U J I I I ^ 0 . 0 1
-uj txi < a. z z o o
X 3 =
a. a. E t o t o t o t o
i x i o o o a
ft tn ui uj 1 9 4 J E
I h I — J E U J C J
uj ae • < uj co 3 l c t < u o a
a o < a . i x i z o
i n o K i u o e o i n i n c s
C 3 - 3 t O C t I C J O O Q . X t
OC
t o t o t o o t o t o
0 _ C L C L
CO
z
C O U J
ae a. co
3 E oc
O O 3 f c j I acO
CD O I IXI IXI h-ae oe ©
oo
O n
ae ae co ae co oe 3 3 3 3 3 3
l - l - I - I
-C J C J C J C J f t M f i • - *
a . a . a . a .
z I
U J z
a . o
E > H O C t t
-3 m o o x
oe o
N t i n « M » O v O r N I O N t i n ' O M O O « O t
-t O K &g-t; -t O M -t o -t o : * ^ : £ ^ : * « # ; £ « * ^ ^ i Q i n
o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o
O O O O O O O O O O O O O O O O O O
j f ^ v
J p f e \
•a
E C E
-O r— tO r~ C C O 1 0
tO QJ >» CU cu
^ $ - O J J -
if
O J T J X J.ac cu oj .cu
+ J - M - M +» >» (8 rd <T>
S _ - i - C - ^
f fl C J $ - O •«-> t - + J H C M E o < U O <o • M <Q .*£ .tt • r ( / ) + > ( f l t o i — 1 = c J - v t « — t n cu OJ t u i t ) i d O. (O «C (O OS Q£ cc.ee.oz
^ ui oc oc
T i x i _ i © ©> - f t u . u .o u . i x i _ i I c t o i x i c l * £ i x i u j © IXI © 1X1 1X1 _ j 3 i x l i x l C L « C S Z 3 Z E U J < ixi oe uj co co
< « H H
< <
u j a e t o t s o e © a e z z < i l O h h IX. 0. Q.
ae t- a. a.
© z > - < « c
u. UJ ixl E E E Xt
O h l -H K < I < C J a . a , z e u i © i x i a c j
<>i 1 1
>-
■
t - l
IXI f t 1 U l _ l ce 1
IXI 1-4 3 1
> - u . t-* 1 O 1 UJ 1 - 1 X t t o /
UJ
oe x t V e co
Z - J O U I h
m o e c j t o I f t f t a . o c > E i -H U J I O C t U l t n o c Z fi
o M Z
OJ o
_J UJ IXI u . > -I o
Xt -J
a e a . o E IXI UJ IXI ae cc « c <
t o n o ^ - o o n O
ixi o
S
I
o o c j c j UJ ixl ae ae
ui to to
J U O HH t-l IXI
U. O 0.
O Z C J UJ Ct <c Z M - * I X I A t O t o o • o OJ in to «o to >* m NO
l>-I A t - t O t O m m to m m
o o o o o o o o o
ssss
* *
o o o o o o o o o o>
■
«* >
■
ec sz ec < ae «c
a. en