DBSMNG D A T A B A S E M A N A G E M E N T P A C K A G E Version 3.1 Written by Ray Di Marco Product version 211184 Document version 221184 Target environment DEC PDP-11 (with EIS) TSX-Plus V5.1 (or equivalent) Approved environments TSX-plus RT11 RSTS/E under RT11 emulator. Development system PDP11/73 under TSX-plus V5.1 The DBSMNG package developed from a suite of modules used to facilitate file I/O and complex data manipulation. As the number of modules in the package expanded, management routines were added to combine the individual modules into programs to perform commonly used functions especially those needed to create, maintain and exploit small databases. DBSMNG is designed to support small, homogeneous databases (ie of approximately 100-10000 records), and allows databases to be quickly established and easily maintained. Included in the package are MENU ... a menu management program DBSEDT ... a screen oriented editor REPORT ... a report writer INSKEY ... an online query program BACKUP ... an incremental backup utility other utility programs and FORTRAN/ASSEMBLER callable routines that allow user application programs to interface with a database. TABLE OF CONTENTS The summary Table of Contents on this page identifies chapters and the pages on which they start. The full Table of Contents listing all chapters, sections and subsections starts on the next page. 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . 1 2 Setting up a Database - the Hard Way . . . . . . . . . . . 11 3 Setting up a Database - The Easy Way . . . . . . . . . . . 25 4 MENU: CUSP Chain Manager . . . . . . . . . . . . . . . . . 30 5 DBSEDT: Database Editor . . . . . . . . . . . . . . . . . 40 6 SELECT: Selective Information Extractor . . . . . . . . . 49 7 SORTER: Sorting Utility . . . . . . . . . . . . . . . . . 60 8 INSKEY: Multi-key Database Inspection CUSP . . . . . . . . 62 9 INSPECT: Single-key Online Database Query CUSP . . . . . . 70 10 REPORT: Report Writer . . . . . . . . . . . . . . . . . . 73 11 BACKUP: Backup Utilities . . . . . . . . . . . . . . . . 93 12 Other CUSPs . . . . . . . . . . . . . . . . . . . . . . 99 13 DBSFOR: FORTRAN Interface . . . . . . . . . . . . . . . . 102 14 XXXFOR: General FORTRAN Support Routines . . . . . . . . 115 15 Installation Guide . . . . . . . . . . . . . . . . . . . 121 16 Additional Information . . . . . . . . . . . . . . . . . 122 17 Index . . . . . . . . . . . . . . . . . . . . . . . . . . 123 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Functional Overview . . . . . . . . . . . . . . . . 1 1.2 Implementation Overview . . . . . . . . . . . . . . 2 1.3 Database Concepts . . . . . . . . . . . . . . . . . 2 1.3.1 Homogeneity . . . . . . . . . . . . . . . . . 2 1.3.2 Database Name . . . . . . . . . . . . . . . . 3 1.3.3 Database Template . . . . . . . . . . . . . . 3 1.3.4 Database Files . . . . . . . . . . . . . . . . 3 1.3.5 Database Entries . . . . . . . . . . . . . . . 3 1.3.6 Blocking Factor . . . . . . . . . . . . . . . 3 1.3.7 Database Fields . . . . . . . . . . . . . . . 4 1.3.7.1 Field Name . . . . . . . . . . . . . . . 4 1.3.7.2 Field Size . . . . . . . . . . . . . . . 4 1.3.7.3 Field Type . . . . . . . . . . . . . . . 4 1.3.7.3.1 .ASC. ASCII . . . . . . . . . . . 4 1.3.7.3.2 .ALP. Alphabetic . . . . . . . . . 4 1.3.7.3.3 .NUM. Numeric . . . . . . . . . . 5 1.3.7.3.3.1 Numeric Limit Check . . . . 5 1.3.7.3.4 .DAT. Date . . . . . . . . . . . . 5 1.3.7.4 Protected Fields . . . . . . . . . . . . 5 1.3.7.5 Key Fields . . . . . . . . . . . . . . . 5 1.3.8 Special Fields . . . . . . . . . . . . . . . . 5 1.3.8.1 rn . . . . . . . . . . . . . . . . . . . 5 1.3.8.2 cn . . . . . . . . . . . . . . . . . . . 5 1.3.8.3 st . . . . . . . . . . . . . . . . . . . 5 1.3.8.4 cd . . . . . . . . . . . . . . . . . . . 6 1.3.8.5 ed . . . . . . . . . . . . . . . . . . . 6 1.3.8.6 dd . . . . . . . . . . . . . . . . . . . 6 1.3.8.7 Using Special Fields . . . . . . . . . . 6 1.4 Visual Display Units . . . . . . . . . . . . . . . . 6 1.4.1 Screen Coordinates . . . . . . . . . . . . . . 6 1.4.2 Special Function Keys . . . . . . . . . . . . 7 1.4.3 Screen Layout . . . . . . . . . . . . . . . . 7 1.4.3.1 Pages . . . . . . . . . . . . . . . . . 7 1.4.3.2 Key Page . . . . . . . . . . . . . . . . 7 1.4.3.3 Labels . . . . . . . . . . . . . . . . . 7 1.4.3.4 Field Name . . . . . . . . . . . . . . . 7 1.4.3.5 Field Delimiters . . . . . . . . . . . . 7 1.5 CUSPs . . . . . . . . . . . . . . . . . . . . . . . 7 1.5.1 Customization . . . . . . . . . . . . . . . . 8 1.5.2 Chaining . . . . . . . . . . . . . . . . . . . 8 1.6 Files . . . . . . . . . . . . . . . . . . . . . . . 8 1.6.1 Database . . . . . . . . . . . . . . . . . . . 8 1.6.1.1 Data File . . . . . . . . . . . . . . . 8 1.6.1.2 Key File . . . . . . . . . . . . . . . . 8 1.6.1.3 Parameter File . . . . . . . . . . . . . 9 1.6.2 Template . . . . . . . . . . . . . . . . . . . 9 1.6.3 RPT . . . . . . . . . . . . . . . . . . . . . 9 1.6.4 FRM . . . . . . . . . . . . . . . . . . . . . 9 1.6.4.1 Uparrow Sequence . . . . . . . . . . . . 9 1.6.4.2 Escape Sequence . . . . . . . . . . . . 9 1.6.4.3 Underline Sequence . . . . . . . . . . . 9 1.6.4.4 ^@ Repeat Block Sequence . . . . . . . . 9 1.6.5 SFL . . . . . . . . . . . . . . . . . . . . . 10 1.6.5.1 SFL File Creation . . . . . . . . . . . 10 1.6.5.2 Header Block . . . . . . . . . . . . . . 10 1.6.5.3 Data Blocks . . . . . . . . . . . . . . 10 1.7 Components . . . . . . . . . . . . . . . . . . . . . 10 1.7.1 CUSPs . . . . . . . . . . . . . . . . . . . . 10 1.7.2 Libraries . . . . . . . . . . . . . . . . . . 10 1.7.3 Sources . . . . . . . . . . . . . . . . . . . 10 1.7.4 Example Application . . . . . . . . . . . . . 10 2 Setting up a Database - the Hard Way . . . . . . . . . . . 11 2.1 Environment Definition . . . . . . . . . . . . . . . 11 2.2 EXAMPLE Database Design . . . . . . . . . . . . . . 12 2.3 Template Definition File . . . . . . . . . . . . . . 13 2.3.1 Preamble . . . . . . . . . . . . . . . . . . . 14 2.3.2 Field Declarations . . . . . . . . . . . . . . 14 2.3.3 Key Declarations . . . . . . . . . . . . . . . 14 2.3.3.1 Explicit Key Declarations . . . . . . . 15 2.3.3.2 Implicit Key Declarations . . . . . . . 15 2.3.4 Special Fields . . . . . . . . . . . . . . . . 15 2.4 Template Definition Macros . . . . . . . . . . . . . 16 2.4.1 FORM Macro . . . . . . . . . . . . . . . . . . 17 2.4.1.1 XXXXXX argument . . . . . . . . . . . . 17 2.4.1.2 ENTRIES argument . . . . . . . . . . . . 17 2.4.1.3 BLOCK argument . . . . . . . . . . . . . 17 2.4.1.4 DEVICE Argument . . . . . . . . . . . . 17 2.4.2 FIELD Macro . . . . . . . . . . . . . . . . . 17 2.4.2.1 X argument . . . . . . . . . . . . . . . 17 2.4.2.2 Y argument . . . . . . . . . . . . . . . 18 2.4.2.3 TYPE argument . . . . . . . . . . . . . 18 2.4.2.4 DATA argument . . . . . . . . . . . . . 18 2.4.2.5 XN argument . . . . . . . . . . . . . . 18 2.4.2.6 NAME argument . . . . . . . . . . . . . 18 2.4.2.7 LD argument . . . . . . . . . . . . . . 18 2.4.2.8 RD argument . . . . . . . . . . . . . . 18 2.4.2.9 CHECK argument . . . . . . . . . . . . . 18 2.4.2.10 PROTECT argument . . . . . . . . . . . 18 2.4.2.11 PAGE argument . . . . . . . . . . . . . 19 2.4.2.12 KEY argument . . . . . . . . . . . . . 19 2.4.3 FORMEND Macro . . . . . . . . . . . . . . . . 19 2.4.4 KEY Macro . . . . . . . . . . . . . . . . . . 19 2.4.4.1 X argument . . . . . . . . . . . . . . . 19 2.4.4.2 Y argument . . . . . . . . . . . . . . . 19 2.4.4.3 TYPE argument . . . . . . . . . . . . . 19 2.4.4.4 DATA argument . . . . . . . . . . . . . 20 2.4.4.5 XN argument . . . . . . . . . . . . . . 20 2.4.4.6 NAME argument . . . . . . . . . . . . . 20 2.4.4.7 LD argument . . . . . . . . . . . . . . 20 2.4.4.8 RD argument . . . . . . . . . . . . . . 20 2.4.4.9 CHECK argument . . . . . . . . . . . . . 20 2.4.5 KEYEND Macro . . . . . . . . . . . . . . . . . 20 2.4.6 LABEL Macro . . . . . . . . . . . . . . . . . 20 2.4.6.1 X argument . . . . . . . . . . . . . . . 20 2.4.6.2 Y argument . . . . . . . . . . . . . . . 20 2.4.6.3 LABEL argument . . . . . . . . . . . . . 20 2.4.6.4 PAGE argument . . . . . . . . . . . . . 21 2.4.6.4.1 Key Page Labels . . . . . . . . . 21 2.4.7 SPARE Macro . . . . . . . . . . . . . . . . . 21 2.5 Example Template Definition File . . . . . . . . . . 22 2.6 Creating the TEMPLATE . . . . . . . . . . . . . . . 23 2.7 Initializing the Database . . . . . . . . . . . . . 23 2.8 Hints and Suggestions . . . . . . . . . . . . . . . 24 3 Setting up a Database - The Easy Way . . . . . . . . . . . 25 3.1 Environment Definition . . . . . . . . . . . . . . . 25 3.2 Designing a CARD . . . . . . . . . . . . . . . . . . 26 3.2.1 Specifying Labels . . . . . . . . . . . . . . 26 3.2.2 Specifying Fields . . . . . . . . . . . . . . 26 3.2.2.1 Specifying the Field Type . . . . . . . 26 3.2.2.2 Specifying a Protected Field . . . . . . 27 3.2.2.3 Specifying a Key Field . . . . . . . . . 27 3.2.2.4 Special Fields . . . . . . . . . . . . . 27 3.2.3 Multi-page Database Design . . . . . . . . . . 27 3.3 Creating the TEMPLATE . . . . . . . . . . . . . . . 27 3.4 Initializing the Database . . . . . . . . . . . . . 28 3.5 Example TPL Card . . . . . . . . . . . . . . . . . . 29 4 MENU: CUSP Chain Manager . . . . . . . . . . . . . . . . . 30 4.1 Concepts . . . . . . . . . . . . . . . . . . . . . . 30 4.1.1 Menu . . . . . . . . . . . . . . . . . . . . . 30 4.1.2 Function Keys . . . . . . . . . . . . . . . . 30 4.1.3 CUSP Chains . . . . . . . . . . . . . . . . . 30 4.1.4 Core Common Commands . . . . . . . . . . . . . 30 4.1.5 User Variable . . . . . . . . . . . . . . . . 31 4.1.5.1 Passing User Variable between Menus . . 31 4.2 Invoking MENU . . . . . . . . . . . . . . . . . . . 31 4.2.1 Format File . . . . . . . . . . . . . . . . . 31 4.2.2 CRT type . . . . . . . . . . . . . . . . . . . 31 4.3 Menu Format File . . . . . . . . . . . . . . . . . . 31 4.3.1 Display Definition Section . . . . . . . . . . 32 4.3.2 Function Definition Section . . . . . . . . . 32 4.3.2.1 Action Definition Blocks . . . . . . . . 32 4.3.2.2 Comments . . . . . . . . . . . . . . . . 32 4.3.3 Conditional Blocks . . . . . . . . . . . . . . 32 4.4 MENU Operation . . . . . . . . . . . . . . . . . . . 32 4.4.1 Screen Initialization . . . . . . . . . . . . 33 4.4.2 Slash Function Execution . . . . . . . . . . . 33 4.4.3 Input Wait . . . . . . . . . . . . . . . . . . 33 4.4.4 Digit Key Function Execution . . . . . . . . . 33 4.5 Operators . . . . . . . . . . . . . . . . . . . . . 33 4.5.1 $* Section Delimiter . . . . . . . . . . . . . 33 4.5.2 $=XXX If Terminal of Type XXX . . . . . . . . 33 4.5.3 $#XXX If Terminal NOT of Type XXX . . . . . . 34 4.5.4 $% Conditional Block Terminator . . . . . . . 34 4.5.5 $/ Auto-initiated Function . . . . . . . . . . 34 4.5.6 $0 Action Block for Function Key 0 . . . . . . 34 4.5.7 $1 Action Block for Function Key 1 . . . . . . 34 4.5.8 $2 Action Block for Function Key 2 . . . . . . 34 4.5.9 $3 Action Block for Function Key 3 . . . . . . 34 4.5.10 $4 Action Block for Function Key 4 . . . . . 34 4.5.11 $5 Action Block for Function Key 5 . . . . . 34 4.5.12 $6 Action Block for Function Key 6 . . . . . 34 4.5.13 $7 Action Block for Function Key 7 . . . . . 35 4.5.14 $8 Action Block for Function Key 8 . . . . . 35 4.5.15 $9 Action Block for Function Key 9 . . . . . 35 4.5.16 $! Action Block Terminator . . . . . . . . . 35 4.5.17 $) Output to Terminal . . . . . . . . . . . . 35 4.5.18 $( Input from Terminal . . . . . . . . . . . 35 4.5.19 $D Define User Variable . . . . . . . . . . . 35 4.5.20 $R Restart . . . . . . . . . . . . . . . . . 35 4.5.21 $@ Initiate CUSP Chain . . . . . . . . . . . 35 4.5.21.1 CUSP Chain Initiation . . . . . . . . . 36 4.5.22 $Q Quiet CUSP Chain . . . . . . . . . . . . . 36 4.5.23 $C Include CUSP in Chain . . . . . . . . . . 36 4.5.24 $I Insert Core Common Command . . . . . . . . 36 4.5.25 $~ Substitute System Parameters . . . . . . . 37 4.5.25.1 $~J Operator: Job Number . . . . . . . 37 4.5.25.2 $~P Operator: Primary Line Number . . . 37 4.5.25.3 $~N Operator: User Name . . . . . . . . 37 4.5.25.4 $~V Operator: Flag Virtual Line . . . . 37 4.5.25.5 $~P Operator: Project Number . . . . . 37 4.5.25.6 $~Q Operator: Programmer Number . . . . 37 4.5.25.7 $~( Operator: User Variable . . . . . . 37 4.5.25.8 $~A Operator: Device Assignment . . . . 37 4.6 Hints and Suggestions . . . . . . . . . . . . . . . 37 4.6.1 Core Common Overflow . . . . . . . . . . . . . 37 4.6.2 Very Long CUSP Chains . . . . . . . . . . . . 38 4.6.3 Including VT100 Escape Sequences . . . . . . . 38 4.7 Example Menu . . . . . . . . . . . . . . . . . . . . 39 5 DBSEDT: Database Editor . . . . . . . . . . . . . . . . . 40 5.1 Terminal . . . . . . . . . . . . . . . . . . . . . . 40 5.2 Invoking DBSEDT . . . . . . . . . . . . . . . . . . 40 5.2.1 Using a start-up file . . . . . . . . . . . . 41 5.2.2 CUSP chaining . . . . . . . . . . . . . . . . 41 5.3 Screen Layout . . . . . . . . . . . . . . . . . . . 41 5.3.1 Interaction Area . . . . . . . . . . . . . . . 41 5.3.2 Form Area . . . . . . . . . . . . . . . . . . 41 5.4 Input Modes . . . . . . . . . . . . . . . . . . . . 42 5.4.1 Command Input Mode . . . . . . . . . . . . . . 42 5.4.2 Data Input Mode . . . . . . . . . . . . . . . 42 5.4.2.1 Cursor Movement Keys . . . . . . . . . . 43 5.4.2.1.1 UP . . . . . . . . . . . . . . . . 43 5.4.2.1.2 DOWN . . . . . . . . . . . . . . . 43 5.4.2.1.3 LEFT . . . . . . . . . . . . . . . 43 5.4.2.1.4 RIGHT . . . . . . . . . . . . . . 43 5.4.2.2 Special Function Keys . . . . . . . . . 43 5.4.2.2.1 PF1 . . . . . . . . . . . . . . . 43 5.4.2.2.2 PF2 . . . . . . . . . . . . . . . 43 5.4.2.2.3 PF3 . . . . . . . . . . . . . . . 43 5.4.2.2.4 PF4 . . . . . . . . . . . . . . . 43 5.4.2.3 Control keys . . . . . . . . . . . . . . 43 5.4.2.3.1 TAB . . . . . . . . . . . . . . . 44 5.4.2.3.2 BACKSPACE . . . . . . . . . . . . 44 5.4.2.3.3 DELETE . . . . . . . . . . . . . . 44 5.4.2.3.4 Control-U . . . . . . . . . . . . 44 5.4.2.4 Automatic TABing . . . . . . . . . . . . 44 5.5 Accessing Records . . . . . . . . . . . . . . . . . 44 5.5.1 Explicit Record Access . . . . . . . . . . . . 44 5.5.2 Keyed Record Access . . . . . . . . . . . . . 45 5.6 DBSEDT Commands . . . . . . . . . . . . . . . . . . 45 5.6.1 BYE: Terminate Execution . . . . . . . . . . . 45 5.6.1.1 [RETURN] Implicit Bye Command . . . . . 45 5.6.2 CREATE: Create a New Record . . . . . . . . . 45 5.6.2.1 CREATE N: Create a Copy of Record N . . 45 5.6.3 NEW: Create a New Record . . . . . . . . . . . 46 5.6.3.1 NEW N: Create a Copy of Record N . . . . 46 5.6.4 EDIT: Edit an Existing Record . . . . . . . . 46 5.6.5 INSPECT: Examine Record . . . . . . . . . . . 46 5.6.6 DELETE: Mark Record as Deleted . . . . . . . . 46 5.6.6.1 Recovering DELETED Records . . . . . . . 46 5.6.7 PAGE N: Select Page N . . . . . . . . . . . . 46 5.7 Form Editing Mode Commands . . . . . . . . . . . . . 46 5.7.1 EXIT: Exit Edit Submode . . . . . . . . . . . 47 5.7.1.1 [RETURN] Implicit EXIT Command . . . . . 47 5.7.2 ABORT: Abort Edit Submode . . . . . . . . . . 47 5.7.3 EDIT: Edit Field Data . . . . . . . . . . . . 47 5.7.4 FIRST: Edit First Field . . . . . . . . . . . 47 5.7.5 TOP: Edit Field at Top of Page . . . . . . . . 47 5.7.6 LOCATE: Edit Specified Field . . . . . . . . . 47 5.7.7 PAGE: Select New Page . . . . . . . . . . . . 47 5.7.8 CLEAR: Clear out Record . . . . . . . . . . . 47 5.7.9 REFRESH: Refresh Screen . . . . . . . . . . . 48 6 SELECT: Selective Information Extractor . . . . . . . . . 49 6.1 General Overview . . . . . . . . . . . . . . . . . . 49 6.1.1 FRM File . . . . . . . . . . . . . . . . . . . 49 6.1.1.1 Uparrow Sequence . . . . . . . . . . . . 49 6.1.1.2 Escape Sequence . . . . . . . . . . . . 49 6.1.1.3 Underline Sequence . . . . . . . . . . . 50 6.1.1.4 ^@ Repeat Block Sequence . . . . . . . . 50 6.1.2 SFL File . . . . . . . . . . . . . . . . . . . 50 6.1.2.1 SFL File Creation . . . . . . . . . . . 50 6.1.2.2 Header Block . . . . . . . . . . . . . . 50 6.1.2.3 Data Blocks . . . . . . . . . . . . . . 50 6.1.2.4 Usage . . . . . . . . . . . . . . . . . 50 6.1.2.4.1 Record Selection . . . . . . . . . 51 6.1.2.4.2 Data Extraction . . . . . . . . . 51 6.1.2.4.3 Interfacing to User Programs . . . 51 6.1.3 Record Size . . . . . . . . . . . . . . . . . 51 6.1.4 Cycle . . . . . . . . . . . . . . . . . . . . 51 6.2 Invoking SELECT . . . . . . . . . . . . . . . . . . 51 6.2.1 SELECT Prompts . . . . . . . . . . . . . . . . 51 6.2.1.1 DB Template . . . . . . . . . . . . . . 52 6.2.1.2 Format File . . . . . . . . . . . . . . 52 6.2.1.3 Output File . . . . . . . . . . . . . . 52 6.2.1.4 Record Size . . . . . . . . . . . . . . 52 6.3 SELECT Operation . . . . . . . . . . . . . . . . . . 52 6.3.1 Output Buffer . . . . . . . . . . . . . . . . 52 6.3.2 Output Enable Flag . . . . . . . . . . . . . . 52 6.3.3 Rewinding the Format File . . . . . . . . . . 53 6.4 Arguments . . . . . . . . . . . . . . . . . . . . . 53 6.4.1 Constants . . . . . . . . . . . . . . . . . . 53 6.4.1.1 Numeric Constants . . . . . . . . . . . 53 6.4.1.2 Date Constants . . . . . . . . . . . . . 53 6.4.1.3 Literal Constants . . . . . . . . . . . 53 6.4.2 Variables . . . . . . . . . . . . . . . . . . 53 6.4.2.1 Numeric Variables . . . . . . . . . . . 53 6.4.2.2 Date Variables . . . . . . . . . . . . . 54 6.4.2.2.1 D4: System Date . . . . . . . . . 54 6.4.2.3 Literal Variables . . . . . . . . . . . 54 6.4.2.4 Variable Passing Between CUSPs . . . . . 54 6.4.3 Field Contents . . . . . . . . . . . . . . . . 54 6.4.3.1 Direct Field Access . . . . . . . . . . 54 6.4.3.2 Indirect Field Access . . . . . . . . . 54 6.5 SELECT Operators . . . . . . . . . . . . . . . . . . 54 6.5.1 $$ End of Block . . . . . . . . . . . . . . . 55 6.5.2 $E End of Program . . . . . . . . . . . . . . 55 6.5.3 $* Marking Rewind Point . . . . . . . . . . . 55 6.5.4 $A Append to Existing SFL Contents . . . . . . 55 6.5.5 $R Range Specification . . . . . . . . . . . . 55 6.5.6 $) Output to Terminal . . . . . . . . . . . . 55 6.5.7 $? Input Data from Terminal . . . . . . . . . 55 6.5.8 $( Input Field Name from Terminal . . . . . . 56 6.5.9 $T Do Tests . . . . . . . . . . . . . . . . . 56 6.5.9.1 Output Enable Flag . . . . . . . . . . . 56 6.5.9.1.1 OEF Initialization . . . . . . . . 56 6.5.9.1.2 OEF Setting . . . . . . . . . . . 56 6.5.9.2 $C Clear OEF . . . . . . . . . . . . . . 56 6.5.9.3 Boolean Statements . . . . . . . . . . . 56 6.5.9.3.1 .EQ. Boolean-Operator . . . . . . 57 6.5.9.3.2 .NE. Boolean-Operator . . . . . . 57 6.5.9.3.3 .LT. Boolean-Operator . . . . . . 57 6.5.9.3.4 .GT. Boolean-Operator . . . . . . 57 6.5.9.3.5 .LE. Boolean-Operator . . . . . . 57 6.5.9.3.6 .GE. Boolean-Operator . . . . . . 57 6.5.10 $L Load Data . . . . . . . . . . . . . . . . 57 6.5.10.1 Output Buffer . . . . . . . . . . . . . 57 6.5.10.2 Imbedded Operators . . . . . . . . . . 57 6.5.10.2.1 $< Trim . . . . . . . . . . . . . 57 6.5.10.2.2 $> Right Justify . . . . . . . . 57 6.5.10.2.3 $:DD Position . . . . . . . . . . 58 6.5.10.2.4 $^ Uppercase . . . . . . . . . . 58 6.5.10.2.5 $~ Flush . . . . . . . . . . . . 58 6.5.10.2.6 $S Switch . . . . . . . . . . . . 58 6.5.10.2.7 $# Convert to Ascii . . . . . . . 58 6.5.10.2.8 $- Delete Character . . . . . . . 58 6.6 Example Format Files . . . . . . . . . . . . . . . . 58 7 SORTER: Sorting Utility . . . . . . . . . . . . . . . . . 60 7.1 Using SORTER . . . . . . . . . . . . . . . . . . . . 60 7.2 Optional SORTER Switches . . . . . . . . . . . . . . 60 7.2.1 /R Reverse Order Switch . . . . . . . . . . . 60 7.2.2 /S Statistics Switch . . . . . . . . . . . . . 60 7.2.3 /P Pause Switch . . . . . . . . . . . . . . . 60 7.3 Operational Description . . . . . . . . . . . . . . 61 7.4 Interfacing to SORTER . . . . . . . . . . . . . . . 61 8 INSKEY: Multi-key Database Inspection CUSP . . . . . . . . 62 8.1 Invoking INSKEY . . . . . . . . . . . . . . . . . . 62 8.1.1 Using a start-up file . . . . . . . . . . . . 62 8.1.2 Using CUSP chaining from a menu . . . . . . . 62 8.2 Screen Layout . . . . . . . . . . . . . . . . . . . 63 8.2.1 Interaction Area . . . . . . . . . . . . . . . 63 8.2.2 Form Area . . . . . . . . . . . . . . . . . . 63 8.3 Input Modes . . . . . . . . . . . . . . . . . . . . 63 8.3.1 Command Input Mode . . . . . . . . . . . . . . 63 8.3.2 Keyword Input Mode . . . . . . . . . . . . . . 63 8.3.2.1 Cursor Movement Keys . . . . . . . . . . 64 8.3.2.1.1 UP . . . . . . . . . . . . . . . . 64 8.3.2.1.2 DOWN . . . . . . . . . . . . . . . 64 8.3.2.1.3 LEFT . . . . . . . . . . . . . . . 64 8.3.2.1.4 RIGHT . . . . . . . . . . . . . . 64 8.3.2.2 Special Function Keys . . . . . . . . . 64 8.3.2.2.1 PF1 . . . . . . . . . . . . . . . 64 8.3.2.2.2 PF2 . . . . . . . . . . . . . . . 64 8.3.2.2.3 PF3 . . . . . . . . . . . . . . . 64 8.3.2.2.4 PF4 . . . . . . . . . . . . . . . 64 8.3.2.3 Control keys . . . . . . . . . . . . . . 64 8.3.2.3.1 TAB . . . . . . . . . . . . . . . 64 8.3.2.3.2 BACKSPACE . . . . . . . . . . . . 64 8.3.2.3.3 DELETE . . . . . . . . . . . . . . 64 8.3.2.3.4 Control-U . . . . . . . . . . . . 65 8.4 Using Keywords to Identify Records of Interest . . . 65 8.4.1 Keywords and Keys . . . . . . . . . . . . . . 65 8.4.2 Keyword . . . . . . . . . . . . . . . . . . . 65 8.4.2.1 Spaces . . . . . . . . . . . . . . . . . 65 8.4.2.2 Lower Case . . . . . . . . . . . . . . . 65 8.4.3 Comma Delimiter: Approximate Match . . . . . . 65 8.4.4 Semicolon Delimiter: Exact Match . . . . . . . 65 8.4.5 Multiple Keywords . . . . . . . . . . . . . . 66 8.4.6 Adding Keywords . . . . . . . . . . . . . . . 66 8.5 INSKEY Commands . . . . . . . . . . . . . . . . . . 66 8.5.1 [RETURN] Key . . . . . . . . . . . . . . . . . 66 8.5.2 E Command (Exit) . . . . . . . . . . . . . . . 66 8.5.3 H Command (Help) . . . . . . . . . . . . . . . 66 8.5.4 K Command (Keywords) . . . . . . . . . . . . . 66 8.5.5 A Command (Add-keywords) . . . . . . . . . . . 66 8.5.6 N Command (Next) . . . . . . . . . . . . . . . 67 8.5.7 P Command (Print) . . . . . . . . . . . . . . 67 8.5.8 F Command (Flip-page) . . . . . . . . . . . . 67 8.5.9 R command (Refresh) . . . . . . . . . . . . . 67 8.6 Using INSKEY . . . . . . . . . . . . . . . . . . . . 67 8.7 Setting up INSKEY . . . . . . . . . . . . . . . . . 68 8.7.1 Invoking INSKEY from a Menu . . . . . . . . . 68 8.7.2 Setting up the INDEX File . . . . . . . . . . 68 8.7.2.1 Creating the INDEX File . . . . . . . . 68 8.7.2.2 Loading Keys into the INDEX File . . . . 68 8.7.2.3 Sorting the INDEX File . . . . . . . . . 69 8.7.2.4 Generating the INDEX File from a Menu . 69 8.7.3 Setting up the HELP File . . . . . . . . . . . 69 9 INSPECT: Single-key Online Database Query CUSP . . . . . . 70 9.1 Concepts . . . . . . . . . . . . . . . . . . . . . . 70 9.1.1 Target . . . . . . . . . . . . . . . . . . . . 70 9.1.2 Target Fields . . . . . . . . . . . . . . . . 70 9.1.3 Index File . . . . . . . . . . . . . . . . . . 70 9.2 Using INSPECT . . . . . . . . . . . . . . . . . . . 71 9.3 Application Notes . . . . . . . . . . . . . . . . . 71 9.3.1 Target Fields . . . . . . . . . . . . . . . . 71 9.3.2 Creating the Index File . . . . . . . . . . . 72 9.3.3 Creating the FRM file for SELECT . . . . . . . 72 9.3.4 Setting up the Index File . . . . . . . . . . 72 10 REPORT: Report Writer . . . . . . . . . . . . . . . . . . 73 10.1 Background . . . . . . . . . . . . . . . . . . . . 73 10.1.1 FRM File . . . . . . . . . . . . . . . . . . 73 10.1.1.1 Uparrow Sequence . . . . . . . . . . . 73 10.1.1.2 Escape Sequence . . . . . . . . . . . . 74 10.1.1.3 Underline Sequence . . . . . . . . . . 74 10.1.1.4 ^@ Repeat Block Sequence . . . . . . . 74 10.1.1.5 TPLREP CUSP . . . . . . . . . . . . . . 74 10.1.1.6 SFL File . . . . . . . . . . . . . . . 74 10.1.1.6.1 Header Block . . . . . . . . . . 74 10.1.1.6.2 Data Blocks . . . . . . . . . . . 74 10.1.1.6.3 Usage . . . . . . . . . . . . . . 75 10.1.1.6.4 Entry Size . . . . . . . . . . . 75 10.2 Invoking REPORT . . . . . . . . . . . . . . . . . . 75 10.2.1 Prompt: DB Template . . . . . . . . . . . . . 75 10.2.2 Prompt: Format File . . . . . . . . . . . . . 75 10.2.3 Prompt: Sorter File . . . . . . . . . . . . . 75 10.2.3.1 Omitting Sorter File . . . . . . . . . 75 10.2.4 Prompt: Output File . . . . . . . . . . . . . 76 10.3 REPORT Operational Overview . . . . . . . . . . . . 76 10.3.1 REPORT Cycle . . . . . . . . . . . . . . . . 76 10.3.2 Rewinding the FRM File . . . . . . . . . . . 76 10.3.3 REPORT ($X) Operators . . . . . . . . . . . . 76 10.3.4 REPORT Variables . . . . . . . . . . . . . . 77 10.3.4.1 ! Primary Files . . . . . . . . . . . . 77 10.3.4.2 @ Terminal . . . . . . . . . . . . . . 77 10.3.4.3 A-Z Memory Variables . . . . . . . . . 77 10.3.5 I/O Stream Selection . . . . . . . . . . . . 77 10.3.5.1 Assign RPT File Output Stream . . . . . 77 10.3.5.2 Assign Terminal Output Stream . . . . . 77 10.3.5.3 Assign Memory Variable Output Stream . 77 10.3.5.4 Assign FRM File Input Stream . . . . . 77 10.3.5.5 Assign Terminal Input Stream . . . . . 77 10.3.5.6 Assign Memory Variable Input Stream . . 78 10.3.6 Memory Variable Initialization . . . . . . . 78 10.3.6.1 Memory Variable F Initialization . . . 78 10.3.7 BCD Binary Coded Decimal . . . . . . . . . . 79 10.4 FRM File Structure . . . . . . . . . . . . . . . . 79 10.4.1 Header Section . . . . . . . . . . . . . . . 79 10.4.2 Body Section . . . . . . . . . . . . . . . . 79 10.4.3 Trailer Section . . . . . . . . . . . . . . . 79 10.4.4 All Records Processed Event Handling . . . . 80 10.5 REPORT Operators . . . . . . . . . . . . . . . . . 80 10.5.1 Summary of Operators . . . . . . . . . . . . 80 10.5.1.1 REPORT Main Operators . . . . . . . . . 80 10.5.1.2 REPORT $B (BCD) sub-operators . . . . . 81 10.5.1.3 REPORT $BF (BCD format) sub-operators . 81 10.5.1.4 REPORT $T (TEST) sub-operators . . . . 81 10.5.1.5 REPORT $< (field data) sub-operators . 82 10.5.2 $B BCD Operator . . . . . . . . . . . . . . . 82 10.5.2.1 + BCD addition sub-operator . . . . . . 82 10.5.2.2 - BCD subtraction sub-operator . . . . 82 10.5.2.3 I BCD increment sub-operator . . . . . 82 10.5.2.4 D BCD decrement sub-operator . . . . . 83 10.5.2.5 Z BCD zero sub-operator . . . . . . . . 83 10.5.2.6 F BCD format sub-operator . . . . . . . 83 10.5.3 $C Comment . . . . . . . . . . . . . . . . . 84 10.5.4 $D Dating . . . . . . . . . . . . . . . . . . 84 10.5.5 $E Terminate if all Records Processed . . . . 84 10.5.6 $F Format Operator . . . . . . . . . . . . . 84 10.5.7 $I Switch Input Stream . . . . . . . . . . . 85 10.5.8 $M Select Termination Mode . . . . . . . . . 85 10.5.8.1 M1 Termination Mode . . . . . . . . . . 85 10.5.8.2 M2 Termination Mode . . . . . . . . . . 85 10.5.8.3 M3 Termination Mode . . . . . . . . . . 85 10.5.8.4 M4 Termination Mode . . . . . . . . . . 85 10.5.9 $N Next Record . . . . . . . . . . . . . . . 86 10.5.10 $O Output Stream . . . . . . . . . . . . . . 86 10.5.11 $P Pagination . . . . . . . . . . . . . . . 86 10.5.12 $R Define Ruler . . . . . . . . . . . . . . 86 10.5.13 $T Test Operator . . . . . . . . . . . . . . 86 10.5.13.1 $TE End of Section Marker . . . . . . 87 10.5.13.2 $TR Special End of Section Marker . . 87 10.5.13.3 $T= Skip if Variables Equal . . . . . 87 10.5.13.4 $T= Skip if Variables Equal . . . . . 87 10.5.13.5 $T# Skip if Variables Not Equal . . . 87 10.5.13.6 $T- Skip if Variable Less Than 0 . . . 87 10.5.13.7 $T0 Skip if Variable is 0 . . . . . . 87 10.5.13.8 $T+ Skip if Variable Greater Than 0 . 87 10.5.14 $< Extract Field Data . . . . . . . . . . . 87 10.5.14.1 Field Name . . . . . . . . . . . . . . 88 10.5.14.1.1 Field Name in Variable . . . . . 88 10.5.14.2 Extracted Data: Numeric Fields . . . . 88 10.5.14.3 Extracted Data: Date Fields . . . . . 88 10.5.14.4 Extracted Data: Ascii Fields . . . . . 88 10.5.14.5 Terminators . . . . . . . . . . . . . 88 10.5.15 $; Suppress RPT Output . . . . . . . . . . . 89 10.5.16 $: Absolute Position . . . . . . . . . . . . 89 10.5.17 $) Output to Terminal . . . . . . . . . . . 89 10.5.18 $\ Section Delimiter . . . . . . . . . . . . 89 10.5.19 $= Terminate if Variables Equal . . . . . . 89 10.5.20 $# Terminate if Variables Not Equal . . . . 89 10.5.21 $* Section Delimiter . . . . . . . . . . . . 90 10.6 Example FRM Files . . . . . . . . . . . . . . . . . 90 11 BACKUP: Backup Utilities . . . . . . . . . . . . . . . . 93 11.1 Function . . . . . . . . . . . . . . . . . . . . . 93 11.1.1 BACKUT . . . . . . . . . . . . . . . . . . . 93 11.1.2 BACKUP . . . . . . . . . . . . . . . . . . . 93 11.1.3 BACKUF . . . . . . . . . . . . . . . . . . . 93 11.1.4 BACKUN . . . . . . . . . . . . . . . . . . . 94 11.1.5 CUSP Chaining . . . . . . . . . . . . . . . . 94 11.2 Information Required . . . . . . . . . . . . . . . 94 11.3 Backup File . . . . . . . . . . . . . . . . . . . . 94 11.4 Using BACKUP in an Application . . . . . . . . . . 95 11.5 Example MENU and SELECT Format Files . . . . . . . 97 12 Other CUSPs . . . . . . . . . . . . . . . . . . . . . . 99 12.1 CMDDSP: Dispatch Command to Monitor . . . . . . . . 99 12.2 DBSCPY: Copy Database . . . . . . . . . . . . . . . 99 12.3 DBSMAK: Make Database . . . . . . . . . . . . . . . 100 12.4 DBSSTS: TEMPLATE Disassembler . . . . . . . . . . . 100 12.5 DBSTPL: Template Compiler . . . . . . . . . . . . . 100 12.6 FINDER: Find Matching Records in SFL File . . . . . 100 12.7 PURGER: Purge Database Records . . . . . . . . . . 101 13 DBSFOR: FORTRAN Interface . . . . . . . . . . . . . . . . 102 13.1 Using DBSFOR . . . . . . . . . . . . . . . . . . . 103 13.2 Accessing a database . . . . . . . . . . . . . . . 103 13.3 Overheads . . . . . . . . . . . . . . . . . . . . . 103 13.4 Multiple database access . . . . . . . . . . . . . 103 13.5 Error handling . . . . . . . . . . . . . . . . . . 104 13.6 Channel Purging . . . . . . . . . . . . . . . . . . 104 13.7 DBSFOR Calling Sequences . . . . . . . . . . . . . 104 13.7.1 Function 0: Record Read . . . . . . . . . . . 104 13.7.2 Function 1: Record Write . . . . . . . . . . 104 13.7.3 Function 2: Field Get . . . . . . . . . . . . 105 13.7.4 Function 3: Field Put . . . . . . . . . . . . 105 13.7.5 Function 4: Read Keys . . . . . . . . . . . . 105 13.7.6 Function 5: Write Keys . . . . . . . . . . . 105 13.7.7 Function 6: Key Number . . . . . . . . . . . 106 13.7.8 Function 7: Database Size . . . . . . . . . . 106 13.7.9 Function 8: Database Name . . . . . . . . . . 106 13.7.10 Function 9: Database Select . . . . . . . . 106 13.7.11 Function 10: Database Initialize . . . . . . 106 13.7.12 Function 11: Return Date (Internal Format) . 106 13.7.13 Function 12: To Internal Date Format . . . . 106 13.7.14 Function 13: From Internal Date Format . . . 107 13.7.15 Function 14: Date Comparison . . . . . . . . 107 13.7.16 Function 15: Special Database Initialize . . 107 13.7.17 Function 16: Envoke FORM Editor . . . . . . 107 13.7.18 Function 17: Interface Initialize . . . . . 108 13.7.19 Function 18: Exit . . . . . . . . . . . . . 108 13.7.20 Function 19: Erase Screen . . . . . . . . . 108 13.7.21 Function 20: Input Character . . . . . . . . 108 13.7.22 Function 21: Output Character . . . . . . . 108 13.7.23 Function 22: Input Line . . . . . . . . . . 109 13.7.24 Function 23: Output Line . . . . . . . . . . 109 13.7.25 Function 24: Erase Line . . . . . . . . . . 109 13.7.26 Function 25: Position Cursor . . . . . . . . 109 13.7.27 Function 26: Initialize Core Common . . . . 109 13.7.28 Function 27: Core Common Chain . . . . . . . 109 13.7.29 Function 28: Core Common Input . . . . . . . 109 13.7.30 Function 29: Core Common Check . . . . . . . 109 13.7.31 Function 30: Return Field Attributes . . . . 110 13.7.32 Function 31: Set Field Attributes . . . . . 110 13.7.33 Function 32: Initialize Database . . . . . . 110 13.8 Examples . . . . . . . . . . . . . . . . . . . . . 110 14 XXXFOR: General FORTRAN Support Routines . . . . . . . . 115 14.1 Error handling . . . . . . . . . . . . . . . . . . 115 14.2 CONFOR: Core-Common and Console Support . . . . . . 115 14.3 SRTFOR: SFL File I/O Support . . . . . . . . . . . 116 14.3.1 Rewind SFL File . . . . . . . . . . . . . . . 116 14.3.2 Close SFL File . . . . . . . . . . . . . . . 116 14.3.3 Read SFL File Parameters . . . . . . . . . . 116 14.3.4 Setup SFL File Parameters . . . . . . . . . . 117 14.3.5 Read SFL File Data . . . . . . . . . . . . . 117 14.3.6 Write to SFL File . . . . . . . . . . . . . . 117 14.3.7 Chain to SORTER . . . . . . . . . . . . . . . 117 14.3.8 Chain to Specified Program . . . . . . . . . 117 14.3.9 Peek at SFL Header Block . . . . . . . . . . 117 14.3.10 Poke into SFL Header Block . . . . . . . . . 117 14.3.11 Open SFL File . . . . . . . . . . . . . . . 118 14.3.12 Position at Specified Record . . . . . . . . 118 14.4 FNDFOR: Find Matching Entry in SFL File . . . . . . 118 14.4.1 Opening SFL File . . . . . . . . . . . . . . 118 14.4.2 Rewind File . . . . . . . . . . . . . . . . . 118 14.4.3 Position at Specific Entry . . . . . . . . . 118 14.4.4 Read SFL File Parameters . . . . . . . . . . 118 14.4.5 Locate Matching Entries . . . . . . . . . . . 119 14.4.6 Read SFL Data . . . . . . . . . . . . . . . . 119 14.4.7 Example use of FNDFOR . . . . . . . . . . . . 120 15 Installation Guide . . . . . . . . . . . . . . . . . . . 121 15.1 Running under RSTS/E . . . . . . . . . . . . . . . 121 16 Additional Information . . . . . . . . . . . . . . . . . 122 16.1 RT-11 and RSTS/E differences . . . . . . . . . . . 122 16.2 Supporting a Different Terminal Type . . . . . . . 122 16.3 Module Documentation . . . . . . . . . . . . . . . 122 16.4 Obtaining additional help and information . . . . . 122 17 Index . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Chapter 1 Introduction This chapter is intended as a general introduction to familiarize the reader with DBSMNG terminology and concepts, and to provide a summary of the material presented in the rest of the document. 1.1 Functional Overview The DBSMNG (Database Management) package was designed to allow a homogeneous database to be quickly set up on the smaller DEC computers, and provides the application manager with a number of tools to simplify the integration of such a database into an application subsystem. DBSMNG provides the application manager with the following A simple method of defining the structure of the database. This is done by means of a TEMPLATE which defines the name and attributes of the fields that make up a record. A MENU program that can be used to invoke other database utility programs and pass them commands. This allows the database/application manager to protect the user from the complexities of the computer/operating system being used. A screen oriented EDITOR which allows records to be created, edited and deleted. The editor supports protected and database managed fields, and was designed for use by persons with little or no computer experience. A typical secretary or clerical assistant requires one to three hours of training to be able to effectively use the editor. A REPORT generation subsystem which allows specific records to be selected and used to generate user formatted reports. The selected records can be sorted by any field and the report format can be easily changed. An online QUERY subsystem which allows records to be quickly retrieved for inspection and optionally listed on a printer. This subsystem supports multiple keywords. A BACKUP program that allows selected records to be archived and retrieved. This program can operate in incremental backup mode (ie only records that have been changed are archived), and is very useful when large, frequently modified databases are used. FORTRAN interfaces which allow database records to be accessed and the DBSMNG utilities (eg SORTER) to be invoked from a user application program. The FORTRAN interface allows multiple databases to be accessed simultaneously, and allows record data to be accessed via logical field name, thereby providing data abstraction. DBSMNG: Database Management Package 1 The package is currently in use on a number of different computer systems, including a floppy based PDP11/03, hard disk based PDP11/23s and a PDP11/40, and can be used under the RT-11, TSX-plus and RSTS/E operating systems. 1.2 Implementation Overview The DBSMNG kit contains a number of programs. Each program is designed to do one (and only one) task. Complex functions are implemented by chaining together a number of programs (just as one would do under UNIX). This allows each program to be optimized for the function it is to perform. A special program is provided in the kit to allow the chaining together of programs. This program can also be used to hide the idiosyncrasies of the operating system from the novice user. A very simple file structure is used to store data. While the structure is very robust and allows for easy expansion, it does not allow for rapid location of data. This difficulty is overcome by means of a sorted index file which is easily generated with the tools provided, and can be used with the online query programs for the rapid retrieval of data. DBSMNG is implemented in DEC MACRO-11 assembler. This has been done to ensure minimal memory requirements and to minimize processor loading. The overlay facility of the RT-11 linker is used to further reduce memory requirements. 1.3 Database Concepts A database is typically established to simplify the storage and retrieval of related items of data, and consists of a set of homogeneous records, each of which is divided into a number of fields. Each record is uniquely identified by a 16 bit integer number, termed the RECORD NUMBER, and each field by a unique ASCII name termed the FIELD NAME. In some applications, more than one database may be used, therefore each database has a unique six letter name, termed the Database Name, that unambiguously identifies it. In summary, a database is identified by a unique six letter name, and consists of a set of numbered records, each of which consists of a set of named fields. 1.3.1 Homogeneity - DBSMNG is designed to operate on databases that have records of fixed length and with identical attributes for corresponding fields in each record. Such databases are termed homogeneous (as all records are identically structured). While this tends to be inefficient in terms of disk usage, the resulting increases in speed and security were considered more important. DBSMNG: Database Management Package 2 1.3.2 Database Name - For added security, each database must be assigned a unique six letter name, termed the Database Name, when it is first created. This name is used by the package as an added security check when performing critical operations. The sequence XXXXXX is used in this documentation to represent a database name. 1.3.3 Database Template - The structure of a homogeneous database is completely defined by describing the fields that make up one record. This description is called the Template, and defines the logical name and attributes of the fields in each record. DBSMNG requires that a template be created and made available for it to access a database. Such a template is easily created and consists of a simple definition for each field in a record, declaring its logical name and attributes. Once created it can be used to generate the customized version of the CUSPs (not normally recommended), or to produce a loadable version of the template (termed the TEMPLATE) that can be used with the uncustomized CUSPs. 1.3.4 Database Files - A DBSMNG database consists of three files. These files have identical names but different extensions. These files are created by the DBSMAK utility, and are XXXXXX.DAT ... holds data records XXXXXX.KEY ... holds access keys XXXXXX.PAR ... holds parameters where XXXXXX is the 6 letter database name The data is stored in the DAT file as a series of records. To achieve rapid record access, the KEY file is used to index into the data file. The parameter file consists of one block and is used to store auxiliary information associated with the database. 1.3.5 Database Entries - The size of a database is determined by the number of records that can be simultaneously stored and the blocking factor used (viz the amount of disk storage used per block). The number of records that can be simultaneously stored is called the number of entries in the database, and must be specified when the database template is created. (The number of entries can in fact be changed at a later time.) 1.3.6 Blocking Factor - For various reasons (mostly to simplify access), information is stored on disk in units called Blocks. Each disk block can hold 512 bytes of data. The blocking factor determines the number of records that are to be stored in each disk block, or in the case of large records, the number of disk blocks occupied by each record. The blocking factor is represented as a signed integer. If no blocking factor is explicitly declared for a database, DBSMNG will automatically assign the smallest blocking factor possible. The table below shows the meaning of the various blocking factors available. factor meaning +N each record occupies N blocks +1 each record occupies 1 blocks 0 each record occupies 1 blocks -1 each record occupies 1 blocks -2 two records are stored per block -3 four records are stored per block -4 eight records stored per block DBSMNG: Database Management Package 3 -N 2**(N-1) records stored per block 1.3.7 Database Fields - A database consists of a number of records, and each record consists of a number of fields. A field is an information grouping and has a logical name and attributes. All data grouped into a field must be of the same type, and the information groupings should be small enough to allow the data to be easily manipulated. It is important to use as many fields as possible in a record, as a field is the smallest addressable entity, and it is not possible (without writing your own application program) to access only a portion of the information in a field. An excellent example of the advantage in using many fields to store a item of data is in storing addresses. Assume that one database contains a field called ADDRESS, in which all the address information is stored, while another stores the same information, but in the set of fields called STREET, SUBURB and POSTCODE, and it becomes necessary to produce a report with the records sorted in order of ascending ADDRESS. In reality, this has to be done by sorting records by SUBURB, and within each SUBURB by STREET. This is easy to do with the second database, but impossible with the first. 1.3.7.1 Field Name - Each field must be assigned a unique name, as DBSMNG only allows data within a record to be accessed via its logical name. It is strongly suggested that each field be given a meaningful name that indicates the information it stores. A field name can consists of from 1 to 127 characters. Fields with the following names are reserved rn cn st cd ed dd as they are automatically updated by the DBSMNG CUSPs. See below for more information. 1.3.7.2 Field Size - The size of a field determines the amount of information that can be stored in it. It is important to correctly size a field to ensure that it can hold all desired information, and to divide the record into as many meaningful fields as possible. 1.3.7.3 Field Type - DBSMNG supports four different types of fields, and stores the information within each in a different manner. The four different types are identified by five letter sequences. 1.3.7.3.1 .ASC. ASCII - type fields are used to store a series of characters. The number of characters that can be stored in the field depends on its length. Characters are stored one per byte. 1.3.7.3.2 .ALP. Alphabetic - type fields are used to store series of alphabetic characters. The following ascii characters make up the alphabetic subset .ABCDEFGHIJKLMNOPQRSTUVWXYZ The number of characters that can be stored in the field depends on its length. Characters are stored one per byte. DBSMNG: Database Management Package 4 1.3.7.3.3 .NUM. Numeric - type fields are used to store numbers in the range 0 to 65535. A numeric field requires two bytes. (The least significant bits are stored in the low order byte.) 1.3.7.3.3.1 Numeric Limit Check - Each numeric field may be assigned a check attribute. The check attribute is used to limit the size of the numbers that can be stored in a numeric field. 1.3.7.3.4 .DAT. Date - type fields are used to store dates in the range 1-1-72 to 31-12-99. A date field requires two bytes. (Bits 4-0 represent the day of the month, 8-5 the month of the year, and 15-11 the number of the year relative to 1972.) 1.3.7.4 Protected Fields - any field may be assigned a protection attribute. Assigning a field a protection attribute prevents the changing of the contents of that field by means of the database editor. 1.3.7.5 Key Fields - DBSMNG allows up to 15 fields to be declared as keys. Such fields are are specially handled by DBSMNG to allow then to be used to quickly locate any records that contain specified data in a given key field. 1.3.8 Special Fields - DBSMNG supports six special fields. These special fields are identified by their logical names which consist of two lower case characters. When included in the template, they must be protected (ie assigned a protect attribute of 1) to ensure that their contents can only be modified by DBSMNGDBSMNG. They are normally placed on the bottom line of page 0. The fields and their usage is explained below. 1.3.8.1 rn - The database file is segmented into a number of slots. These are numbered from 0 to N, where N is the number of entries in the database. Each slot is used to hold the data for one record. When a new record is created, DBSMNG allocates the first free slot to hold that record's data. The 'rn' field always holds the number of the slot that has been assigned to the record. This number can be used to explicitly access a record and for integrity checking. The 'rn' field is of type .NUM. . 1.3.8.2 cn - The 'cn' field is of type .NUM.. Each record is assigned a unique 'cn' number when it is created. DBSMNG allocates a 'cn' number of 1 to the first record created, and each new record that is created is allocated the next integer value. The field is particularly useful in transaction type applications, where transaction records have to be tied back to a database record. Because the 'cn' number is uniquely allocated by DBSMNG, using it to tag transactions will guarantee that the transaction can be used to locate its associated record (as long as the record is still in the database). 1.3.8.3 st - The 'st' field is of type .ASC. and is two bytes in size. It is used by to indicate the status of a record. Currently allocated status codes are NW for records in the process of being created (ie new), AC for currently active records, and DE for records that have been deleted and are awaiting purging. (Note that a deleted record must be purged before its data is erased and its slot in the data file released for re-use.) DBSMNG: Database Management Package 5 1.3.8.4 cd - This .DAT. type field is loaded with the system date at the time the record is created. It indicates when the record was created. 1.3.8.5 ed - This .DAT. type field is loaded with the system date each time the record is edited. It indicates when the data in the record was last modified. 1.3.8.6 dd - This .DAT. type field is loaded with the system date at the time the record is marked for deletion. It indicates when deletion of the record was requested. 1.3.8.7 Using Special Fields - It is strongly suggested that all six special fields be included in the user template, and that the "rn", "cn" and "st" fields be defined as key fields. If none of the special fields are explicitly defined in the template, DBSMNG will automatically include all six special fields into the user's database. This requires an additional twelve bytes of storage per record. If this additional room can not be afforded, only those special fields required for the application may be explicitly defined. Explicitly defining any one of the special fields prevents the automatic inclusion of all six into the user's database. ---NOTE--- The "rn" special field must always be included. The "st" special field must be included if the DBSMNG editor is to be used. 1.4 Visual Display Units DBSMNG interacts with the operator by means of a Visual Display Unit (VDU). The package currently supports the following terminals VT100 VT52 ADM32 VC404 TVI912 ISC8001g Support for additional VDU types can be quickly included by writing a driver module and updating a table. 1.4.1 Screen Coordinates - Any point on the VDU screen can be uniquely identified by specifying an X and Y coordinate. The X coordinate represents the column number. The left most column is numbered 0, and the right most 79 (decimal). The Y coordinate represents the line number. The top most line is numbered 0, and the bottom line (on a 24 line screen) 23 (decimal). DBSMNG: Database Management Package 6 1.4.2 Special Function Keys - The VDU drivers provided on the DBSMNG kit support special function keys. When one of the non-standard keys (eg VT100 PF1, PF2 etc) is pressed, the driver modules return special key codes. Special function keys can be simulated on VDUs that lack additional keys by prefixing a normal key with an [ESCAPE]. 1.4.3 Screen Layout - Because DBSMNG is intended primarily for small applications, the template specifies the screen layout to be used to display data to the operator as well as the definition of the database structure. This has been found to be extremely convenient as only one file needs be modified when changing the record structure. 1.4.3.1 Pages - It is best to display all the information for a record on the screen at once. Unfortunately, this is impossible if the record becomes too large. DBSMNG supports multiple pages which allows the data in a large record to be displayed as a series of pages. DBSMNG pages are numbered 0 to 127 (decimal). A unique page number is associated with each field. If no page number is explicitly associated with a field when it is defined, it is implicitly assigned to page 0. Page 0 fields are always displayed. All other fields are only displayed when the page on which they reside is selected. 1.4.3.2 Key Page - As previously explained, some fields may be declared as keys and used to facilitate data retrieval. When this feature is being used, DBSMNGDBSMNG clears the screen and displays a special page (called the key page). This page contains only those fields declared to be key fields. 1.4.3.3 Labels - Labels may be used to improve the layout of the screen. Labels consist of one or more characters and may be assigned to any desired page. Like fields, page 0 labels are always displayed, while labels on any other page are only displayed when that page is selected. 1.4.3.4 Field Name - The logical name of each field is normally displayed on the screen next to the data the field contains. If the logical name of the field commences with an exclamation mark (!) the field name is not displayed on the screen. 1.4.3.5 Field Delimiters - To improve screen clarity, the screen region allocated to display the information contained in a field is normally enclosed in square brackets. The delimiters may be changed or omitted if desired. 1.5 CUSPs The DBSMNG package provides the user with a number of programs that allow the information stored in a database to be manipulated. These programs are termed CUSPs in this documentation, to distinguish them from other system programs. These CUSPs are generated from the sources contained in the package, and can be configured to support multiple databases or generated to support a specific database. DBSMNG: Database Management Package 7 1.5.1 Customization - The DBSMNG CUSPs use a template that defines the structure of the database. The template may be linked with a CUSP when it is built, in which case it can only be used to access that specific database. Such a CUSP is said to have been CUSTOMIZED for that particular database. If the template was not linked in with the CUSP at generation time, it will ask for the name of the template file each time it is invoked, and then use the specified template. This allows the CUSP to be used to access any database, but requires an extra disk access (to load the TEMPLATE). If only one database is being supported, and/or if slow disks are being used (viz LSI11/03 with floppy disks), it is best to customize the CUSPs as this can greatly improve response time. On the other hand, if multiple databases and/or fast disks are available (viz LSI11/23 with hard disks), it is best not to customize the CUSPs, as this reduces the number of CUSP versions on the system, saving disk space and simplifying maintenance. 1.5.2 Chaining - Each CUSP is designed to perform a specific task, thereby making them simple to use and capable of being run in systems with small amounts of memory. The disadvantage in using single function CUSPs is that a number of CUSPs will have to be invoked sequentially to perform each specific function (eg report production requires that the SELECT, SORTER and REPORT cusps be invoked). To facilitate this (and also to protect the inexperienced user against the complexities of the computer/operating system), the application manager may use MENU to set up CUSP chains. Such chains are activated by the user at menu level by a single key, and cause the required CUSPs to be executed in the correct order. MENU can also be used to pass commands to the CUSPs invoked in the chain sequence, thereby minimizing the information that has to be entered by the user. 1.6 Files DBSMNG uses a number of specially structured files. Some of these files are needed to target the CUSPs for a particular application, while others are produced as the result of a user request (eg reports). This section briefly details the different types of files used by the package and explains their function. 1.6.1 Database - DBSMNG creates and maintains three specially formatted files for each database. These files are created by the DBSMAK cusp, and are used to hold the database records, access keys and parameters respectively. 1.6.1.1 Data File - The data file is used to store the actual record data. Each record is allocated a fixed length partition in the file. Records are stored in ascending order of record number. 1.6.1.2 Key File - As previously explained, the actual data is stored in a data file. As the data file contains only data, and does not have any linkage pointers, locating a record via a key value using only the data file would be a lengthy process as every record would have to be accessed. To speed up record access via keys, DBSMNG maintains a simple key file that allows rapid location of records via key values. This file can be regenerated at any time from the contents of the data file. DBSMNG: Database Management Package 8 1.6.1.3 Parameter File - The parameter file is used to store auxiliary data associated with the database, especially that generated and needed by the database editor. 1.6.2 Template - The template file defines the structure of the database records. Thi source file may be created using any of the standard DEC editors, and consists of a one line declaration per record field. Once assembled, it can be used to generate the customized version of the CUSPs, or linked (by itself) to produce a loadable version of the template (called The TEMPLATE) that can be used with the uncustomized CUSPs. 1.6.3 RPT - The RPT files are sequential ASCII stream files created by CUSPs to hold output (eg the output from the REPORT cusp is a RPT file). The ASCII code 0 (ie NULL) is used as a terminator to mark the end-of-data point in the file. This type of file is generally sent to the printer for printing. 1.6.4 FRM - The FRM files are sequential ASCII stream files that are used as input to the CUSPs. These files are created by the application manager and are used to control the operation of the CUSP. They can be thought of as command files. These files are special in that the physical EOF point, NULL and control-Z can all be used to indicate the logical EOF point. As well, certain characters (the Up-arrow, Escape and Under-line) have special significance when included in FRM files. 1.6.4.1 Uparrow Sequence - The uparrow character (^) causes the next character in the FRM file to be converted into a control-character. (eg ^J is equivalent to a line feed.) 1.6.4.2 Escape Sequence - The Escape character ($) causes the next character in the FRM file to be converted into a special function code (eg $A is equivalent to a special function code of 301 octal). 1.6.4.3 Underline Sequence - The underline character (_) inhibits the conversion or interpretation of the next character in the FRM file. (eg _^ is the only way to prevent the uparrow from being interpreted as part of an uparrow sequence.) 1.6.4.4 ^@ Repeat Block Sequence - the sequence of characters ^@ in a FRM file is used to indicate the start of a repeat block. The repeat block is terminated using the same two characters. The format of a repeat block is [^@][X][....][^@] where [....] represents the sequence of characters to be repeated and [X] is a single character whose ASCII value is used as the repeat count. For example, the sequence ^@0ABC^@ is equivalent to writing the characters ABC forty-eight times (since the ASCII code for "0" is forty-eight). DBSMNG: Database Management Package 9 1.6.5 SFL - SFL files are used by the DBSMNG to transfer data from one CUSP or user program to another. An SFL file consists of a 512 byte header followed by a number of equal length records. Data is typically loaded into such a file by means of the SELECT CUSP, optionally sorted using SORTER and then used as input to REPORT, INSPECT, INSKEY or BACKUP. 1.6.5.1 SFL File Creation - SFL files must be pre-allocated by the application manager. This means that they must be explicitly created (ie the space allocated on the disk and the file entered in the directory) prior to attempting to use them. This is done by means of the RT-11 CREATE command. This requirement is to allow them to be positioned on the disk to achieve optimum performance and to prevent disk fragmentation. 1.6.5.2 Header Block - Block 0 of a SFL file is used as a header block. The first word of the header holds the number of bytes per data record. The second word holds the number of data records in the file. The rest of block 0 is available for general data interchange (eg SELECT passes a copy of its variables to REPORT through this area). 1.6.5.3 Data Blocks - The remaining blocks in a SFL file are used to hold data records. Each data record consists of a two byte tag followed by the record data. DBSMNG CUSPs use the tag to hold the "rn" for the database entry from which the following data was obtained. 1.7 Components The DBSMNG package consists of a number of source and binary files that are used in setting up a database application. The most important of these are described below. 1.7.1 CUSPs - The uncustomized version of the DBSMNG CUSPs are provided in the package. 1.7.2 Libraries - Two library files, DBSLIB.SML and DBSLIB.OBJ are a part of the package. The first file contains definitions for the commonly used macros. All DBSMNG source files require this file when being assembled. The second file is a library of object modules that is used when linking DBSMNG program. 1.7.3 Sources - The package contains a number of source files. These files are used to generate the two libraries, and the programs needed for database manipulation. 1.7.4 Example Application - The package contains a number of files that allow a simple personal database of names and phone numbers to be maintained. These files may be used to experiment with the package and as a starting point for developing other applications. DBSMNG: Database Management Package 10 Chapter 2 Setting up a Database - the Hard Way This chapter outlines the procedure to create a DBSMNG database. A simpler procedure is detailed in the next chapter. It is recommended that the information contained herein only be scanned. Less than 1% of DBSMNG applications cannot be setup using the simpler procedure explained in the next chapter. The reader's attention is especially directed to the section containing the guidelines and hints on setting up the database in the hope that this may prevent the repetition of a number of common mistakes. The setup procedure detailed in the rest of this chapter is summarized below. The first step in setting up a database is to decide on the structure of the records. This requires that the size and attributes of each field be determined, and an estimate of the number of records that are going to be used be made. This is termed the template design stage. Once the structure of the database record has been determined, it is necessary to create a template definition file. This is done using an editor to create a source file that contains a one line definition for each record field. This source file is then assembled with the database macro library (DBSLIB.SML) to produce an object version of the template. A special program, TPLMAC is available to simplify the creation of the template definition file. The use of TPLMAC is explained in the next chapter. The application manager must then decide whether to customize the CUSPs for a particular database, or if a set of general purpose CUSPs are to be used instead. Generation of customized CUSPs involves assembling and then rebuilding each of the CUSPs needed for the application, ensuring that the object version of the template is linked in when the program is being built. Note that customized CUSPs should only be used on small floppy based systems as they require more memory, and are harder to maintain. If customized CUSPs are not required, the TEMPLATE file will have to be generated by linking the object version of the template file. The TEMPLATE will be loaded at run time by the uncustomized CUSPs. The actual database files can then be created and initialized by invoking the DBSMNG cusp - the database is then set up and ready for use. 2.1 Environment Definition The procedure outlined in this chapter for the creation of the database assumes that a particular computer configuration is being used. This section describes the environment. DBSMNG: Database Management Package 11 The DBSMNG distribution kit should be copied onto a volume, and that volume assigned the logical name LB:. If RSTS/E is being used, another logical name may be used to prevent conflict with the RSX library area. The logical name DBS: will have to be assigned to a volume upon which the database files are to be created. This volume must have enough free space to hold the database files. As explained in the introduction, each database is identified by a unique six letter name. It is assumed that the sequence XXXXXX represents the name of the database being created. It is assumed that the RT-11 macro assembler (MACRO.SAV) and the RT-11 linker (LINK.SAV) are available, and can be invoked by the standard MACRO and LINK DCL commands respectively. 2.2 EXAMPLE Database Design Prior to creating a template, it is necessary to determine the database structure and the screen layout. This involves deciding what information is to be stored in each record, and how it is to be grouped into fields. Logical names are then assigned to each field, as well as the attributes needed to ensure that each field is properly handled by the CUSPs. When designing a DBSMNG database, it may help to assume that the database is to be implemented using a card system, as DBSMNG was originally designed to replace card-based data retrieval systems, and many of the concepts are the same. The following example is included to clarify the information that must be gathered before the template can be created. The example application demonstrates setting up a personal database to hold information on business acquaintances and friends. The table below details the information that would be held on each card. SURNAME 20 letters Name - surname INITIALS 2 letters Name - initials TITLE 15 letters Name - for greeting COMPANY 15 letters place of work CLASS 2 letters relationship PHONE(W) 10 digits Phone - work PHONE(H) 10 digits Phone - home STREET 20 bytes Address - street SUBURB 20 letters Address - suburb POSTCODE 4 digits Address - postcode COMMENT 120 bytes Comment - on 2 lines DBSMNG: Database Management Package 12 The diagram below shows the approximate data layout to be used for displaying the data on a VDU screen ._____________________________________________. | | | TITLE [.........] SURNAME [.......] | | COMPANY [.........] INITIALS [..] | | CLASS [..] | | | | PHONE(W) [....] STREET [.......] | | PHONE(H) [....] SUBURB [.......] | | POSTCODE [....] | | | | COMMENT [...............................] | | [...............................] | !_____________________________________________! The field information and layout diagram above can now be reduced into a simple table ready for creation of the template. This concise field data table for the example database is presented below. Field Type --Size--- Dx/Dy Nx/Ny Byte Char TITLE .ALP. 15 15 10/01 00/01 COMPANY .ASC. 15 15 10/02 00/02 PHONE(W) .ASC. 10 10 15/05 00/05 PHONE(H) .ASC. 10 10 15/06 00/06 SURNAME .ALP. 20 20 58/01 41/01 INITIALS .ALP. 2 2 76/02 41/02 CLASS .ASC. 2 2 76/03 41/03 STREET .ASC. 20 20 58/05 41/05 SUBURB .ASC. 20 20 58/06 41/06 POSTCODE .NUM. 2 4 74/07 41/07 COMMENT .ASC. 60 60 18/10 00/10 COMMENT .ASC. 60 60 18/11 00/11 As the database structure and screen layouts have now been finalized, the only matters remaining to complete the database design are to decide on the number of records that the database is to hold (ie its size) and the fields that will be used as keys. A database size of 50 records should be adequate. As for which fields should be declared as keys, it is suggested that the TITLE, COMPANY, SURNAME and CLASS fields would make excellent keys. 2.3 Template Definition File Now that the database design is complete, and the information defining the database structure and screen layouts available, it is time to create a Template Definition File. Such a file contains a one line declaration for each record field, and is assembled (using the DBSMNG macro library) to create the required object version of the template. The template definition file may be created with any of the editors available on the system (TECO and KED are suitable). The editor is invoked, and commanded to create a source file called XXXXXX.MAC, where XXXXXX is the unique six letter name that identifies the database. A special program, TPLMAC is available to simplify the creation of the template definition file. The use of TPLMAC is explained in the next chapter. The template definition file consists of a number of sections, and consists of a DBSMNG: Database Management Package 13 Preamble Field declarations Key declarations 2.3.1 Preamble - This section is used to load in the requisite macros from the DBSMNGDBSMNG macro library file, and initialize the various variables and data structures needed by the macros for the assembly of the template. The preamble specifies the database name, the number of entries in the database, the blocking factor to be used and the logical name of the volume upon which the database files are to reside. It consists of the following lines ._______________________________________________. | | | .MCALL FORM | | FORM XXXXXX,ENTRIES=N,BLOCK=BF,DEVICE=DVC | | .radix 10 | !_______________________________________________! The function and usage of the FORM macro is explained in the next section. 2.3.2 Field Declarations - The Field Declaration section is used to define the names and attributes of all the fields that make up a record. This section consists of a series of one line declarations, each commencing with the word FIELD. Each line results in one field being defined. The order in which the fields are declared is important since it determines where the field data appears in the record, and the order in which the fields are activated when accessed for editing. LABEL and SPARE declarations may also be made in the field declaration section. The FORMEND macro marks the end of the field definitions and the start of the key declaration section. A typical field declaration section has the following format ._____________________________________. | | | FIELD .... ; define first field | | FIELD .... ; define next field | | LABEL .... ; define a label | | SPARE .... ; define a spare field| | .... | | FIELD .... ; define last field | | FORMEND ; mark end of section | !_____________________________________! The function and usage of the FIELD, LABEL, SPARE and FORMEND macros is explained in the next section. 2.3.3 Key Declarations - As previously explained, DBSMNG maintains a special KEY file that it uses to speed up the location of records which contain given data in a specified field. The Key Declaration section is used to define which fields may be used to locate a record, and at the same time define the layout of the Key Page that is displayed by DBSEDT (the database editor) to allow the user to enter KEY data that is to be used for record location. The section consists of up to 15 key field declarations, each consisting of a single line beginning with the word KEY. LABEL declarations may also appear in this section. The end of the section is marked with the KEYEND macro. A typical key declaration section has the following format DBSMNG: Database Management Package 14 ._____________________________________. | | | KEY .... ; define first key | | KEY .... ; define next key | | .... | | KEY .... ; define last key | | KEYEND ; mark end of section | !_____________________________________! The function and usage of the KEY, LABEL and KEYEND macros is explained in the next section. 2.3.3.1 Explicit Key Declarations - A template is said to use explicit key declarations when KEY statements appear between the FORMEND and KEYEND declarations. As explained in the next section, DBSMNG supports implicit key declarations which is much easier to use. Explicit key declarations need only be used if the Key Page needs to be specially laid out (eg to place the most frequently used keys first) or if automatic inclusion of all six special fields (viz rn, cn, st, cd, ed, dd) is to be inhibited. Explicit and implicit key declarations cannot be mixed. 2.3.3.2 Implicit Key Declarations - A template is said to use implicit key declarations when no KEY statements appear between the FORMEND and KEYEND declarations. Implicit key declarations may be used when special laying out of the Key Page is not needed and when it is acceptable to include all six special fields (viz rn, cn, st, cd, ed, dd) in the template. If implicit key declarations are to be used, simply append the following ,KEY=YES to the FIELD declaration for each field that is also to be used as a key. When implicit key declarations are used the keys are laid out on the key page one per line (in the order that they are defined). 2.3.4 Special Fields - as explained in the introduction, DBSMNG provides special support for the "rn", "cn", "st", "cd", "ed" and "dd" fields, and, if possible, these fields should always be included in a template. To facilitate this, DBSMNG will automatically include declarations for these fields in a template. The fields will be positioned on line 23 of page 0, and "rn", "cn" and "st" will be defined as keys. In special cases where all six special fields are not wanted, the automatic generation of all six may be inhibited by simply declaring those that are required. The "rn" field must always be defined. The "st" field must be defined if DBSEDT (the DBSMNG editor) is to be used. DBSMNG: Database Management Package 15 2.4 Template Definition Macros This section details the function and usage of the macros used for the definition of the template. These macros are contained in the DBSLIB.SML macro library which must be used when assembling the template. The following background information is relevant to the proper understanding of the usage of the macros. A normal screen consists of 24 lines each of 80 characters. The top line is numbered 0 and the bottom 23. The left-most character position is numbered 0 and the right-most 79. As DBSEDT (the DBSMNG editor) uses the top four lines of the screen, lines 0 to 3 inclusive of the screen cannot be used. As part of the template definition, the user must specify the number of the page and the coordinates associated with each field. The field coordinates are specified as X/Y (column/line) offsets from the top left hand corner of the page. The top left hand corner of the page (corresponding to the X/Y coordinates 0,0) can be positioned at any point on the screen by means to two variables called BASE.X and BASE.Y. The FORM macro initially sets these variables to 5 and 0 respectively. This means that the pages are aligned on the screen to leave the top 5 lines free and that an X/Y coordinate of 0/0 corresponds to character position 0, line number 5 on the screen. This is shown below +------------+-----------------------------------------+ ! char/x 01234567890123456789012345..7890123456789! ! 1 2 6 7! !line Y +-----------------------------------------+ ! 0 ! ! ! 1 ! ! ! 2 ! ! ! 3 ! ! ! 4 ! ! ! 5 0 ! ! ! 6 1 ! ! ! 7 2 ! ! ! 8 3 ! ! ! 9 4 ! ! ! 10 5 ! ! ! .. .. ! ! ! 23 18 ! ! +------------+-----------------------------------------+ While this may sound a little confusing, it does have the advantage that coordinates are specified relative to the start of the page rather than the start of the screen. This can easily be changed by setting BASE.X and BASE.Y to 0,0 in which case the X/Y coordinates would be relative to the start of the screen. If BASE.X and BASE.Y are set to zero, ensure that lines 0 to 3 inclusive are not used. BASE.X and BASE.Y should be modified at the very start of the field declaration section. DBSMNG: Database Management Package 16 2.4.1 FORM Macro - The FORM macro is used in the preamble section to define the database name, the number of records in the database, the blocking factor to be used and the logical name of the volume upon which the database files are to reside. The invocation format is FORM XXXXXX,ENTRIES=N,BLOCK=BF,DEVICE=DVC Only the XXXXXX argument need be explicitly specified. The ENTRIES, BLOCK and DEVICE arguments may optionally be omitted. 2.4.1.1 XXXXXX argument - represents the 6 letter name of the database. This name must be exactly six characters in length, and will be used to identify the database. 2.4.1.2 ENTRIES argument - represents the number of records in the database. This number determines the size of the database files and the maximum number of records that can be held in the database at any time. 2.4.1.3 BLOCK argument - determines how the records are stored on disk. If a blocking factor is not explicitly specified DBSMNG will automatically allocate the smallest possible. A blocking factor need only be specified if more room is to be reserved for each record than is actually required (viz to allow for the additions of extra fields in the future). The table below details the allowed blocking factors. factor meaning +N each record occupies N blocks +1 each record occupies 1 block 0 each record occupies 1 block -1 each record occupies 1 block -2 two records stored per block -3 four records stored per block -4 eight records stored per block -N 2**(N-1) records stored per block Attempting to use too small a blocking factor (ie not allowing enough disk space to hold each record) will cause an assembly-time error. 2.4.1.4 DEVICE Argument - is the logical name of the volume upon which the database files are to reside. If omitted the database files are automatically placed on the volume with a logical name of DBS: . 2.4.2 FIELD Macro - The FIELD macro is used in the field declaration section. It is used to declare the logical name and attributes of the fields that make up each record. The FIELD macro syntax is FIELD X,Y,TYPE,DATA,XN,NAME,LD,RD,CHECK,PROTECT,PAGE,KEY 2.4.2.1 X argument - is the X coordinate at which the contents of the field are to be displayed. X is specified as an integer in the range 0 to 79. DBSMNG: Database Management Package 17 2.4.2.2 Y argument - is the Y coordinate at which the contents of the field are to be displayed. Y is specified as a integer in the range 0 to 18 (or 0 to 23 if BASE.Y is set to zero). 2.4.2.3 TYPE argument - indicates the type of data that is to be stored in the field. TYPE is specified as one of the following any ASCII character .ASC. any alphabetic character .ALP. an integer (0 to 65535) .NUM. a date .DAT. 2.4.2.4 DATA argument - indicates the number of character positions to be used to display the field contents on the screen. DATA is specified as a series of dots enclosed in angle brackets. Each dot corresponds to one character position on the screen. For .ASC. and .ALP. fields the DATA argument also determines the number of bytes in each record needed to store the field contents (one per character). For .NUM. type fields the DATA argument determines the number of digits to be displayed. For .DAT. type fields the DATA argument is effectively ignored. 2.4.2.5 XN argument - is the X coordinate at which the logical name of the field is to be displayed. XN is specified as an integer in the range 0 to 79. 2.4.2.6 NAME argument - is the logical name of the field. Each field must be allocated a unique name, as this is the only means of access the data in the field. If the name starts with an exclamation character ('!'), then the name will not be displayed on the screen. 2.4.2.7 LD argument - is the delimiter displayed on the left side of the field contents. If no left delimiter is specified a opening square bracket (ie [) is used by default. Any character may be used as the delimiter by simply specifying its ASCII code. 2.4.2.8 RD argument - is the delimiter displayed on the right side of the field contents. If no right delimiter is specified a closing square bracket (ie ]) is used by default. Any character may be used as the delimiter by simply specifying its ASCII code. 2.4.2.9 CHECK argument - is only valid for .NUM. type fields, and indicates the maximum value that can be stored in the field. If this argument is omitted, the maximum value that can be stored is 65535. The CHECK argument is specified as an integer in the range 1 to 65536. 2.4.2.10 PROTECT argument - is used to prevent an operator from modifying the contents of a field with DBSEDT. This argument is specified as a 0 or 1. Specifying a 0 allows the field contents to be modified. Specifying a 1 prevents the field contents from being modified. DBSMNG: Database Management Package 18 2.4.2.11 PAGE argument - is used to indicate the number of the page upon which the field is to be displayed. The page is specified as an integer in the range 0 to 127. The default page number is 0. (Page 0 fields are always displayed. Fields on other pages are only displayed when that page is selected.) 2.4.2.12 KEY argument - is used to indicate whether or not the field is also to be used as a key for locating records, and is specified as either YES or NO. The default is NO. Specifying a key argument of YES causes DBSMNGDBSMNG to automatically generate a KEY declaration for the field, called an implicit key declaration. Note that implicit and explicit key declarations cannot both be used. 2.4.3 FORMEND Macro - This macro is used mark the end of the field definition section. It must appear before any explicit key declarations. The macro syntax is FORMEND 2.4.4 KEY Macro - The KEY macro is used to perform explicit key declarations (ie specify which fields are to be used as keys to locate records). Explicit key definitions require more effort and care than do implicit definitions. It is therefore strongly recommended that explicit key declarations are not used. The KEY macro is used in the key declaration section. The key macro syntax is KEY X,Y,TYPE,DATA,XN,NAME,LD,RD,CHECK,PROTECT Each KEY definition must correspond to a FIELD definition. The TYPE, DATA, NAME and CHECK arguments in the corresponding KEY and FIELD definitions must be identical. 2.4.4.1 X argument - is the X coordinate at which the key is to be displayed on the key page. X is specified as an integer in the range 0 to 79. 2.4.4.2 Y argument - is the Y coordinate at which the key is to be displayed on the key page. Y is specified as a integer in the range 0 to 18 (or 0 to 23 if BASE.Y is set to zero). 2.4.4.3 TYPE argument - indicates the type of the key. TYPE is specified as one of the following any ASCII character .ASC. any alphabetic character .ALP. an integer (0 to 65535) .NUM. a date .DAT. and must be identical to that specified in the corresponding FIELD declaration. DBSMNG: Database Management Package 19 2.4.4.4 DATA argument - indicates the number of character positions to be used to display the key on screen. DATA is specified as a series of dots enclosed in angle brackets. Each dot corresponds to one character position on the screen. The DATA argument must be identical to that specified in the corresponding FIELD declaration. 2.4.4.5 XN argument - is the X coordinate at which the logical name of the key is to be displayed on the key page. XN is specified as an integer in the range 0 to 79. 2.4.4.6 NAME argument - is the logical name of the key, and must be identical to that used in the corresponding FIELD declaration. 2.4.4.7 LD argument - is the left delimiter for the key. If no left delimiter is specified a opening square bracket (ie [) is used by default. Any character may be used as the delimiter by simply specifying its ASCII code. 2.4.4.8 RD argument - is the right delimiter for the key. If no right delimiter is specified a closing square bracket (ie ]) is used by default. Any character may be used as the delimiter by simply specifying its ASCII code. 2.4.4.9 CHECK argument - is only valid for .NUM. type keys, and indicates the maximum value that can be specified. If this argument is omitted the maximum value that can be stored is 65535. The CHECK argument is specified as an integer in the range 1 to 65536. 2.4.5 KEYEND Macro - This macro is used mark the end of the key definition section. It must appear at the end of the template. The macro syntax is KEYEND 2.4.6 LABEL Macro - This macro is used to generate labels and may be using in either the field or key definition sections. Labels are simply a series of characters that are displayed on the screen. Labels are typically used to improve the presentation of data on the screen. The macro syntax is LABEL X,Y,LABEL,PAGE 2.4.6.1 X argument - this is the X coordinate at which the label is to be displayed. This is specified as an integer in the range 0 to 79. 2.4.6.2 Y argument - this is the Y coordinate at which the label is to be displayed. This is specified as an integer in the range 0 to 18. 2.4.6.3 LABEL argument - this is the series of characters that are to be displayed on the screen. These characters should be enclosed in angle brackets. DBSMNG: Database Management Package 20 2.4.6.4 PAGE argument - this identifies the page upon which the label is to reside. Page 0 labels are always displayed, while labels on all other pages are only displayed while the page they reside on is selected. PAGE is normally specified as an argument in the range 0 to 127. 2.4.6.4.1 Key Page Labels - it may sometimes be necessary to include labels on the key page. This is accomplished by specifying a PAGE argument of "KEY" in a label definition. 2.4.7 SPARE Macro - The SPARE macro is used in the field declaration section. This is a special purpose macro that allows room to reserved in a record for the later addition of a field. The SPARE macro syntax is SPARE X,Y,TYPE,DATA,XN,NAME,LD,RD,CHECK,PROTECT,PAGE As can be seen, this is identical to the FIELD macro. Simply by changing the word SPARE to FIELD and recompiling the template the new field will be enabled. Another common use of the SPARE macro is when multiple templates are used to examine the data stored in a database. Under such situations a master template is created with all fields defined. This template can then be used to manipulate the database (with DBSEDT). Subsidiary templates can then be created for viewing the data by defining some fields in the master template as SPARE. This allows the contents of "sensitive" fields to be inaccessible with the subsidiary templates. DBSMNG: Database Management Package 21 2.5 Example Template Definition File The template definition file for the personal database used as an example above is as follows .TITLE PHONES ... definition for PHONES database .IDENT /200582/ .enabl lc .radix 10 ; Preamble ; .MCALL FORM ; load macro FORM PHONES,ENTRIES=50,BLOCK=-2. ; initialize ; ; ; Field Declarations ; FIELD 10.,01. .ASC.,<...............> 00.,
$ $
^@
$\
DBSMNG: Database Management Package 90
$; This frm file will output the Code, Type and Instock data. Each
report page is properly titled and will contain 50 lines of data.
Only components of the same type are displayed on a page.
$;
^L Component Inventory Stock Report Page $P
================================ Date $D
$\
$;
$N$E see if have another record
$OA$$O! store type of 1st compnt in A
$;
$ $ $
^@1$; setup to repeat 49 times
$N$E see if have another record
$OB$$O! store type of n'th compnt in B
$#AB terminate if type n <> 1st
$;
$ $ $
^@$\
$; This frm file will output the Code, Type and Instock data. Each
report page is properly titled and will contain 50 lines of data.
Only components of the same type are displayed on a page. A trailer
is included at the bottom of each page indicating the type of
components on each page.
$;$M2
^L Component Inventory Stock Report
---------------------------------------------------------------------------
$\
$; $N$E $OA$$O! $;
$ $ $
^@1$; $N$E $OB$$O! $#AB $;
$ $ $
^@
$*
---------------------------------------------------------------------------
Page $P Component Type: $IA
$\
DBSMNG: Database Management Package 91
$; This report allows the user to enter the name of the person to
whom it is to be sent.
$O@Enter name of person to whom report is to be sent: $O!
$OT$I@$O!
$M2;
$*^L Component Inventory Stock Report
Attention: $IT
---------------------------------------------------------------------------
$\
$; $N$E $OA$$O! $;
$ $ $
^@1$; $N$E $OB$$O! $#AB $;
$ $ $
^@
$*
---------------------------------------------------------------------------
Page $P Component Type: $IA
$\
$; Assuming that the following SELECT FRM file was used
$)Enter name of sort field: $$ $(L0
$*$T [st].EQ.[AC] $$ $L @L0 $^ $$ $E
then this REPORT FRM file can be used to produce a report sorted
in the desired order.
^L Component Stock Report sorted in Order of $IX
$\
^@2$N$E $<$IX> $ $ $
^@$\
DBSMNG: Database Management Package 92
Chapter 11 BACKUP: Backup Utilities
DBSMNG provides four special CUSPs that support incremental archiving of
database records, collectively referred to as BACKUP. BACKUP is essential in
applications using a database with many, often modified, records. The four
CUSPs are
cusp Function
BACKUT creates the backup file
BACKUP copies selected records to the backup
BACKUN copies records from the backup file
BACKUF creates a special SELECT Format File
11.1 Function
The BACKUP utility was divided into four programs to conserve memory usage and
to allow the application manager the ability of limiting the user access to
potentially dangerous functions. This section describes the function of each of
the BACKUP CUSPs.
11.1.1 BACKUT- BACKUT is used exclusively for creating and initializing the
file that is to be used to archive the records. The is a SFL type file with
additional information stored in the Header section. This CUSP is normally
reserved for use of the application manager only.
11.1.2 BACKUP- The BACKUP program can be run whenever desired to copy selected
records into the backup file. A SFL type file, as generated by SELECT, is used
by BACKUP to determine which records are to be archived. Each time the program
is run it appends the new data to that already in the backup file, thereby
allowing for any of the archived versions of a record to be recovered. BACKUP
outputs a message each time it is run that tells the user how much room is left
in the backup file.
11.1.3 BACKUF - A number of criteria can be used to determine which records are
to be archived at any time; the most often used is to backup any records
created or modified since the last backup date. BACKUF is provided to create a
special Format File that will cause SELECT to select all records that have an
'edit date' (viz 'ed' field contents) that indicates that they were modified
since the last backup took place.
DBSMNG: Database Management Package 93
11.1.4 BACKUN - The BACKUN program is run when database records have been
destroyed and it is necessary to restore the database from a backup file. When
run, BACKUN simply transfers all record data from the backup file into the
database record from which it originally came.
11.1.5 CUSP Chaining - All four programs can be invoked as part of a CUSP
Chain, and can be passed commands from MENU. Normally only BACKUP (and BACKUF)
would be made available to the user as part of a CUSP Chain activated from a
menu. BACKUT and BACKUN should be run only by the application manager.
11.2 Information Required
Upon activation the CUSPs will prompt for the following items of information.
Note that not all of the CUSPs require all the items listed below; if a
particular CUSP is invoked from MENU, some of this data may be passed as Core
Common Commands.
DB Template This question is only asked if the user's database template was
not linked in when the program was linked. In response to this
question the user must specify the name of the file that
contains the template (in .SAV) format for the user database.
Backup File In response to this question, the user must supply the name of
the file that is used to hold the backup data. This is a
specially formatted file, and is described in detail below.
Select File In response to this question, the user must supply the name of
the SELECT FORMAT file that determines which records are to be
processed; such a file is created by the SELECT cusp, which
allows the user to test records for suitability for inclusion
in a given operation.
Format File In response to this question, the user supplies the name of a
file into which a series of commands which will cause SELECT to
select all database records that have been created or edited
since BACKUP was last run.
11.3 Backup File
The key to the operation of the backup package is a specially formatted file,
called the BACKUP file. The BACKUT program must be run first to create such a
file. BACKUT allows the user to specify the name that is to be given to the
file, and the maximum number of records that may be archived in it. The backup
file consists of a one block header and a number of data blocks. Backup entries
(consisting of a two word header and data from database records) are stored in
the data blocks. Note that these backup entries are concatenated one after the
other, without any wasted space in order to maximize disk utilization. The
format of a backup file is as follows
Block Byte Variable data function/usage
number offset name type
0 0 Entsiz I*2 number bytes per backup entry
2 Entnum I*2 number backup entries used
DBSMNG: Database Management Package 94
40 DBSNME B*6 six letter database name
50 BCKDAT I*2 date of last backup
100 OWNER R*6 must be rad50 string BACKUP
104 Filsiz I*2 number of blocks in file
106 CHECK R*3 must be rad50 string WEN=Write Enable
110 BLK I*2 Block number for start of free space
112 BYT I*2 Offset in BLK to start of free space
1 0 ENT#1 First backup entry
. .
n m ENT#k last entry written to date
BLK BYT free start of free data area
The backup entries in turn consist of a two word header and the data from a
database record. The first word is the number of the record from which the data
was obtained, and the second the date upon which the backup was done.
11.4 Using BACKUP in an Application
A typical scenario for the use of the backup package starts when the database
manager decides that the data being stored in a database must be protected
against hardware malfunction or accidental erasure. This can only be done by
using a combination of incremental and complete backup strategies A given
intervals (dependant on the amount of new data being entered) a complete backup
of the database is performed by copying the PAR, KEY and DAT files for the
database onto a backup medium; naturally a number of backup volumes should be
used in cyclic order to protect against an undetected corruption working its
way into the backup set. As a complete backup, particularly for a large
database, can be time consuming, the quicker and easier to use incremental
backup system should be used to backup data that is newly entered or changed
between the complete backup times. To do this, the application manager must
follow the steps outlined below
BACKUT must be run to create a backup format file. If possible, this
file should be placed on a separate volume to that which holds to
database (to protect against a head crash etc), and should be large
enough to hold all records that will be created or edited before the
next total backup time.
The BACKUP program can then be run at any time (say once a day or
after busy editing session) to backup all newly created or edited
records. Naturally while the manner via which BACKUP is invoked is
application specific, it is best to include it as a MENU option if
possible. The suggested method is to setup a MENU option that invokes
SELECT to select all database records whose edit dates (ie [ed]
field) are greater than a given date, and then to invoke BACKUP to
backup these selected records. If this is done, incremental backup
can then be carried out by users, without bothering the database
manager. Note that BACKUP automatically displays how full the backup
file is each time it is run, and that a suitable warning message
telling the user to inform the database manager is output whenever
the backup file becomes over 80% full.
DBSMNG: Database Management Package 95
In the event of a database corruption, BACKUN may then be run by the
system manager to update the last complete backup file set and
thereby restore the database. Naturally, a new incremental backup
file should be started whenever a complete backup is performed; the
old file may either be archived or deleted.
The only point requiring special attention when setting up a incremental backup
option in the menu is deciding how records will be selected for backup. Methods
available are to allow the user to specify a date, and to backup all records
that have an [ed] date later than that, or to use BACKUF to create a select
command file that will cause all records that were created or edited on or
after the date of the last backup to be selected for backup. Below is provided
an example MENU and SELECT command files that may be used to implement
incremental backup via the user menu.
DBSMNG: Database Management Package 96
11.5 Example MENU and SELECT Format Files
______________________________________________________________________________
Demo Menu for Backup Package
1 Backup all records that have been created or
edited since last backup was done
2 Backup all records that have been created or
edited today
3 Backup all records that have been created or
edited since a user specified date
$*
$1 $@LB:BACKUF$$ ; chain to BCKUF
$IBACKUP.DAT$$ ; name of backup file
$ISELECT.CMD$$ ; name for SELECT command file
$CLB:SELECT$$ ; chain to SELECT
$IDBSTMP$$ ; name of database template
$ISELECT.CMD$$ ; name of selection command file
$ISELECT.DAT$$ ; file in which to store selections
$I0$$ ; no maximum record length
$CLB:BACKUP$$ ; invoke backup
$IDBSTMP$$ ; name of database template
$IBACKUP.DAT$$ ; name of backup file
$ISELECT.DAT$$ ; file of selected records
$CLB:MENU$$ ; pass control back to menu
$IMENU.FRM$$ ; name of menu format file
$!
$2 $@LB:SELECT$$ ; chain to SELECT
$IDBSTMP$$ ; name of database template
$ISELECT.002$$ ; name of selection command file
$ISELECT.DAT$$ ; file in which to store selections
$I0$$ ; no maximum record length
$CLB:BACKUP$$ ; invoke backup
$IDBSTMP$$ ; name of database template
$IBACKUP.DAT$$ ; name of backup file
$ISELECT.DAT$$ ; file of selected records
$CLB:MENU$$ ; pass control back to menu
$IMENU.FRM$$ ; name of menu format file
$!
$3 $@LB:SELECT$$ ; chain to SELECT
$IDBSTMP$$ ; name of database template
$ISELECT.003$$ ; name of selection command file
$ISELECT.DAT$$ ; file in which to store selections
$I0$$ ; no maximum record length
$CLB:BACKUP$$ ; invoke backup
$IDBSTMP$$ ; name of database template
$IBACKUP.DAT$$ ; name of backup file
$ISELECT.DAT$$ ; file of selected records
$CLB:MENU$$ ; pass control back to menu
DBSMNG: Database Management Package 97
$IMENU.FRM$$ ; name of menu format file
$!
$*
------------------------------------------------------------------------------
The files SELECT.002 and SELECT.003 are as follows
; File SELECT.002 that causes all records with an edit date equivalent to the
; present system date to be selected
$*
$T [ed].EQ.D4$$
$L [ed] $$
$E
; file SELECT.003 that causes all records with an edit date equal to or
; greater than that specified by the user to be selected
;
$)Enter date : $$ $?D1
$*
$T [ed].GE.D1$$
$L [ed] $$
$E
DBSMNG: Database Management Package 98
CHAPTER 12 Other CUSPs
This chapter describes the simpler DBSMNG CUSPs. These CUSPs are included in
the distribution kit primarily for the benefit of the application manager.
12.1 CMDDSP: Dispatch Command to Monitor
The CMDDSP CUSP allows a command to be passed to the RT-11, RSTS/E or TSX-plus
keyboard monitor. The CUSP can only be invoked via MENU and expects Core Common
to hold the command that is to be passed. The CUSP is normally used to log a
user off or to start up a control file. The following example menu shows how
CMDDSP can be used.
Student Training System Master Menu
***********************************
1 Terminate Session
2 Initialize Work Area
$*
$1
$@LB:CMDDSP$$
$IBYE$$
$!
$2
$@LB:CMDDSP$$
$I@INITLZ.COM$$
$!
$*
12.2 DBSCPY: Copy Database
The DBSCPY CUSP is used to copy the contents of one database into another.
DBSCPY copies the contents of a record in the old database into its equivalent
record in the new database. DBSCPY is useful when the order of the fields that
make up a record has to be changed, when the 'type' or 'size' of a field has to
be changed, when new fields have to be added or when the size of a database has
to be increased. The suggested procedure is summarized below.
1) Protect the TEMPLATE and database files for the database that is to
be copied to minimize the probability of accidently losing data.
2) Create a TEMPLATE for the new database and invoke DBSMAK to create
the database files.
DBSMNG: Database Management Package 99
3) Invoke DBSCPY to copy the old database into the new database. DBSCPY
will request that the names of the TEMPLATE files for the old and
new databases be entered. DBSCPY will abort the copy operation if
the new database already contains data.
4) Use DBSEDT to inspect a number of records in the new database. If
the records look ok the operation has been successful and the old
database files can be archived.
12.3 DBSMAK: Make Database
The DBSMAK CUSP is used to create and initialize the three (DAT, KEY and PAR)
database files. When invoked the program requests that the name of the TEMPLATE
file for the database be entered. The program will then proceed to create the
files DBS:XXXXXX.PAR, DBS:XXXXXX.KEY and DBS:XXXXXX.DAT.
12.4 DBSSTS: TEMPLATE Disassembler
The DBSSTS CUSP disassembles a TEMPLATE. When invoked it requests that the user
enter the name of the TEMPLATE and an output file. The program will then
produce an output file that identifies the fields and their attributes.
12.5 DBSTPL: Template Compiler
The DBSTPL CUSP is used to create a Template file (ie a .MAC file that contains
a 1 line declaration per record field) from a card image. Refer to chapter 3
(Setting up a Database - The Easy Way) for further details.
12.6 FINDER: Find Matching Records in SFL File
The FINDER CUSP is used to print all entries in a SFL file that match a
specified target. SELECT is normally used to extract data out of a database and
load it into a SFL file. This SFL file is then sorted using SORTER. FINDER can
then be used to type out on the user's terminal any entries in the SFL file
that match a specified target. The program is used when extremely rapid
retrieval of a small fraction of the data stored the database records is
needed.
DBSMNG: Database Management Package 100
12.7 PURGER: Purge Database Records
The PURGER CUSP is used to delete/erase records from a database. Once a record
has been purged the database slot allocated to that record is freed and can
then be used to hold a new record. SELECT must first be run to select those
records that have to be erased. The SFL file produced with SELECT is then used
by PURGER to determine which records are to actually be erased. The following
SELECT FRM file
$T [st].EQ.'DE'$$ $L [rn] $$ $E
would select all records marked for deletion and load their record number into
a SFL file. PURGER would then be run to actually erase the records.
DBSMNG: Database Management Package 101
Chapter 13 DBSFOR: FORTRAN Interface
The DBSFOR routine allows the FORTRAN programmer to interface with a DBSMNG
database. The FORTRAN statement
CALL DBSFOR (ICODE,ARG1,....,ARGn)
is used to invoke DBSFOR. The first argument (ICODE) is an opcode that
determines the operation to be performed. The following opcodes are supported
code function
0 read database record
1 write database record
2 get field contents
3 put field contents
4 read record keys
5 write record keys
6 map field name to key number
7 get number of entries in database
8 get database name
9 select database
10 initialize database
11 return date in internal format
12 convert date to internal format
13 convert date from internal format
14 compare two (internal format) dates
15 initialize database on specified volume
16 envoke form editor
17 initialize interface
18 program exit
19 erase screen
20 input character
21 output character
22 input line
23 output line
24 erase line
25 position cursor
26 initialize core common
27 setup core common chain
28 setup core common input
29 check core common
30 return field attributes
31 set field attributes
32 initialize database, reuse memory
This chapter provides a summary of the functions performed by DBSFOR for the
FORTRAN programmer.
DBSMNG: Database Management Package 102
13.1 Using DBSFOR
A FORTRAN program must be linked with the DBSLIB.OBJ library (contained on the
distribution kit) to use the DBSFOR routine. The following DCL command
LINK MYPROG,LB:DBSLIB
or
LINK MYPROG,TEMPLT,LB:DBSLIB
can be used to accomplish this. The first method of linking should be used when
the database template is to be loaded at run time. The second method binds the
database template (TEMPLT.OBJ in this case) into the application program at
link time. A warning message stating that the global FORM$$ is undefined will
be issued by the linker if the first method of linking is used. This warning
message should be ignored.
13.2 Accessing a database
The DBSFOR module allows the FORTRAN programmer to access DBSMNG databases.
Like all other DBSMNG modules, DBSFOR uses a TEMPLATE to gain access to a
database. The user may link in the object version of the Template when the
application program is built, or use DBSMNG to load the TEMPLATE at run time.
While either method may be used, it is suggested that the first option (linking
in the Template) be only used in small systems where the extra disk access
needed to load the Template is unacceptable. While the rest of this text is
addressed to applications that load the TEMPLATE at run time, all facilities
described below are available even when the Template is linked in.
13.3 Overheads
When using DBSFOR, the programmer must make allowance for the three I/O
channels and memory required by the DBSMNG routines and to hold the database
TEMPLATEs. The I/O channels are obtained from the FORTRAN OTS, and are used to
access the DAT, KEY and PAR database files. To conserve I/O channels the same
channels are multiplexed for all databases.
13.4 Multiple database access
DBSFOR allows an application program to access a number of databases
simultaneously. To do this, the TEMPLATE for each database must be loaded at
run time and assigned to an INDEX (in the range 0 to 7). The INDEX number is
used to select which database is to be accessed. DBSFOR allows the user to
dynamically select any of the loaded databases. Once a database is selected,
all DBSFOR operations function on that database until another database is
selected.
DBSMNG: Database Management Package 103
13.5 Error handling
DBSFOR will abort program execution upon detection of an error. An error
message will be displayed on the terminal identifying the cause of the error
and the FORTRAN statement that had called the routine.
13.6 Channel Purging
For historical reasons all open channels will be purged (reset) when a
DBSFOR(17) function is performed the first time. To avoid possible difficulties
a DBSFOR(17) call should be the first executable statement in the FORTRAN
mainline program.
13.7 DBSFOR Calling Sequences
The DBSFOR routine allows the FORTRAN programmer to interface with a DBSMNG
database. The FORTRAN statement
CALL DBSFOR (ICODE,ARG1,....,ARGn)
is used to invoke the DBSFOR routine. The first argument (ICODE) is an opcode
that determines the operation to be performed. Additional arguments are
included if required. This section details the various functions that can be
performed.
13.7.1 Function 0: Record Read - the command CALL DBSFOR (0,I) results in the
the I'th record of the currently selected database being loaded into memory.
Note The first database record is numbered 1. The number for last record in
the database can be obtained via the DBSFOR(7) command.
13.7.2 Function 1: Record Write - the command CALL DBSFOR (1,I) results in the
record currently in memory being written out to the currently selected database
as record I.
Note Any changes made to a record do not become permanent until the record
is written out to disk.
DBSMNG: Database Management Package 104
13.7.3 Function 2: Field Get - the command CALL DBSFOR (2,STR,BUF,ISIZE,ITYPE)
results in contents of the field whose name is in STR being returned in BUF.
ISIZE and ITYPE are the number of data bytes returned and the field type
respectively.
Note * This command operates only on the currently selected database and
returns the contents of the field for the currently loaded record.
* Valid field types (returned in ITYPE) are 1 and 2 for ascii fields and
3 and 4 for two byte integer integer and date fields respectively.
* The field name (STR) is passed as a .asciz string (eg 'Address').
* When extracting data from a ascii type field (or when the field type is
unknown) BUF is best declared as a logical*1 array and should be
adequately dimensioned to ensure that it can accomodate the returned
data.
13.7.4 Function 3: Field Put - the command CALL DBSFOR (3,STR,BUF,ISIZE,ITYPE)
results in contents of the field STR being updated with the contents of BUF.
ISIZE and ITYPE are the field size and type attributes that must be correctly
specified.
Note * This command operates only on the currently selected database an
effects only the memory copy of the record. Modifications do not become
permanent until the records is written back to disk.
* The ISIZE and ITYPE arguments are included in the command to protect
against accidental modification of the wrong field.
13.7.5 Function 4: Read Keys - the command CALL DBSFOR (4,I,IKEYS) results in
the 16 (integer) keys associated with record I of the currently selected
database being returned in the array IKEYS.
Note * DBSMNG maintains 16 integer keys for each recoard. IKEYS should be
declared as a sixteen element integer array.
* A zero first IKEYS element is used by DBSMNG to indicate that a record
is free.
13.7.6 Function 5: Write Keys - the command CALL DBSFOR (5,IKEYS) results in
the 16 (integer) keys associated with record I of the currently selected
database being changed to IKEYS.
Note * DBSMNG automatically regenerates all but the first record keys (from
the record data) whenever a record is written to disk.
* An application can mark a record as free or in-use by setting IKEYS(1)
to zero or non-zero respectively.
* The Key Write function should be used with extreme care.
DBSMNG: Database Management Package 105
13.7.7 Function 6: Key Number - the command CALL DBSFOR (6,STR,IKEY) returns in
IKEY the number of the key (in range 1 to 16) that is assigned to field STR.
13.7.8 Function 7: Database Size - the command CALL DBSFOR (7,I) returns the
number of slots/records (ie the ENTRIES) in the currently selected database in
variable I.
13.7.9 Function 8: Database Name - the command CALL DBSFOR (8,NAME) returns the
six letter name of the currently selected database in the variable NAME.
Note NAME should be declared as a LOGICAL*1 array of six elements.
13.7.10 Function 9: Database Select - the command CALL DBSFOR (9,I) selects
database I. All subsequent operations will be performed upon the specified
database until another is selected.
Note A database must be initialized (via a DBSFOR 10, 15 or 32 command)
before it can be selected.
13.7.11 Function 10: Database Initialize - the command CALL DBSFOR (10,I,STR)
loads, initializes and selects the database whose TEMPLATE is in the file STR.
The database is assigned a (user specified) index of I. The index must be in
the range 0 to 7 and is henceforth used to select the database. If NAME is not
specified, the Template linked in when the program was built is initialized and
selected. All databases must be initialized before they can be used.
Note * The name of the database TEMPLATE is passed as a .ASCIZ string in STR.
The device and extension parts of the TEMPLATE name are optional. The
default device and extension are DK and SAV respectively.
* The use of this command requires that the database DAT, KEY and PAR
files reside on volume DBS. If this is not the case a DBSFOR (15) or
(32) command should be used.
13.7.12 Function 11: Return Date (Internal Format) - the command CALL DBSFOR
(11,IDATE) returns the current system date in DBSMNG format.
13.7.13 Function 12: To Internal Date Format - the command CALL DBSFOR
(12,IDATE,ID,IM,IY) returns in IDATE the date in DBSMNG format equivalent to
the day, month and year (to base 1900) counts passed in ID, IM and IY.
DBSMNG: Database Management Package 106
13.7.14 Function 13: From Internal Date Format - the command CALL DBSFOR
(13,IDATE,ID,IM,IY) converts the DBSMNG format date (IDATE) to the equivalent
day, month and year (to base 1900) counts returned in ID, IM and IY.
13.7.15 Function 14: Date Comparison - the command CALL DBSFOR
(14,IDATE1,IDATE2,IFLAG) compares the two DBSMNG format dates IDATE1 and
IDATE2. IFLAG on return will be -1, 0 or +1 to indicate that IDATE1 is less
than, equal or greater than IDATE2 respectively.
13.7.16 Function 15: Special Database Initialize - the command CALL DBSFOR
(15,I,STR,IDEV) loads, initializes and selects the database whose TEMPLATE is
in the file STR. The database is assigned index I. If STR is not specified, the
Template linked in when the program was built is initialized and selected. IDEV
is the RAD50 name of the device on which the database key, parameter and data
files reside. If all databases reside on one device the logical name DBS should
be assigned to that device and the DBSFOR(10) used to initialize the databases
for access. If the databases reside on different devices the DBSFOR(15)
function can be used to allow the device name to be specified when the
databases are initialized.
Note The device specification supplied in IDEV does not effect the TEMPLATE
name passed in STR. If the TEMPLATE resides on an area other than DK
the device name should be included as part of the file name passed in
STR.
13.7.17 Function 16: Envoke FORM Editor - the command CALL DBSFOR
(16,IPAGE,IFLG,CMD,MES) envokes the DBSMNG form/card editor to edit the data in
the currently loaded record (for the currently selected database). (The DBSMNG
form/card editor is called FEDMNG and is used by DBSEDT to edit a record.) The
IPAGE argument determines the page that is to be edited. This parameter should
be 0 for single page templates. The IFLG parameter controls the operation of
FEDMNG. This parameter consists of four 1 bit flags, represented by the octal
values 10, 4, 2 and 1. (Octal numbers are designated in FORTRAN by a preceding
double quote - eg "10.) The flag value can have more that one bit set at a
time. The flag values are explained below. The CMD parameter is a .ASCIZ string
that is passed to FEDMNG as a command line iff IFLG bit 3 (ie value "10) is
set. The MES parameter is a .ASCIZ string that if not NULL is displayed on the
topmost line of the screen as a prompt to the user. If a NULL string is
specified for MES (eg '') the last status message is displayed. The IFLG bit
meanings are
Bit Meaning
1 0 old data in record is displayed as default
1 zero record before entering data
2 0 FEDMNG starts in command mode
1 FEDMNG starts in entry/edit mode
4 0 allow command mode
1 disable command mode
10 0 ignore CMD argument
1 pass CMD to FEDMNG as a command
DBSMNG: Database Management Package 107
Note A DBSFOR(17) function must have been performed to setup the console I/O
subsystem before attempting to use DBSFOR(16).
13.7.18 Function 17: Interface Initialize - the command CALL DBSFOR (17,IMODE)
initializes the DBSMNG FORTRAN interface. A DBSFOR(17) function should be
performed before attempting to use any other DBSFOR function. The first time a
DBSFOR(17) function is executed the console interface subsystem is initialized,
operating system specific initialization is performed, all channels are purged
and terminal input mode IMODE is selected. On subsequent DBSFOR(17) calls only
the terminal input mode is effected. The IMODE argument selects how terminal
input is performed. If IMODE is set to 1 single character input mode is
enabled. This means that the monitor will pass characters to the application
program as soon as they are typed. Character echo will not be performed by the
monitor. If IMODE is set to 2 line input mode is enabled. This means that the
monitor will echo each character as it is typed and store it in a buffer. The
characters are not passed to the application program until a [RETURN] is
pressed. If all terminal I/O is to be performed through the DBSFOR functions
set IMODE to 1. If some terminal I/O is to be performed through FORTRAN
read/write commands set IMODE to 2. (All DBSFOR terminal I/O is performed in
single character mode. If IMODE is set to 2 DBSFOR enables single character
input mode temporarily each time a DBSFOR terminal input function is
performed.)
Note A DBSFOR(17,IMODE) command should be the first executable statement of
a FORTRAN program. For historical reasons the first DBSFOR(17,IMODE)
call resets all I/O channels.
13.7.19 Function 18: Exit - The command CALL DBSFOR (18) will terminate program
execution. If a CUSP chain is currently active control will pass to the next
program in the chain.
13.7.20 Function 19: Erase Screen - The command CALL DBSFOR (19) will clear the
user's screen.
13.7.21 Function 20: Input Character - The command CALL DBSFOR (20,BYTE) inputs
a character and returns it in BYTE. The input character is not echoed.
Note BYTE should be declared a LOGICAL*1 variable.
13.7.22 Function 21: Output Character - The command CALL DBSFOR (21,BYTE)
outputs character in BYTE to the console. (Byte values above "201 can be used
to perform terminal specific functions. Refer to the terminal driver
description for the function performed by the special codes.)
DBSMNG: Database Management Package 108
13.7.23 Function 22: Input Line - The command CALL DBSFOR (22,BUF) causes a
line of input to be returned in .ASCIZ format in BUF. Input is returned from
Core Common if available. If none is available in Core Common input is obtained
from the terminal.
13.7.24 Function 23: Output Line - The command CALL DBSFOR (23,STR) causes the
.asciz string in STR to be output to the terminal.
13.7.25 Function 24: Erase Line - The command CALL DBSFOR (24,IX,IY) erases
line IY and leaves the cursor positioned on column IX of line IY.
Note The topmost line is numbered 0. The leftmost column is numbered 0.
13.7.26 Function 25: Position Cursor - The command CALL DBSFOR (25,IX,IY) is
used to position the cursor on column IX of line IY.
Note The top left of the screen is equivalent to column 0 of line 0.
13.7.27 Function 26: Initialize Core Common - Core Common is used by DBSMNG to
pass information between Cusps. The command CALL DBSFOR (26) clears out and
resets the Core Common variables. This command should be used before attempting
to load new data into Core Common.
13.7.28 Function 27: Core Common Chain - The command CALL DBSFOR (27,STR)
stores a command in core common to chain to program whose name is passed in STR
(in .asciz format).
13.7.29 Function 28: Core Common Input - The command CALL DBSFOR (28,STR)
stores a command in core common to return the .asciz string passed in STR to a
cusp that tries and read data from core common.
13.7.30 Function 29: Core Common Check - The command CALL DBSFOR (29,BYTE) is
used to determine if core common holds any data. The next byte that will be
read from core common is returned in BYTE. This command is useful for seeing if
core common is empty. A -1 is returned in BYTE if core common is empty.
DBSMNG: Database Management Package 109
13.7.31 Function 30: Return Field Attributes - The command CALL DBSFOR
(30,NAME,IPAGE,IPROT,IX,IY,IXN,IYN) returns in variables
IPAGE,IPROT,IX,IY,IXN,IYN the page, protection, field X/Y and name X/Y
coordinates for field NAME. A field is protected if the MSB of IPROT (ie
"100000) is set.
13.7.32 Function 31: Set Field Attributes - The command CALL DBSFOR
(31,NAME,IPAGE,IPROT,IX,IY,IXN,IYN) sets the page, protection, field X/Y and
name X/Y coordinates for field NAME to IPAGE, IPROT, IX/IY, IXN/IYN. The field
will be protected if the MSB of IPROT (ie "100000) is set. Use IPROT=0 to
unprotect and IPROT=-1 to protect. Specifying IXN=-1 and IYN-1 will cause the
field name to be suppressed.
13.7.33 Function 32: Initialize Database - The command CALL DBSFOR
(32,I,STR,IDEV,MEMORY,IWORDS) is used to initialize the database whose TEMPLATE
is contained in the file STR. The database is assigned index I. The logical
name of the volume upon which the database files (ie DAT, KEY and PAR) reside
must be passed in rad50 format in IDEV. The user must allocate an INTEGER array
(MEMORY) of sufficient size to hold the TEMPLATE. The MEMORY and IWORDS
arguments are the array into which the TEMPLATE will be loaded and the size of
the array (in words). This form of the database initialize command should only
be used when a number of databases are to be accessed and the TEMPLATES will
not all fit into memory at the same time. In such a situation the user should
allocate an integer*2 array large enough to hold the largest TEMPLATE. This
version of the database initialize can then be used to load the TEMPLATES one
at a time into memory.
Note * When using the above command to initialize databases there is no need
to allocate each database a different index number. All databases
loaded with this command can be allocated the same index number.
* Initializing a new database with the above command results in a
database previously initialized with the same command being purged.
13.8 Examples
The examples on the following pages demonstrate the use of the more useful
DBSFOR commands.
DBSMNG: Database Management Package 110
PROGRAM MENU
C
C This program shows how the DBSFOR core common interface functions
C to implement a simple FORTRAN menu program.
C
LOGICAL*1 ICHAR
C
CALL DBSFOR (17,2) ! initialize DBSFOR
CALL DBSFOR (26) ! initialize core common
CALL DBSFOR (19) ! erase screen
C
C
WRITE (7,10) ! prompt
10 FORMAT(1X,
1 /1X,'Options'
1 /1X,' 1 Edit database'
1 /1X,' 2 Inspect database'
1 /1X,' 3 Exit'
1 /1X
1 /1X,'Press digit key corresponding to desired option',$)
20 CALL DBSFOR (20,ICHAR) ! input response
IF (ICHAR.EQ.'1') GOTO 1000 ! decode
IF (ICHAR.EQ.'2') GOTO 2000
IF (ICHAR.EQ.'3') GOTO 3000
GOTO 20 ! ignore inv char
C
C envoke editor
C
1000 CALL DBSFOR (27,'LB:DBSEDT') ! run DBSEDT
CALL DBSFOR (28,'LB:PHONES') ! template name
CALL DBSFOR (27,'DK:MENU') ! on exit run self
1010 CALL DBSFOR (19) ! erase screen
CALL DBSFOR (18) ! envoke chain
C
C envoke inspect
C
2000 CALL DBSFOR (27,'LB:SELECT') ! run select
CALL DBSFOR (28,'LB:PHONES') ! template name
CALL DBSFOR (28,'LB:PHONES.SE2') ! select file
CALL DBSFOR (28,'DBS:PHONES.INX') ! index file
CALL DBSFOR (28,'42') ! record size
CALL DBSFOR (27,'LB:SORTER') ! run sorter
CALL DBSFOR (28,'DBS:PHONES.INX') ! index file
CALL DBSFOR (27,'LB:INSPECT') ! run inspect
CALL DBSFOR (28,'LB:PHONES') ! template name
CALL DBSFOR (28,'DBS:PHONES.INX') ! index file
CALL DBSFOR (27,'DK:MENU') ! on exit run self
GOTO 1010 ! envoke chain
C
C exit
C
3000 CALL DBSFOR (18) ! bye
END
DBSMNG: Database Management Package 111
PROGRAM UPDATE
C
C This program shows how DBSFOR can be used to allow an operator to
C quickly update a specific field in a database. The operator enters
C the number of the record to be updated and the new value that is
C to be stored in the record. The program then load the record, updates
C the field with the user specified value and writes out the record.
C
C
C initialize
C
CALL DBSFOR (17,2) ! initialize DBSFOR
CALL DBSFOR (10,1,'COMPNT') ! open database
CALL DBSFOR (7,NUMREC) ! NUMREC = number records
C
C
C get record number and new value
C
100 write (7,110) ! prompt
110 format (1x,'Enter record number, new value: ',$)
read (5,120) irn,inp ! read
120 format (2i10)
if (irn.le.0) call dbsfor (18) ! record=0 --> done
if (irn.gt.numrec) goto 100 ! ensure record valid
C
C
C update record
C
CALL DBSFOR (0,irn) ! load record
CALL DBSFOR (2,'st',ISTS,ISIZE,ITYPE) ! get [st]
IF (ISTS.NE.'AC') GOTO 100 ! ensure active
CALL DBSFOR (2,'Present',ipv,ips,ipt) ! get number present
CALL DBSFOR (3,'Present',inp,ips,ipt) ! setup new number present
CALL DBSFOR (1,irn) ! write
goto 100 ! loop
end
DBSMNG: Database Management Package 112
PROGRAM COPY12
C ******* ******
C
C This program copies data from one database to another. Database INVOIC is
C on DY0 and database MASTER is on RK1. The MASTER database contains the
C names and addresses for each client. Database INVOIC contains invoices for
C each client. To minimize the amount of data entry for each invoice a client
C INDEX code is entered on each invoice rather than the client name and
C address. When this program is run it uses the INDEX code in each invoice
C to locate the client name/address in the MASTER database and then copies
C the name and address into the invoice.
C
LOGICAL*1 BUF(70) ! work buffer
DATA IDEV1 /3RDY0/ ! database 1 volume
DATA IDEV2 /3RRK1/ ! database 2 volume
C
CALL DBSFOR (15,1,'INVOIC',IDEV1) ! open database 1
CALL DBSFOR (7,NUM1) ! NUM1=number records
CALL DBSFOR (15,2,'MASTER',IDEV2) ! open database 2
CALL DBSFOR (7,NUM2) ! NUM2=number records
CALL DBSFOR (9,1) ! select database 1
C
DO 1000 I1=1,NUM1 ! for all invoices
CALL DBSFOR (0,I1) ! load record
CALL DBSFOR (2,'st',ISTS,ISIZE,ITYPE) ! get status
IF (ISTS.NE.'AC') goto 1000 ! ignore if inactive
CALL DBSFOR (2,'INDEX',INDEX,ISIZE,ITYPE)! get index into MASTER
IF (INDEX.LT.1) CALL ERROR () ! trap invalid
IF (INDEX.GT.NUM2.) CALL ERROR () ! index number
C
CALL DBSFOR (9,2) ! select MASTER
CALL DBSFOR (0,INDEX) ! load master record
CALL DBSFOR (2,'Name',BUF,ISIZE,ITYPE) ! get name
CALL DBSFOR (9,1) ! select INVOICE
CALL DBSFOR (3,'Name',BUF,ISIZE,ITYPE) ! copy over name
CALL DBSFOR (9,2) ! select MASTER
CALL DBSFOR (2,'Addrss',BUF,ISIZE,ITYPE)! get address
CALL DBSFOR (9,1) ! select INVOICE
CALL DBSFOR (3,'Addrss',BUF,ISIZE,ITYPE)! copy over address
CALL DBSFOR (1,I1) ! write out updated invoice
C
1000 CONTINUE ! loop
STOP
END
DBSMNG: Database Management Package 113
PROGRAM LISTER
C ******* ******
C
C This program allows the users to open any database and print the contents
C of any ascii field on the terminal. The program demonstrates the use
C a memory array to hold templates. The use of a memory array allows the
C memory used to hold a TEMPLATE to be reclaimed when the TEMPLATE is nolonger
C needed.
C
INTEGER*2 MEM(4000) ! memory array
LOGICAL*1 BUF(70) ! work buffer
DATA IDEV1 /3RDBS/ ! database 1 volume
C
1000 CALL DBSFOR (17,2) ! mode 2
CALL DBSFOR (23,'Enter TEMPLATE name') ! prompt
CALL DBSFOR (22,BUF) ! input name
CALL DBSFOR (32,1,BUF,IDEV1,MEM,4000) ! open database, load into MEM
CALL DBSFOR (23,'Enter FIELD name') ! prompt
CALL DBSFOR (22,BUF) ! input name
CALL LIST (BUF) ! process
GOTO 1000 ! loop
END
SUBROUTINE LIST (FIELD)
C ********** ****
C
LOGICAL*1 BUF(80)
C
CALL DBSFOR (7,NUM1) ! NUM1=number records
DO 1000 I1=1,NUM1 ! for all records
CALL DBSFOR (0,I1) ! load record
CALL DBSFOR (2,'st',ISTS,ISIZE,ITYPE) ! get status
IF (ISTS.NE.'AC') goto 1000 ! ignore if inactive
CALL DBSFOR (2,FIELD,BUF,ISIZE,ITYPE) ! get data
IF (ITYPE.LT.1) STOP 'Invalid field type'!invalid type
IF (ITYPE.EQ.3) STOP 'Numeric field' ! don't handle numeric fields
IF (ITYPE.EQ.4) STOP 'DATE field' ! don't handle date fields
IF (ITYPE.GT.4) STOP 'Invalid field type'!invalid type
WRITE (7,700) I1,(BUF(J),J=1,ISIZE) ! display
700 FORMAT (1X,I6,1X,100A1)
1000 CONTINUE ! loop
RETURN
END
DBSMNG: Database Management Package 114
Chapter 14 XXXFOR: General FORTRAN Support Routines
The DBSMNG object library DBSLIB.OBJ included on the distribution kit contains
a number of general purpose FORTRAN callable routines that facilitate the
inclusion of user written programs in a DBSMNG application. These routines are
invoked with the FORTRAN instruction
CALL XXXFOR (ICODE,ARG1,....,ARGn)
where XXXFOR is the name of the routine. The first argument (ICODE) is an
opcode that determines the operation to be performed. This chapter provides a
summary of the functions performed by these routines for the FORTRAN
programmer.
14.1 Error handling
These routines will abort program execution upon detection of an error. An
error message will be displayed on the terminal identifying the cause of the
error and the FORTRAN statement that had called the routine.
14.2 CONFOR: Core-Common and Console Support
The CONFOR allows a FORTRAN program to be included in a CUSP Chain. CONFOR
allows Core Common Commands to be accepted by the program. The CONFOR calling
sequences are summarized below.
sequence function
CONFOR (0) ignored
CONFOR (1) terminates program execution
CONFOR (2) illegal
CONFOR (3,CHAR) outputs character CHAR to user TTY
CONFOR (4,BUF) returns .asciz string from CC or TTY
CONFOR (5,BUF) outputs .ASCIZ string in BUF to TTY
CONFOR (6,X,Y) illegal
CONFOR (7,X,Y) illegal
CONFOR (8,X,Y) illegal
CONFOR (9,C,N) outputs character C N times
CONFOR (10,C1,..CN) output series of bytes C1 to CN
DBSMNG: Database Management Package 115
14.3 SRTFOR: SFL File I/O Support
The SRTFOR routine allows the FORTRAN programmer to access and manipulate
DBSMNGDBSMNG SFL files. The SFL files consists of a one block header followed
by a number of fixed length records. Such files are can be loaded with data
extracted from a DBSMNG database using the SELECT CUSP, optionally sorted using
SORTER or used as input to the REPORT, BACKUP or INSPECT CUSPs. Use of this
module uses up one RT-11 channel and may require the allocation of more
channels. The calling convention for the routine is
CALL SRTFOR (ICODE,ARG1,....,ARGn)
where ICODE is the opcode that determines the operation to perform and ARG? are
optional arguments. The following calls are supported
sequence function
SRTFOR (0) rewind/reset the input stream
SRTFOR (1) closes out file
SRTFOR (2,I1,I2,I3,I4) return SFL file parameters
SRTFOR (3,I1,I2,I3,I4) setup SFL file parameters
SRTFOR (4,BUF,NUM) read NUM bytes into BUF
SRTFOR (5,BUF,NUM) write NUM bytes from BUF
SRTFOR (6) chain to LB:SORTER.SAV
SRTFOR (7,FILNME) chain to program
SRTFOR (8,INDEX,BUF) peek at header block byte
SRTFOR (9,INDEX,VAL) poke into header block byte
STRFOR (10,NAME) open SFL file
SRTFOR (11,NUM)
14.3.1 Rewind SFL File - The FORTRAN instruction
CALL SRTFOR (0)
is used to reset the SFL file I/O subsystem. The contents of the output buffer
are output and then both the input and output stream rewound to the first entry
in the file.
14.3.2 Close SFL File - The FORTRAN instruction
CALL SRTFOR (1)
is used to close the SFL file. The contents of the output buffer are written
out and the file is then closed. (Another SFL file may then be opened.)
14.3.3 Read SFL File Parameters - The FORTRAN instruction
CALL SRTFOR (2,ISIZE,NUMENT,ISTS,ICHN)
is used to read the number of bytes per entry and the number of entries in the
file in ISIZE and NUMENT respectively. The ISTS and ICHN parameters are set to
0 and are supported only for compatibility with the earlier version of SRTFOR.
DBSMNG: Database Management Package 116
14.3.4 Setup SFL File Parameters - The FORTRAN instruction
CALL SRTFOR (3,ISIZE,NUMENT,ISTS,NME)
is used to to setup up the header block to indicate that the file consists of
NUMENT entries each of ISIZE bytes. The ISTS and NME arguments are ignored and
are only supported for compatibility with the earlier version of SRTFOR.
14.3.5 Read SFL File Data - The FORTRAN instruction
CALL SRTFOR (4,BUF,NUM)
is used to load the logical*1 buffer BUF with the next NUM bytes in the input
stream.
14.3.6 Write to SFL File - The FORTRAN instruction
CALL SRTFOR (5,BUF,NUM)
is used to write NUM bytes from the logical*1 array BUF to the output stream.
14.3.7 Chain to SORTER - The FORTRAN instruction
CALL SRTFOR (6)
is used to chain to LB:SORTER.SAV. This operation results in the SFL file being
closed out and a chain to the program SORTER.SAV on device LB: being performed.
14.3.8 Chain to Specified Program - The FORTRAN instruction
CALL SRTFOR (7,FILNME)
is used to chain to another program. This operation results in the SFL file
being closed out and a chain to the program whose RAD50 file spec is in FILNME
being performed.
14.3.9 Peek at SFL Header Block - The FORTRAN instruction
CALL SRTFOR (8,INDEX,BUF)
is used to peek at header block. This operation results in the contents of byte
INDEX (first byte is numbered 0) being returned in BUF.
14.3.10 Poke into SFL Header Block - The FORTRAN instruction
CALL SRTFOR (9,INDEX,VAL)
is used to poke into the SFL file header block. This operation results in the
value VAL being stored in the byte INDEX (first byte is numbered 0) of the
header block.
DBSMNG: Database Management Package 117
14.3.11 Open SFL File - The FORTRAN instruction
CALL STRFOR (10,NAME)
is used to open a SFL file. This operation results in the SFL file whose .ASCIZ
name is passed in NAME being opened.
14.3.12 Position at Specified Record - The FORTRAN instruction
CALL SRTFOR (11,NUM)
is used to position the input stream. This operation results in the SFL input
stream being position so that the next read operation will return the data
sorted in entry NUM. The first entry is number 1.
14.4 FNDFOR: Find Matching Entry in SFL File
The FNDFOR routine allows the FORTRAN programmer to access data stored in a
DBSMNGDBSMNG SFL files. Such files are can be loaded with data extracted from a
DBSMNGDBSMNG database using the SELECT CUSP. The FNDFOR routine can then be
used to rapidly retrieve an entries that match a specified target. The SFL file
must be sorted with SORTER before being used by FNDFOR as FNDFOR performs a
binary search to locate matching records.
14.4.1 Opening SFL File - The FORTRAN instruction
CALL FNDFIN () or CALL FNDFIN (STRING)
can be used to open the SFL file DK:SORTER.DAT or STRING (where STRING is a
.ASCIZ string) respectively.
14.4.2 Rewind File - The FORTRAN instruction CALL FNDFOR (0) is used to reset
the SFL file. The next read operation will return the data stored in entry 1.
14.4.3 Position at Specific Entry - The FORTRAN instruction CALL FNDFOR (1,I)
is used to position the file so that the next read operation will return the
data stored in the I'th record.
14.4.4 Read SFL File Parameters - The FORTRAN instruction
CALL FNDFOR (2,ISIZE,NUMENT,ISTS,ICHN)
is used to read the number of bytes per entry and the number of entries in the
file in ISIZE and NUMENT respectively. The ISTS and ICHN parameters are set to
0 and are supported only for compatibility with the earlier version of SRTFOR.
DBSMNG: Database Management Package 118
14.4.5 Locate Matching Entries - The FORTRAN instruction
CALL FNDFOR (3,TARGET,IREC,MATCHS)
is used search for entries that match the string TARGET. If MATCH is non-zero
on return, IREC points to first exact match and MATCHS holds number of exact
matches. If no matches are found IREC will point to closest smaller entry.
14.4.6 Read SFL Data - The FORTRAN instruction CALL FNDFOR (4,BUF,NUM) is used
to read the next NUM bytes from the SFL file into array BUF.
DBSMNG: Database Management Package 119
14.4.7 Example use of FNDFOR - a simple example FORTRAN program showing the
intended usage of FNDFOR follows.
PROGRAM SEARCH
C ======= ======
C
LOGICAL*1 BUF(70),TARGET(70),ANS,IRECB(2)
EQUIVALENCE (IREC,IRECB)
C
CALL FNDFIN ('ZB5:SORTER.DAT') ! initialize FND
CALL FNDFOR (2,IFNSZ,IFNNM,I,I) ! get entry size
C
1000 WRITE (7,1100) ! prompt
1100 FORMAT (1X,'?',$)
READ (7,1200) TARGET ! get target
1200 FORMAT (80A1)
CALL FNDFOR (3,TARGET,IFNRC,IFLAG) ! attempt to find
IF (IFLAG.EQ.1) GOTO 4000 ! found -> skip
WRITE (7,1300) IFLAG
1300 FORMAT (I10/)
C
2000 CALL FNDFOR (1,IFNRC) ! position at best
CALL FNDFOR (4,BUF,IFNSZ) ! read string
BUF(IFNSZ+1) = "200 ! terminate string
CALL PRINT (BUF(3)) ! print string
WRITE (7,2100) ! Prompt
2100 FORMAT (1X,'?',$)
READ (5,2200) ANS ! get answer
2200 FORMAT (A1)
IF (ANS.EQ.' ') GOTO 1000 ! new target
IF (ANS.EQ.'M') GOTO 4000 ! have match
IF (ANS.EQ.'N') IFNRC = IFNRC+1 ! next record
IF (ANS.EQ.'P') IFNRC = IFNRC-1 ! previous record
GOTO 2000 ! loop
C
4000 CALL FNDFOR (1,IFNRC) ! position at best
CALL FNDFOR (4,BUF,IFNSZ) ! read string
IRECB(1)= BUF(1) ! setup lob
IRECB(2)= BUF(2) ! setup hob
WRITE (7,4100) IREC,(BUF(J),J=3,IFNSZ)
4100 FORMAT (1X,'Match @',I4,2X,70A1)
STOP
END
DBSMNG: Database Management Package 120
Chapter 15 Installation Guide
DBSMNG is distributed on a double density floppy diskette (or the equivalent).
The diskette contains the major cusps and the DBSLIB.SML macro library. These
files should be copied onto the LB: volume. The RT-11 programs MACRO.SAV,
LINK.SAV and an editor (KED.SAV) are needed to setup a DBSMNG database
application.
15.1 Running under RSTS/E
Assuming that the DBSMNG CUSPs reside in PPN [1,7] and have been assigned a
protection of <60>, the following command file can be used to start up a DBSMNG
application.
SWITCH RT11
SIZE 28
PPN [1,7]
LIB [1,7]
R MENU
APPLIC.MNU
VT100
DBSMNG: Database Management Package 121
Chapter 16 Additional Information
Due to timing difficulties (namely in there only being 24 hours in each day),
the complete DBSMNG documentation can not be included in this version of the
manual. This chapter contains a number of notes that may be of aid until the
complete documentation becomes available (if it every does).
16.1 RT-11 and RSTS/E differences
Due to a failure of the RSTS/E RT-11 emulator to properly emulate the .SERR,
.DSTATUS and .CHAIN EMTs the automatic sizing of memory normally performed by
the CUSPs cannot be performed under RSTS/E.
16.2 Supporting a Different Terminal Type
Adding support for other types of terminals requires writing a special driver
module for the terminal (use VT1IO.MAC as a basis) and updating a table in the
CONIO.MAC module to enable the new terminal type. Alternatively it is possible
to modify one of the other terminal drives (viz TVIIO.MAC) that is not likely
to be used.
16.3 Module Documentation
The information contained in this manual has been extracted from the front of
the various source modules. Due to a lack to time it has not been possible to
extract all relevant data. It is strongly suggested that the appropriate source
module documentation be referred to if additional information is needed.
16.4 Obtaining additional help and information
If in need of help, I may be contacted as follows
S.E.Q.E.B, Phone Work: 07-2235174 62 Ann St.,
Brisbane,
Qld, 4001.
Attention: Ray Di Marco
DBSMNG: Database Management Package 122
17 INDEX
! ! Primary Files 77
$! $! Action Block Terminator 35
$# $# Convert to Ascii 58
$# $# If Terminal NOT of Type XXX 34
$# $# Terminate if Variables Not Equal 89
$$ $$ End of Block 55
$% $% Conditional Block Terminator 34
$( $( Input Field Name from Terminal 56
$( $( Input from Terminal 35
$) $) Output to Terminal 35 55 89
$* $* Marking Rewind Point 55
$* $* Section Delimiter 33 90
$- $- Delete Character 58
$/ $/ Auto initiated Function 34
$: $: Absolute Position 58 89
$; $; Suppress RPT Output 89
$< $< Extract Field Data 87
$< $< Trim 57
$< REPORT $< (field data) sub operators 82
$= $= If Terminal of Type XXX 33
$= $= Terminate if Variables Equal 89
$> $> Right Justify 57
$? $? Input Data from Terminal 55
$@ $@ Initiate CUSP Chain 35
$\ $\ Section Delimiter 89
$^ $^ Uppercase 58
$a $A Append to Existing SFL Contents 55
$b $B BCD Operator 82
$b REPORT $B (BCD) suboperators 81
$bf REPORT $BF (BCD format) sub operators 81
$c $C Clear OEF 56
$c $C Comment 84
$c $C Include CUSP in Chain 36
$d $D Dating 84
$d $D Define User Variable 35
$e $E End of Program 55
$e $E Terminate if all Records Processed 84
$f $F Format Operator 84
$i $I Insert Core Common Command 36
$i $I Switch Input Stream 85
$K $0 Action Block for Function Key K 34 35
$l $L Load Data 57
$m $M Select Termination Mode 85
$n $N Next Record 86
$o $O Output Stream 86
$p $P Pagination 86
$q $Q Quiet CUSP Chain 36
$r $R Define Ruler 86
$r $R Range Specification 55
$r $R Restart 35
$s $S Switch 58
$t $T Do Tests 56
DBSMNG:INDEX 123
$t $T Test Operator 86
$t REPORT $T (TEST) sub operators 81
$t# $T# Skip if Variables Not Equal 87
$t+ $T+ Skip if Variable Greater Than 0 87
$t- $T- Skip if Variable Less Than 0 87
$t0 $T0 Skip if Variable is 0 87
$t= $T= Skip if Variables Equal 87
$te $TE End of Section Marker 87
$tr $TR Special End of Section Marker 87
$x REPORT ($X) Operators 76
$~ $~ Flush 58
$~ $~ Substitute System Parameters 37
$~( $~( Operator: User Variable 37
$~a $~A Operator: Device Assignment 37
$~j $~J Operator: Job Number 37
$~n $~N Operator: User Name 37
$~p $~P Operator: Project Number 37
$~q $~Q Operator: Programmer Number 37
$~v $~V Operator: Flag Virtual Line 37
+ + BCD addition sub operator 82
- - BCD subtraction sub operator 82
.alp. .ALP. Alphabetic 4
.asc. .ASC. ASCII 4
.dat. .DAT. Date 5
.eq. .EQ. Boolean Operator 57
.ge. .GE. Boolean Operator 57
.gt. .GT. Boolean Operator 57
.le. .LE. Boolean Operator 57
.lt. .LT. Boolean Operator 57
.ne. .NE. Boolean Operator 57
/p /P Pause Switch 60
/r /R Reverse Order Switch 60
/s /S Statistics Switch 60
@ @ Terminal 77
^@ ^@ Repeat Block Sequence 9 50 74
a-z A-Z Memory Variables 77
abort ABORT: Abort Edit Submode 47
access Accessing a database 103
access Accessing Records 44
access Direct Field Access 54
access Explicit Record Access 44
access Indirect Field Access 54
access Keyed Record Access 45
access Multiple database access 103
action Action Definition Blocks 32 34 35
add Add keywords command 66
addition + BCD addition sub operator 82
alphabetic .ALP. Alphabetic 4
append Append to Existing SFL Contents 55
application Application Notes 71
application Example Application 10
application Using BACKUP in an Application 95
approximate Comma Delimiter: Approximate Match 65
area Form Area 41 63
area Interaction Area 41 63
argument Arguments 53
argument BLOCK argument 17
argument CHECK argument 18 20
argument DATA argument 18 20
argument DEVICE Argument 17
DBSMNG:INDEX 124
argument ENTRIES argument 17
argument KEY argument 19
argument LABEL argument 20
argument LD argument 18 20
argument NAME argument 18 20
argument PAGE argument 19 21
argument PROTECT argument 18
argument RD argument 18 20
argument TYPE argument 18 19
argument X argument 17 19 20
argument XN argument 18 20
argument XXXXXX argument 17
argument Y argument 18 19 20
ascii $# Convert to Ascii 58
ascii .ASC. ASCII 4
ascii Extracted Data: Ascii Fields 88
assign Assign Format File Input Stream 77
assign Assign Memory Variable Input Stream 78
assign Assign Memory Variable Output Stream 77
assign Assign RPT File Output Stream 77
assign Assign Terminal Input Stream 77
assign Assign Terminal Output Stream 77
assignment $~A Operator: Device Assignment 37
attribute Function 30: Return Field Attributes 110
attribute Function 31: Set Field Attributes 110
auto $/ Auto initiated Function 34
automatic Automatic tabing 44
background Background 73
backspace BACKSPACE 44 64
backuf BACKUF 93
backun BACKUN 94
backup BACKUP 93
backup Backup File 94
backup Backup Utilities 93
backup Using BACKUP in an Application 95
backut BACKUT 93
bcd $B BCD Operator 82
bcd + BCD addition sub operator 82
bcd - BCD subtraction sub operator 82
bcd BCD Binary Coded Decimal 79
bcd D BCD decrement sub operator 83
bcd F BCD format sub operator 83
bcd I BCD increment sub operator 82
bcd REPORT $B (BCD) suboperators 81
bcd REPORT $BF (BCD format) sub operators 81
bcd Z BCD zero sub operator 83
binary BCD Binary Coded Decimal 79
block $$ End of Block 55
block ^@ Repeat Block Sequence 9 50 74
block Action Definition Blocks 32 34 35
block BLOCK argument 17
block Conditional Blocks 32
block Data Blocks 10 50 74
block Header Block 10 50 74
block Peek at SFL Header Block 117
block Poke into SFL Header Block 117
blocking Blocking Factor 3
body Body Section 79
boolean Boolean Operators 56 57
boolean Boolean Statements 56
DBSMNG:INDEX 125
buffer Output Buffer 52 57
bye [RETURN] Implicit Bye Command 45
bye BYE: Terminate Execution 45
calling DBSFOR Calling Sequences 104
card Designing a CARD 26
card Example TPL Card 29
case Lower Case 65
cd cd 6
chain $@ Initiate CUSP Chain 35
chain $C Include CUSP in Chain 36
chain $Q Quiet CUSP Chain 36
chain Chain to SORTER 117
chain Chain to Specified Program 117
chain CUSP Chain Initiation 36
chain CUSP Chains 8 30 41 94
chain Function 27: Core Common Chain 109
chain MENU: CUSP Chain Manager 30
chain Using CUSP chaining from a menu 62
chain Very Long CUSP Chains 38
channel Channel Purging 104
character $- Delete Character 58
character Function 20: Input Character 108
character Function 21: Output Character 108
check CHECK argument 18 20
check Function 29: Core Common Check 109
check Numeric Limit Check 5
clear $C Clear OEF 56
clear CLEAR: Clear out Record 47
close Close SFL File 116
cmddsp CMDDSP: Dispatch Command to Monitor 99
cn cn 5
comma Comma Delimiter: Approximate Match 65
command $I Insert Core Common Command 36
command [RETURN] Implicit Exit 45 47
command Add keywords Command 66
command CMDDSP: Dispatch Command to Monitor 99
command Command Input Mode 42 63
command Core Common Commands 30
command DBSEDT Commands 45
command Exit Command 66
command Flip page Command 67
command Form Editing Mode Commands 46
command Help Command 66
command INSKEY Commands 66
command Keywords Command 66
command Next Command 67
command Print Command 67
command Refresh Command 67
comment Comments 32 84
common CONFOR: Core Common and Console Support 115
common Core Common Commands 30
common Core Common Overflow 37
common Function 26: Initialize Core Common 109
common Function 27: Core Common Chain 109
common Function 28: Core Common Input 109
common Function 29: Core Common Check 109
common Insert Core Common Command 36
compare Function 14: Date Comparison 107
compiler DBSTPL: Template Compiler 100
component Components 10
DBSMNG:INDEX 126
concept Concepts 2 30 70
conditional $% Conditional Block Terminator 34
conditional Conditional Blocks 32
confor CONFOR: Core Common and Console Support 115
constant Constants 53
constant Date Constants 53
constant Literal Constants 53
constant Numeric Constants 53
content Append to Existing SFL Contents 55
content Field Contents 54
control Control keys 43 64
control-u Control-U 44 65
convert Convert to Ascii 58
coordinate Screen Coordinates 6
copy DBSCPY: Copy Database 99
core $I Insert Core Common Command 36
core CONFOR: Core Common and Console Support 115
core Core Common Commands 30
core Core Common Overflow 37
core Function 26: Initialize Core Common 109
core Function 27: Core Common Chain 109
core Function 28: Core Common Input 109
core Function 29: Core Common Check 109
create Create a New Record 46
create CREATE: Create a New Record 45
create Creating the Format file for SELECT 72
create Creating the INDEX File 68 72
create Creating the TEMPLATE 23 27
create SFL File Creation 10 50
crt CRT type 31
cursor Cursor Movement Keys 43 64
cursor Function 25: Position Cursor 109
cusp $@ Initiate CUSP Chain 35
cusp $C Include CUSP in Chain 36
cusp $Q Quiet CUSP Chain 36
cusp CUSP Chain Initiation 36
cusp CUSP chaining 30 41 94
cusp CUSPs 7 10
cusp INSKEY: Multi key Database Inspection CUSP 62
cusp INSPECT: Online Database Query CUSP 70
cusp MENU: CUSP Chain Manager 30
cusp Other CUSPs 99
cusp TPLREP CUSP 74
cusp Using CUSP chaining from a menu 62
cusp Variable Passing Between CUSPs 54
cusp Very Long CUSP Chains 38
customization Customization 8
cycle Cycle 51
cycle REPORT Cycle 76
d D BCD decrement sub operator 83
d4 D4: System Date 54
data $< Extract Field Data 87
data $? Input Data from Terminal 55
data $L Load Data 57
data DATA argument 18 20
data Data Blocks 10 50 74
data Data Extraction 51
data Data File 8
data Data Input Mode 42
data Edit Field Data 47
DBSMNG:INDEX 127
data Extracted Data: Ascii Fields 88
data Extracted Data: Date Fields 88
data Extracted Data: Numeric Fields 88
data Read SFL File Data 117
data REPORT $< (field data) sub operators 82
database Accessing a database 103
database Database 8
database Database Concepts 2
database Database Entries 3
database Database Fields 4
database Database Files 3
database Database Name 3
database Database Template 3
database DBSCPY: Copy Database 99
database DBSEDT: Database Editor 40
database DBSMAK: Make Database 100
database EXAMPLE Database Design 12
database Function 10: Database Initialize 106
database Function 15: Special Database Initialize 107
database Function 32: Initialize Database 110
database Function 7: Database Size 106
database Function 8: Database Name 106
database Function 9: Database Select 106
database Initializing the Database 23 28
database INSKEY: Multi key Database Inspection CUSP 62
database INSPECT: Online Database Query CUSP 70
database Multi page Database Design 27
database Multiple database access 103
database PURGER: Purge Database Records 101
database Setting up a Database 11 25
date $D Dating 84
date .DAT. Date 5
date D4: System Date 54
date Date Constants 53
date Date Variables 54
date Extracted Data: Date Fields 88
date Function 11: Return Date (Internal Format) 106
date Function 12: To Internal Date Format 106
date Function 13: From Internal Date Format 107
date Function 14: Date Comparison 107
dbscpy DBSCPY: Copy Database 99
dbsedt DBSEDT Commands 45
dbsedt DBSEDT: Database Editor 40
dbsedt Invoking DBSEDT 40
dbsfor DBSFOR Calling Sequences 104
dbsfor DBSFOR: FORTRAN Interface 102
dbsfor Using DBSFOR 103
dbsmak DBSMAK: Make Database 100
dbssts DBSSTS: TEMPLATE Disassembler 100
dbstpl DBSTPL: Template Compiler 100
decimal BCD Binary Coded Decimal 79
declaration Explicit Key Declarations 15
declaration Field Declarations 14
declaration Implicit Key Declarations 15
declaration Key Declarations 14
decrement D BCD decrement sub operator 83
define Action Definition Blocks 32
define Define Ruler 86
define Define User Variable 35
define Display Definition Section 32
DBSMNG:INDEX 128
define Environment Definition 11 25
define Example Template Definition File 22
define Function Definition Section 32
define Template Definition File 13
define Template Definition Macros 16
delete $- Delete Character 58
delete DELETE 44 64
delete DELETE: Mark Record as Deleted 46
delete Recovering DELETED Records 46
delimiter $* Section Delimiter 33 90
delimiter $\ Section Delimiter 89
delimiter Comma Delimiter: Approximate Match 65
delimiter Field Delimiters 7
delimiter Semicolon Delimiter: Exact Match 65
description Operational Description 61
design Designing a CARD 26
design EXAMPLE Database Design 12
design Multi page Database Design 27
device $~A Operator: Device Assignment 37
device DEVICE Argument 17
digit Digit Key Function Execution 33
direct Direct Field Access 54
disassembler DBSSTS: TEMPLATE Disassembler 100
dispatch CMDDSP: Dispatch Command to Monitor 99
display Display Definition Section 32
display Visual Display Units 6
down DOWN 43 64
edit DBSEDT: Database Editor 40
edit Form Editing Mode Commands 46 47
edit Function 16: Envoke FORM Editor 107
enable Output Enable Flag 52 56
end $$ End of Block 55
end $E End of Program 55
end $TE End of Section Marker 87
end $TR Special End of Section Marker 87
enter [ENTER] Implicit Exit 45 47 66
entry Database Entries 3
entry ENTRIES argument 17
entry Entry Size 75
entry FNDFOR: Find Matching Entry 118
environment Environment Definition 11 25
envoke Function 16: Envoke FORM Editor 107
equal $# Terminate if Variables Not Equal 89
equal $= Terminate if Variables Equal 89
equal $T# Skip if Variables Not Equal 87
equal $T= Skip if Variables Equal 87
erase Function 19: Erase Screen 108
erase Function 24: Erase Line 109
error Error handling 104 115
escape Escape Sequence 9 49 74
escape Including VT100 Escape Sequences 38
event All Records Processed Event Handling 80
exact Semicolon Delimiter: Exact Match 65
examine INSPECT: Examine Record 46
example Example Application 10
example EXAMPLE Database Design 12
example Example Format Files 58
example Example Format Files 90
example Example Menu 39
example Example MENU and SELECT Format Files 97
DBSMNG:INDEX 129
example Example Template Definition File 22
example Example TPL Card 29
example Examples 110
execution Digit Key Function Execution 33
execution Slash Function Execution 33
exit [RETURN] Implicit EXIT Command 47
exit E Command: Exit 66
exit EXIT: Exit Edit Submode 47
exit Function 18: Exit 108
explicit Explicit Key Declarations 15
explicit Explicit Record Access 44
extract $< Extract Field Data 87
extract Data Extraction 51
extract Extracted Data: Ascii Fields 88
extract Extracted Data: Date Fields 88
extract Extracted Data: Numeric Fields 88
extract SELECT: Selective Information Extractor 49
factor Blocking Factor 3
field $( Input Field Name from Terminal 56
field $< Extract Field Data 87
field Database Fields 4
field Direct Field Access 54
field EDIT: Edit Field Data 47
field Extracted Data: Ascii Fields 88
field Extracted Data: Date Fields 88
field Extracted Data: Numeric Fields 88
field Field Contents 54
field Field Declarations 14
field Field Delimiters 7
field FIELD Macro 17
field Field Name 4 7 88
field Field Name in Variable 88
field Field Size 4
field Field Type 4
field Function 2: Field Get 105
field Function 30: Return Field Attributes 110
field Function 31: Set Field Attributes 110
field Function 3: Field Put 105
field Indirect Field Access 54
field Key Fields 5
field LOCATE: Edit Specified Field 47
field Protected Fields 5
field REPORT $< (field data) sub operators 82
field Special Fields 5 6 15 27
field Specifying a Key Field 27
field Specifying a Protected Field 27
field Specifying Fields 26
field Specifying the Field Type 26
field Target Fields 70 71
file ! Primary Files 77
file Assign Format File Input Stream 77
file Assign RPT File Output Stream 77
file Backup File 94
file Close SFL File 116
file Creating the INDEX File 68 72
file Data File 8
file Database Files 3
file Example Format Files 58 90 97
file Example Template Definition File 22
file Files 8
DBSMNG:INDEX 130
file FINDER: Find Matching Records in SFL File 100
file FNDFOR: Find Matching Entry in SFL File 118
file Format File 31 49 52 73 79
file Generating the INDEX File from a Menu 69
file Index File 70
file Key File 8
file Loading Keys into the INDEX File 68
file Menu Format File 31
file Omitting Sorter File 75
file Open SFL File 118
file Output File 52
file Parameter File 9
file Read SFL File Data 117
file Read SFL File Parameters 116
file Rewind File 53 76 116 118
file SELECT Format File 72
file Setting up the HELP File 69
file Setting up the INDEX File 68 72
file Setup SFL File Parameters 117
file SFL File 10 50 74
file SFL File 74
file Sorting the INDEX File 69
file SRTFOR: SFL File I/O Support 116
file Template Definition File 13
file Using a start up file 41 62
file Write to SFL File 117
find FINDER: Find Matching Records in SFL File 100
find FNDFOR: Find Matching Entry in SFL File 118
finder FINDER: Find Matching Records in SFL File 100
first FIRST: Edit First Field 47
flag $~V Operator: Flag Virtual Line 37
flag Output Enable Flag 52 56
flip F Command: Flip page 67
flush $~ Flush 58
fndfor FNDFOR: Find Matching Entry in SFL File 118
form Form Area 41 63
form Form Editing Mode Commands 46
form FORM Macro 17
form Function 16: Envoke FORM Editor 107
format $F Format Operator 84
format Assign Format File 77
format Example Format Files 58 90 97
format F BCD format sub operator 83
format Format File 9 31 49 52 73
format Format File Structure 79
format Function 11: Return Date (Internal Format) 106
format Function 12: To Internal Date Format 106
format Function 13: From Internal Date Format 107
format Menu Format File 31
format REPORT $BF (BCD format) sub operators 81
format Rewinding the Format File 53 76
format SELECT Format File 72
formend FORMEND Macro 19
fortran DBSFOR: FORTRAN Interface 102
fortran XXXFOR: General FORTRAN Support Routines 115
function $/ Auto initiated Function 34
function $K Action Block for Function Key K 34 35
function Digit Key Function Execution 33
function Function 93
function Function 0: Record Read 104
DBSMNG:INDEX 131
function Function 1: Record Write 104
function Function 2: Field Get 105
function Function 3: Field Put 105
function Function 4: Read Keys 105
function Function 5: Write Keys 105
function Function 6: Key Number 106
function Function 7: Database Size 106
function Function 8: Database Name 106
function Function 9: Database Select 106
function Function 10: Database Initialize 106
function Function 11: Return Date (Internal Format) 106
function Function 12: To Internal Date Format 106
function Function 13: From Internal Date Format 107
function Function 14: Date Comparison 107
function Function 15: Special Database Initialize 107
function Function 16: Envoke FORM Editor 107
function Function 17: Interface Initialize 108
function Function 18: Exit 108
function Function 19: Erase Screen 108
function Function 20: Input Character 108
function Function 21: Output Character 108
function Function 22: Input Line 109
function Function 23: Output Line 109
function Function 24: Erase Line 109
function Function 25: Position Cursor 109
function Function 26: Initialize Core Common 109
function Function 27: Core Common Chain 109
function Function 28: Core Common Input 109
function Function 29: Core Common Check 109
function Function 30: Return Field Attributes 110
function Function 31: Set Field Attributes 110
function Function 32: Initialize Database 110
function Function Definition Section 32
function Function Keys 30
function Slash Function Execution 33
function Special Function Keys 7 43 64
generating Generating the INDEX File from a Menu 69
header Header Block 10 50 74
header Header Section 79
header Peek at SFL Header Block 117
header Poke into SFL Header Block 117
help Setting up the HELP File 69
hint Hints and Suggestions 24 37
homogeneity Homogeneity 2
i/o I/O Stream Selection 77
i/o SRTFOR: SFL File I/O Support 116
identify Using Keywords to Identify Records 65
imbedded Imbedded Operators 57
implementation Implementation Overview 2
implicit Implicit Key Declarations 15
include $C Include CUSP in Chain 36
include Including VT100 Escape Sequences 38
increment I BCD increment sub operator 82
index Creating the INDEX File 68 72
index Generating the INDEX File from a Menu 69
index Index File 70
index Loading Keys into the INDEX File 68
index Setting up the INDEX File 68 72
index Sorting the INDEX File 69
indirect Indirect Field Access 54
DBSMNG:INDEX 132
initialize Function 10: Database Initialize 106
initialize Function 15: Special Database Initialize 107
initialize Function 17: Interface Initialize 108
initialize Function 26: Initialize Core Common 109
initialize Function 32: Initialize Database 110
initialize Initializing the Database 23 28
initialize Memory Variable F Initialization 78
initialize Memory Variable Initialization 78
initialize OEF Initialization 56
initialize Screen Initialization 33
initiate $/ Auto initiated Function 34
initiate $@ Initiate CUSP Chain 35
initiate CUSP Chain Initiation 36
input $( Input Field Name from Terminal 56
input $( Input from Terminal 35
input $? Input Data from Terminal 55
input $I Switch Input Stream 85
input Assign Format File Input Stream 77
input Assign Memory Variable Input Stream 78
input Assign Terminal Input Stream 77
input Command Input Mode 42 63
input Data Input Mode 42
input Function 20: Input Character 108
input Function 22: Input Line 109
input Function 28: Core Common Input 109
input Input Modes 42 63
input Input Wait 33
input Keyword Input Mode 63
insert $I Insert Core Common Command 36
inskey INSKEY Commands 66
inskey INSKEY: Multi key Database Inspection CUSP 62
inskey Invoking INSKEY 62
inskey Invoking INSKEY from a Menu 68
inskey Setting up INSKEY 68
inskey Using INSKEY 67
inspect INSKEY: Multi key Database Inspection CUSP 62
inspect INSPECT: Examine Record 46
inspect INSPECT: Online Database Query CUSP 70
inspect Using INSPECT 71
interface DBSFOR: FORTRAN Interface 102
interface Function 17: Interface Initialize 108
interface Interfacing to SORTER 61
interface Interfacing to User Programs 51
internal Function 11: Return Date (Internal Format) 106
internal Function 12: To Internal Date Format 106
internal Function 13: From Internal Date Format 107
invoking Invoking DBSEDT 40
invoking Invoking INSKEY 62
invoking Invoking INSKEY from a Menu 68
invoking Invoking MENU 31
invoking Invoking REPORT 75
invoking Invoking SELECT 51
job $~J Operator: Job Number 37
justify $> Right Justify 57
key [RETURN] Key 66
key Action Block for Function Key 33 34 35
key Control keys 43 64
key Cursor Movement Keys 43 64
key Explicit Key Declarations 15
key Function 4: Read Keys 105
DBSMNG:INDEX 133
key Function 5: Write Keys 105
key Function 6: Key Number 106
key Function Keys 30
key Implicit Key Declarations 15
key INSKEY: Multi key Database Inspection CUSP 62
key INSPECT: Online Database Query CUSP 70
key KEY argument 19
key Key Declarations 14
key Key Fields 5
key Key File 8
key KEY Macro 19
key Key Page 7
key Key Page Labels 21
key Keyed Record Access 45
key Keywords and Keys 65
key Loading Keys into the INDEX File 68
key Special Function Keys 7 43 64
key Specifying a Key Field 27
keyend KEYEND Macro 20
keyword A Command: Add keywords 66
keyword Adding Keywords 66
keyword K Command: Keywords 66
keyword Keyword 65
keyword Keyword Input Mode 63
keyword Keywords and Keys 65
keyword Multiple Keywords 66
keyword Using Keywords to Identify Records 65
label Key Page Labels 21
label LABEL argument 20
label LABEL Macro 20
label Labels 7
label Specifying Labels 26
layou Screen Layout 7 41 63
ld LD argument 18 20
libraries Libraries 10
limit Numeric Limit Check 5
line $~V Operator: Flag Virtual Line 37
line Function 22: Input Line 109
line Function 23: Output Line 109
line Function 24: Erase Line 109
literal Literal Constants 53
literal Literal Variables 54
load $L Load Data 57
load Loading Keys into the INDEX File 68
locate LOCATE: Edit Specified Field 47
long Very Long CUSP Chains 38
lower Lower Case 65
m1 M1 Termination Mode 85
m2 M2 Termination Mode 85
m3 M3 Termination Mode 85
m4 M4 Termination Mode 85
macro FIELD Macro 17
macro FORM Macro 17
macro FORMEND Macro 19
macro KEY Macro 19
macro KEYEND Macro 20
macro LABEL Macro 20
macro SPARE Macro 21
macro Template Definition Macros 16
main REPORT Main Operators 80
DBSMNG:INDEX 134
make DBSMAK: Make Database 100
manager MENU: CUSP Chain Manager 30
mark $* Marking Rewind Point 55
mark $TE End of Section Marker 87
mark $TR Special End of Section Marker 87
mark DELETE: Mark Record as Deleted 46
match Comma Delimiter: Approximate Match 65
match FINDER: Find Matching Records in SFL File 100
match FNDFOR: Find Matching Entry in SFL File 118
match Semicolon Delimiter: Exact Match 65
memory A-Z Memory Variables 77
memory Assign Memory Variable Input Stream 78
memory Assign Memory Variable Output Stream 77
memory Memory Variable F Initialization 78
memory Memory Variable Initialization 78
menu Example Menu 39 97
menu Generating the INDEX File from a Menu 69
menu Invoking INSKEY from a Menu 68
menu Invoking MENU 31
menu Menu 30
menu Menu Format File 31
menu MENU Operation 32
menu MENU: CUSP Chain Manager 30
menu Passing User Variable between Menus 31
menu Using CUSP chaining from a menu 62
mode $M Select Termination Mode 85
mode Command Input Mode 42 63
mode Data Input Mode 42
mode Form Editing Mode Commands 46
mode Input Modes 42 63
mode Keyword Input Mode 63
mode Termination Modes 85
monitor CMDDSP: Dispatch Command to Monitor 99
move Cursor Movement Keys 43 64
multi INSKEY: Multi key Database Inspection CUSP 62
multi Multi page Database Design 27
multiple Multiple database access 103
multiple Multiple Keywords 66
name $( Input Field Name from Terminal 56
name $~N Operator: User Name 37
name Database Name 3
name Field Name 4 7 88
name Field Name in Variable 88
name Function 8: Database Name 106
name NAME argument 18 20
new CREATE: Create a New Record 45
new NEW: Create a New Record 46
new NEW: Create a New Record 46
new PAGE: Select New Page 47
next $N Next Record 86
next N Command: Next 67
note Application Notes 71
number $~J Operator: Job Number 37
number $~P Operator: Project Number 37
number $~Q Operator: Programmer Number 37
number Function 6: Key Number 106
Numeric .NUM. Numeric 5
numeric Extracted Data: Numeric Fields 88
numeric Numeric Constants 53
numeric Numeric Limit Check 5
DBSMNG:INDEX 135
numeric Numeric Variables 53
oef $C Clear OEF 56
oef OEF Initialization 56
oef OEF Setting 56
omit Omitting Sorter File 75
online INSPECT: Online Database Query CUSP 70
open Open SFL File 118
operation MENU Operation 32
operation Operational Description 61
operation REPORT Operational Overview 76
operation SELECT Operation 52
operator $B BCD Operator 82
operator $F Format Operator 84
operator $T Test Operator 86
operator $~( Operator: User Variable 37
operator $~A Operator: Device Assignment 37
operator $~J Operator: Job Number 37
operator $~N Operator: User Name 37
operator $~P Operator: Project Number 37
operator $~Q Operator: Programmer Number 37
operator $~V Operator: Flag Virtual Line 37
operator + BCD addition sub operator 82
operator - BCD subtraction sub operator 82
operator .EQ. Boolean Operator 57
operator .GE. Boolean Operator 57
operator .GT. Boolean Operator 57
operator .LE. Boolean Operator 57
operator .LT. Boolean Operator 57
operator .NE. Boolean Operator 57
operator D BCD decrement sub operator 83
operator F BCD format sub operator 83
operator I BCD increment sub operator 82
operator Imbedded Operators 57
operator Operators 33
operator REPORT $< (field data) sub operators 82
operator REPORT $BF (BCD format) sub operators 81
operator REPORT $T (TEST) sub operators 81
operator REPORT ($X) Operators 76
operator REPORT Main Operators 80
operator REPORT Operators 80
operator SELECT Operators 54
operator Summary of Operators 80
operator Z BCD zero sub operator 83
optional Optional SORTER Switches 60
order /R Reverse Order Switch 60
output $) Output to Terminal 35 55 89
output $; Suppress RPT Output 89
output $O Output Stream 86
output Assign Memory Variable Output Stream 77
output Assign RPT File Output Stream 77
output Assign Terminal Output Stream 77
output Function 21: Output Character 108
output Function 23: Output Line 109
output Output Buffer 52 57
output Output Enable Flag 52 56
output Output File 52
overflow Core Common Overflow 37
overhead Overheads 103
overview Functional Overview 1
overview General Overview 49
DBSMNG:INDEX 136
overview Implementation Overview 2
overview REPORT Operational Overview 76
page F Command: Flip page 67
page Key Page 7
page Key Page Labels 21
page Multi page Database Design 27
page PAGE argument 19 21
page PAGE: Select Page N 46 47
page TOP: Edit Field at Top of Page 47
pages Pages 7
pagination $P Pagination 86
parameter $~ Substitute System Parameters 37
parameter Parameter File 9
parameter Read SFL File Parameters 116
parameter Setup SFL File Parameters 117
passing Passing User Variable between Menus 31
passing Variable Passing Between CUSPs 54
pause /P Pause Switch 60
peek Peek at SFL Header Block 117
poke Poke into SFL Header Block 117
position $: Position 58 89
position Function 25: Position Cursor 109
position Position at Specific Entry 118
position Position at Specified Record 118
preamble Preamble 14
primary ! Primary Files 77
print Print Command 67
process $E Terminate if all Records Processed 84
process All Records Processed Event Handling 80
program $E End of Program 55
program Chain to Specified Program 117
program Interfacing to User Programs 51
programmer $~Q Operator: Programmer Number 37
project $~P Operator: Project Number 37
protect PROTECT argument 18
protect Protected Fields 5
protect Specifying a Protected Field 27
purge Channel Purging 104
purge PURGER: Purge Database Records 101
put Function 3: Field Put 105
query INSPECT: Online Database Query CUSP 70
quiet $Q Quiet CUSP Chain 36
range $R Range Specification 55
rd RD argument 18 20
read Function 0: Record Read 104
read Function 4: Read Keys 105
read Read SFL File Data 117
read Read SFL File Parameters 116
record $E Terminate if all Records Processed 84
record $N Next Record 86
record Accessing Records 44
record CLEAR: Clear out Record 47
record CREATE: Create a New Record 45
record DELETE: Mark Record as Deleted 46
record EDIT: Edit an Existing Record 46
record Explicit Record Access 44
record FINDER: Find Matching Records in SFL File 100
record Function 0: Record Read 104
record Function 1: Record Write 104
record INSPECT: Examine Record 46
DBSMNG:INDEX 137
record Keyed Record Access 45
record NEW: Create a New Record 46
record Position at Specified Record 118
record PURGER: Purge Database Records 101
record Record Selection 51
record Record Size 51 52
record Recovering DELETED Records 46
record Using Keywords to Identify Records 65
recover Recovering DELETED Records 46
refresh REFRESH: Refresh Screen 48
repeat ^@ Repeat Block Sequence 9 50 74
report Invoking REPORT 75
report REPORT $< (field data) sub operators 82
report REPORT $B (BCD) suboperators 81
report REPORT $BF (BCD format) sub operators 81
report REPORT $T (TEST) sub operators 81
report REPORT ($X) Operators 76
report REPORT Cycle 76
report REPORT Main Operators 80
report REPORT Operational Overview 76
report REPORT Operators 80
report REPORT Variables 77
report REPORT: Report Writer 73
restart $R Restart 35
return [RETURN] Implicit Exit 45 47 66
return Function 11: Return Date (Internal Format) 106
return Function 30: Return Field Attributes 110
reverse /R Reverse Order Switch 60
rewind $* Marking Rewind Point 55
rewind Rewind File 118
rewind Rewind SFL File 116
rewind Rewinding the Format File 53 76
right $> Right Justify 57
rn rn 5
rpt $; Suppress RPT Output 89
rpt Assign RPT File Output Stream 77
rpt RPT 9
ruler $R Define Ruler 86
screen Function 19: Erase Screen 108
screen REFRESH: Refresh Screen 48
screen Screen Coordinates 6
screen Screen Initialization 33
screen Screen Layout 7 41 63
section $* Section Delimiter 33 90
section $\ Section Delimiter 89
section $TE End of Section Marker 87
section $TR Special End of Section Marker 87
section Body Section 79
section Display Definition Section 32
section Function Definition Section 32
section Header Section 79
section Trailer Section 79
select $M Select Termination Mode 85
select Creating the Format file for SELECT 72
select Example MENU and SELECT Format Files 97
select Function 9: Database Select 106
select I/O Stream Selection 77
select Invoking SELECT 51
select PAGE: Select Page N 46 47
select Record Selection 51
DBSMNG:INDEX 138
select SELECT Operation 52 54
select SELECT: Selective Information Extractor 49
semicolon Semicolon Delimiter: Exact Match 65
sequence ^@ Repeat Block Sequence 9 50 74
sequence DBSFOR Calling Sequences 104
sequence Escape Sequence 9 49 74
sequence Including VT100 Escape Sequences 38
sequence Underline Sequence 9 50 74
sequence Uparrow Sequence 9 49 73
set Function 31: Set Field Attributes 110
set Setting up a Database 11 25
set Setting up INSKEY 68
set Setting up the HELP File 69
set Setting up the INDEX File 68 72
set Setup SFL File Parameters 117
sfl $A Append to Existing SFL Contents 55
sfl Close SFL File 116
sfl FINDER: Find Matching Records in SFL File 100
sfl FNDFOR: Find Matching Entry in SFL File 118
sfl Open SFL File 118
sfl Peek at SFL Header Block 117
sfl Poke into SFL Header Block 117
sfl Read SFL File Data 117
sfl Read SFL File Parameters 116
sfl Rewind SFL File 116
sfl Setup SFL File Parameters 117
sfl SFL File 10 50 74 50
sfl SRTFOR: SFL File I/O Support 116
sfl Write to SFL File 117
single INSPECT: Online Database Query CUSP 70
size Entry Size 75
size Field Size 4
size Function 7: Database Size 106
size Record Size 51 52
skip $T# Skip if Variables Not Equal 87
skip $T+ Skip if Variable Greater Than 0 87
skip $T- Skip if Variable Less Than 0 87
skip $T0 Skip if Variable is 0 87
skip $T= Skip if Variables Equal 87
skip $T= Skip if Variables Equal 87
slash Slash Function Execution 33
sorter Chain to SORTER 117
sorter Interfacing to SORTER 61
sorter Omitting Sorter File 75
sorter Optional SORTER Switches 60
sorter SORTER: Sorting Utility 60
sorter Using SORTER 60
sorting Sorting the INDEX File 69
source Sources 10
spare SPARE Macro 21
special $TR Special End of Section Marker 87
special Function 15: Special Database Initialize 107
special Special Fields 5 6 15 27
special Special Function Keys 7 43 64
specify $R Range Specification 55
specify Specifying a Key Field 27
specify Specifying a Protected Field 27
specify Specifying Fields 26
specify Specifying Labels 26
specify Specifying the Field Type 26
DBSMNG:INDEX 139
srtfor SRTFOR: SFL File I/O Support 116
st st 5
startup Using a startup file 62
statement Boolean Statements 56
statistic /S Statistics Switch 60
stream $I Switch Input Stream 85
stream $O Output Stream 86
stream Assign Format File Input Stream 77
stream Assign Memory Variable Input Stream 78
stream Assign Memory Variable Output Stream 77
stream Assign RPT File Output Stream 77
stream Assign Terminal Input Stream 77
stream Assign Terminal Output Stream 77
stream I/O Stream Selection 77
structure Format File Structure 79
suboperator REPORT $B (BCD) suboperators 81
substitute $~ Substitute System Parameters 37
subtraction - BCD subtraction sub operator 82
suggestion Hints and Suggestions 24
summary Summary of Operators 80
support CONFOR: Core Common and Console Support 115
support SRTFOR: SFL File I/O Support 116
support XXXFOR: General FORTRAN Support Routines 115
suppress $; Suppress RPT Output 89
switch $I Switch Input Stream 85
switch $S Switch 58
switch /P Pause Switch 60
switch /R Reverse Order Switch 60
switch /S Statistics Switch 60
switch Optional SORTER Switches 60
system $~ Substitute System Parameters 37
system D4: System Date 54
tabing tabing 44 64
target Target 70
target Target Fields 70 71
template Creating the TEMPLATE 23 27
template Database Template 3 52 75
template DBSSTS: TEMPLATE Disassembler 100
template DBSTPL: Template Compiler 100
template Example Template Definition File 22
template Template 9
template Template Definition File 13
template Template Definition Macros 16
terminal $# If Terminal NOT of Type XXX 34
terminal $( Input Field Name from Terminal 56
terminal $( Input from Terminal 35
terminal $) Output to Terminal 35 55 89
terminal $= If Terminal of Type XXX 33
terminal $? Input Data from Terminal 55
terminal @ Terminal 77
terminal Assign Terminal Input Stream 77
terminal Assign Terminal Output Stream 77
terminal Terminal 40
terminate $# Terminate if Variables Not Equal 89
terminate $= Terminate if Variables Equal 89
terminate $E Terminate if all Records Processed 84
terminate $M Select Termination Mode 85
terminate BYE: Terminate Execution 45
terminate Termination Mode 85
terminator $! Action Block Terminator 35
DBSMNG:INDEX 140
terminator $% Conditional Block Terminator 34
terminator Terminators 88
test $T Do Tests 56
test $T Test Operator 86
test REPORT $T (TEST) sub operators 81
top TOP: Edit Field at Top of Page 47
tpl Example TPL Card 29
tplrep TPLREP CUSP 74
trailer Trailer Section 79
trim $< Trim 57
type CRT type 31
type Field Type 4
type Specifying the Field Type 26
type TYPE argument 18 19
underline Underline Sequence 9 50 74
uparrow Uparrow Sequence 9 49 73
uppercase $^ Uppercase 58
usage Usage 50 75
user $D Define User Variable 35
user $~( Operator: User Variable 37
user $~N Operator: User Name 37
user Interfacing to User Programs 51
user Passing User Variable between Menus 31
user User Variable 31
using Using a start up file 41 62
using Using BACKUP in an Application 95
using Using CUSP chaining from a menu 62
using Using DBSFOR 103
using Using INSKEY 67
using Using INSPECT 71
using Using Keywords to Identify Records 65
using Using SORTER 60
using Using Special Fields 6
utility BACKUP: Backup Utilities 93
utility SORTER: Sorting Utility 60
variable $# Terminate if Variables Not Equal 89
variable $= Terminate if Variables Equal 89
variable $D Define User Variable 35
variable $T# Skip if Variables Not Equal 87
variable $T+ Skip if Variable Greater Than 0 87
variable $T- Skip if Variable Less Than 0 87
variable $T0 Skip if Variable is 0 87
variable $T= Skip if Variables Equal 87
variable $T= Skip if Variables Equal 87
variable $~( Operator: User Variable 37
variable A-Z Memory Variables 77
variable Assign Memory Variable Input Stream 78
variable Assign Memory Variable Output Stream 77
variable Date Variables 54
variable Field Name in Variable 88
variable Literal Variables 54
variable Memory Variable F Initialization 78
variable Memory Variable Initialization 78
variable Numeric Variables 53
variable Passing User Variable between Menus 31
variable REPORT Variables 77
variable User Variable 31
variable Variable Passing Between CUSPs 54
variable Variables 53
virtual $~V Operator: Flag Virtual Line 37
DBSMNG:INDEX 141
vt100 Including VT100 Escape Sequences 38
wait Input Wait 33
write Function 1: Record Write 104
write Function 5: Write Keys 105
write Write to SFL File 117
writer REPORT: Report Writer 73
zero Z BCD zero sub operator 83
DBSMNG:INDEX 142