home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d594 / analyrimsrc.lha / AnalyRimSrc / AnaRimSrcDoc.Zoo / rimdoc.doc < prev    next >
Text File  |  1991-09-30  |  142KB  |  4,401 lines

  1.                                                  RIM-5 Manual
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.                                                     Page 1
  56.                                                        
  57.                                                        
  58.  
  59.  
  60.                                                   DEFINITIONS
  61. ATTRIBUTE:      An attribute is a 1-8 character alphanumeric name
  62.                 used to identify a specific column of a relation.
  63. DOMAIN:         A domain is the set of values which are permissible
  64.                 in a column of a two-dimensional table of data
  65.                 (relation).
  66. KEY:            An attribute may be specified to be "KEY".  This
  67.                 specification will cause RIM to build an index for
  68.                 the attribute.  Under certain conditions, this
  69.                 index will greatly improve the system efficiency
  70.                 for queries and updates.
  71. RELATION:       A relation is a two-dimensional table of data.  The
  72.                 column headings are the attributes of the relation
  73.                 and the rows are the data occurences (tuples).
  74. ROW:            A row is the set of values in a row of a two-
  75.                 dimensional table (relation).  A row is sometimes
  76.                 referred to as a tuple.
  77. SCHEMA:         The schema is the definition of the relations and
  78.                 their attributes that comprise the data base.  The
  79.                 relation passwords and constraint rules also are
  80.                 part of the schema.
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.                                                     Page 2
  111.                                                        
  112.                                                        
  113.  
  114.  
  115.                                                     SUMMARY
  116. This document is the user's guide (VAX/VMS) for the Relational
  117. Information Management System, Version 5 (RIM-5).  The information
  118. presented consists of instructions for using RIM-5 as a standalone
  119. system and for using RIM-5 in conjunction with an application
  120. program.
  121. Section 1.0 presents the method of implementation and access for
  122. RIM-5, a discussion of the files used by RIM-5, and the general
  123. syntax of the RIM-5 command language.
  124. Section 2.0 presents instructions for the use of RIM-5 as a
  125. standalone system in both menu and command modes.  In the menu
  126. mode, you are prompted for the inputs required to create, update,
  127. and/or query the data base.  The command mode, as an alternative,
  128. requires the direct input of RIM-5 commands to create, update,
  129. and/or query the data base.  A discussion of all the available
  130. RIM-5 command is presented in this section.
  131. Section 3.0 presents the instructions for the application program
  132. interface.  Any programming language that can call FORTRAN
  133. subroutines can be used.
  134. The appendices present a summary of the RIM-5 commands, a summary
  135. of the application program interface, a sample RIM FORTRAN
  136. program, a list of the current limitations, and a discussion of
  137. the LXLREC free field input routine.
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.                                                     Page 3
  166.                                                        
  167.                                                        
  168.  
  169.  
  170.                                                  1.0  OVERVIEW
  171. The Relational Information Management (RIM) System was originally
  172. developed as a prototype data base management system by Dennis L.
  173. Comfort and Wayne J. Erickson at The Boeing  Company under NASA
  174. Contract NAS1-14700 (IPAD).  Mr. Erickson at the University of
  175. Washington, and Frederick P. Gray at The Boeing Company made en-
  176. hancements to the system which culminated in RIM Version 4 (RIM-
  177. 4) . RIM-5, which is the version of RIM described in this
  178. document, was developed by Mr. Erickson for NASA and Mr. Gray and
  179. Geofferey Von Limbach for Boeing.  RIM is based upon the relational
  180. algebra model for data management and has been used for both en-
  181. gineering and business data.  The system is available as a stand-
  182. alone system and through an application program interface.  The
  183. standalone system may be executed in two modes: menu or command.
  184. The menu mode prompts the user for the input required to create,
  185. update, and/or query the data base.  The command mode requires the
  186. direct input of RIM commands.
  187. RIM-5 includes several enhancements relative to RIM-4, including:
  188.      .   highly portable FORTAN code
  189.      .   additional scientific attribute types for vectors and
  190.          matrices
  191.      .   variable length attributes
  192.      .   improved sort option
  193.      .   improved where clause
  194.      .   an initial set of report writing commands
  195.      .   introduction of tolerance for floating point numbers
  196.      .   additional schema modification commands
  197.      .   enhanced FORTAN interface
  198.      .   RIM-to-RIM communications file
  199. To the interactive/batch user the RIM-5 creation, update, and
  200. query are, for the most part, identical to RIM-4.  Data bases form
  201. RIM-4 must be reloaded for RIM-5, however.  In addition, the ap-
  202. plication program interface has been expanded and modified to ac-
  203. comodate increased capabilities.
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.                                                     Page 4
  221.                                                        
  222.                                                        
  223.  
  224.  
  225. 1.1  IMPLEMENTATION AND ACCESS
  226. RIM is written entirely in FORTRAN 77.  It requires approximately
  227. 300000 (decimal) bytes of virtual memory when run as a standalone
  228. program.
  229. Access to RIM depends on the execution method desired.  To execute
  230. the standalone system, the following control statement is needed:
  231.      RUN  [rimact ]RIM
  232. where rimact is the name of the user directory on which RIMABS and
  233. the RIM HELP data base files reside.
  234. To use the RIM application program interface you need to link
  235. RIMLIB to your application program.  This can be done with the
  236. following instruction:
  237.      LINK JOBA,[rimact]RIMLIB/LIB
  238. where rimact is the name of the user directory on which RIMLIB
  239. resides.  JOBA is the name of the object file of your application
  240. program.
  241. 1.2 DATA BASE FILES
  242. Each data base consists of three RIM-generated files whose logical
  243. names are formed by suffixing the data base name with a 1,2, and
  244. 3.  The first file contains directory data, the second file con-
  245. tains the actual data for each relation, and the third file con-
  246. tains key element pointers.  The default type for these files are
  247. "DAT".  RIM uses logical files FOR005 and FOR006 for input and
  248. output.
  249. If your data base files do not reside on your directory with names
  250. equal to the logical data base files names, you must use the as-
  251. sign control statements prior to the RIM execution to assign
  252. required names to your data base files.  You may also assign your
  253. input and outout files to files other than FOR005 and FOR006  if
  254. desired. (INPUT and OUTPUT commands.)
  255. 1.3 GENERAL COMMAND SYNTAX
  256. RIM is used by entering commands, (which start with keywords) in
  257. response to input prompts (which vary according to the submodule
  258. in use).  Three of the commands (DEFINE, HELP, and LOAD), are used
  259. to enter submodules which have their own sets of commands for
  260. defining and loading a data base.  In describing commands, the
  261. following conventions are used:
  262.      relname
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.                                                     Page 5
  276.                                                        
  277.                                                        
  278.  
  279.  
  280.          or                     name of a relation(s)
  281.       relname1,relname2,...
  282.       attname
  283.          or                     name of an attribute(s)
  284.       attname1,attname2,...
  285.       value
  286.          or                     actual values(s)
  287.       value1,value2,...         (value may be a text string,
  288.                                 scalar, vector, or matrix)
  289. All relation and attribute names must contain at least 1 and no
  290. more than 8 alphanumeric characters.
  291. Many of the commands in RIM have optional parts.  These optional
  292. parts are enclosed in square brackets.
  293.       [THIS IS OPTIONAL]
  294. Some keywords in the commands are selected from a list of accep-
  295. table keywords.  These keywords are in a vertical list with the
  296. first choice enclosed in braces.
  297.       {CHOOSE}
  298.        ONE
  299.        OF
  300.        THESE
  301. RIM command keywords may be abbreviated.  At least the first
  302. 3 characters in the keywords are required.
  303. The following are equivalent:
  304.         1)   SELECT, SELEC, SEL
  305.         2)   INTERSECT, INTER, INT
  306.         3)   DELETE DUPLICATES, DEL DUPLICATES, DEL DUP
  307. All commands in RIM are entered in a free-field format with blanks
  308. and commas as separators.  the following contains a short descrip-
  309. tion of RIM conventions and data generation facilities.  An exten-
  310. sive description, intended for the experienced RIM user, can be
  311. found in Appendix E.
  312. Keywords and data values are separated by blanks or commas.  If a
  313. command is too long for one 80 character line, it may be continued
  314. on succeeding lines by entering "+" as the last character of the
  315. preceding line.  RIM remembers each previous command.  This en-
  316. ables you to re-use all or part of the previous command.  This is
  317. done by using an asterisk to indicate which items of the previous
  318. command are to be re-used.  A single asterisk means re-use the
  319. corresponding  single item of the previous record.  An asterisk
  320. followed by a number n means re-use the next n corresponding
  321. items.  Two asterisks mean re-use all remaining corresponding
  322. items.
  323. The following are all equivalent:
  324.         1)  THIS IS A COMMAND
  325.         2)  THIS +
  326.             IS +
  327.             A +
  328.  
  329.  
  330.                                                     Page 6
  331.                                                        
  332.                                                        
  333.  
  334.  
  335.             COMMAND
  336.         3)  * IS,A COMMAND
  337.         4)  THIS *2 COMMAND
  338.         5)  THIS **
  339. Multiple commands may be entered on one line separated by a semi-
  340. colon or $.
  341.         THIS IS THE FIRST ; THIS IS THE SECOND $ THIS IS THE THIRD
  342. Comments may be placed anywhere within a command by enclosing the
  343. comment between the characters *( and ).
  344.         *(THIS IS A COMMENT)  THIS IS NOT
  345. When numeric data is to be interpreted as text (alphanumeric)
  346. data, the numerals must be enclosed by quotation marks.
  347.         "1234"
  348. When entering text strings which contain embedded blanks or
  349. commas, the entire string must be enclosed by quotation marks.
  350.         "THIS IS A TEXT STRING"
  351. When entering a text string that contains an item enclosed by
  352. quotation marks, double quotation marks are used.
  353.   "THERE IS A ""QUOTE"" IN THIS STRING"
  354. A text string may require continuation on one or more lines.  The
  355. + sign continuation can then be used within the quotation marks.
  356. It is not recommended that you use leading blanks in text strings.
  357. Text which does not have embedded blanks or commas does not
  358. require quotes.
  359. Integer data is input as a string of digits without a decimal
  360. point.  A sign may precede the digits.
  361.         123, -63, +56, 0
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.                                                     Page 7
  386.                                                        
  387.                                                        
  388.  
  389.  
  390. Real or floating point numbers must include a decimal point or E
  391. for the exponent.  If a decimal point is not present, the E must
  392. be preceded by an integer.
  393.         1.3, .005, 0., 6.E-1, 6E-1, 0.60, -23.45
  394. The size of real numbers is limited to the range between 1.0E-38
  395. and 1.0E+38.
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.                                                     Page 8
  441.                                                        
  442.                                                        
  443.  
  444.  
  445.                                               2.0  RIM EXECUTION
  446. Execution of RIM as a standalone program can be effective in two
  447. modes, command mode or menu mode.  The command mode is used when
  448. RIM is executed in the batch environment or for interactive users
  449. who wish to bypass the menu dialogue.  A detailed description of
  450. the commands are given in section 2.1.  The menu mode offers as-
  451. sistance to inexperienced users.  An overview of this mode is
  452. discussed in section 2.2 and a more detailed description of the
  453. menu mode dialogue is given in section 2.3.  The interactive user
  454. may switch freely between menu mode and command mode.
  455. When executing RIM interactively, the first output to your display
  456. will be:
  457.      BEGIN RIM ---- VAX VERSION 5.0  UDXX      YY/MM/DD  HH.MM.SS
  458.      RIM COMMAND MODE
  459.      ENTER "MENU" FOR MENU MODE
  460. UDXX identifies the update level of RIM.  The date and time stamp
  461. indicate current date and time.  At the start of execution you
  462. are in the command mode but you may switch immediately to the menu
  463. mode as indicated. Note that Amiga or Unix or MSDOS versions of RIM
  464. will identify themselves as such, rather than as the VAX version.
  465.  
  466.      As extensions to basic RIM5, RIM commands may be entered in either
  467. case now. Translation to upper case ends when a " character is
  468. seen to allow literal data to be entered, and translation is only
  469. done for console input. Also, where possible the construct
  470.  
  471. } command
  472.  
  473. spawns the command to the host OS. On VMS a LIB$SPAWN call is used
  474. so that effectively all VMS commands are available from within
  475. RIM (permitting long sessions to be broken for interruptions as
  476. needed and returned to without loss of context).
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.                                                     Page 9
  496.                                                        
  497.                                                        
  498.  
  499.  
  500. 2.1  RIM COMMANDS
  501. This section presents a summary of the RIM commands.  You are
  502. restricted from using certain commands based on the knowledge of
  503. assigned passwords.  If no passwords are assigned to the relations
  504. by the data base owner, there are no command restrictions (the
  505. DEFINE submodule excepted).  See figure 2.1-1.
  506. 2.1.1  General Commands
  507.                                           DEFINING a Data Base Schema
  508.  
  509.      The DEFINE submodule (prompt D>) commands are used to define
  510. the structure of the data base and are used in the sequence described
  511. below. The definition of the data base is called the schema. The schema name
  512. corresponds to the name of the data base and is used to form the names
  513. of the files used in the database. Attributes, relations, passwords, and
  514. rules (constraints) are defined using this submodule. To access this
  515. submodule enter:
  516.  
  517. DEFINE dbname
  518.  
  519. You must identify the name of the database whose definition you are going to
  520. create or expand by specifying "dbname", the 1-6 character alphanumeric
  521. schema name. This name is used to form the name of the files used to
  522. store the data base. The dbname, when augmented by a single number must
  523. be a legal filename. Once dbname is specified you must identify the owner
  524. password of the data base.
  525.  
  526. OWNER password
  527.  
  528. The "password" entered must be a 1-8 character alphanumeric name. When used
  529. in the USER command, this password represents a master password to the
  530. data base. It will override any individual relation passwords. If the
  531. data base already exists and you want to define additional attributes or
  532. relations, "password" is checked against the existing owner password.
  533.  
  534.      Following the entering of the schema name and owner password, the attributes,
  535. relations, and relation passwords and rules are defined.
  536.  
  537.      To define attributes enter:
  538.  
  539. ATTRIBUTES
  540. attname type1 [{length}] [KEY]
  541.                  VAR
  542. attname type2 [{row, col}] [KEY]
  543.                 row, VAR
  544.                 VAR, VAR
  545.               .
  546.               .
  547.               .
  548.  
  549.  
  550.                                                    Page 10
  551.                                                        
  552.                                                        
  553.  
  554.  
  555.  
  556. The attribute definitions are ended when you specify one of the DEFINE
  557. submodule keywords RELATIONS, PASSWORDS, or RULES.
  558.  
  559. TYPE1 Attributes:
  560.  
  561.      RIM supports seven "type1" data types: real (floating point), integer,
  562. text, double precision, real vectors, integer vectors and double precision
  563. vectors. You must enter REAL, INT, TEXT, DOUB, RVEC, IVEC, or DVEC
  564. for type1. The default length is one value except for TEXT where it is 8
  565. characters. The length is specified in terms of the number of values and
  566. characters respectively. VAR indicates variable length. The optional KEY
  567. specification causes an index file to be built for this attribute. This 
  568. file is used by RIM to quickly find qualifying rows for retrievals and
  569. updates. If KEY is not specified (nonkey attribute) the index file is not
  570. built. You should consider the cost of building and storing the KEY
  571. attribute pointers on teh index file versus the benefits you will obtain
  572. when deciding if a KEY declaration should be used. No specific rules are
  573. given here; experience should be used as a guide. An attribute can
  574. be changed from KEY to non-KEY and vice-versa by using the BUILD KEY
  575. and DELETE KEY commands described in section 2.1.9. For large
  576. data bases (more than 1000 rows), experience has shown that it is
  577. most efficient not to specify a KEY in the DEFINE submodule
  578. but rather to load the data without keys and then build the index
  579. files using the BUILD KEY command. The greater the number of keys,
  580. the more efficient this method is.
  581.  
  582.      TYPE2 Attributes
  583.  
  584.      RIM supports three "type2" data types: real matrices, integer matrices
  585. or double precision matrices. You must enter RMAT,IMAT, or DMAT for
  586. type2. The matrices can be of fixed size, have variable column
  587. dimensions or variable row and column dimensions. You enter the row
  588. dimension first, followed by the column dimension. The default dimension
  589. is 1 by 1. The keyword KEY has the same meaning as for "type1" attributes.
  590.  
  591.      To define relations enter:
  592.  
  593. RELATIONS
  594. relname WITH attname1 [attname2 ...]
  595.      ...
  596.  
  597.      The relation dedfinitions are ended by specifying one of the
  598. DEFINE submodule keywords ATTRIBUTES, PASSWORDS, RULES, or END.
  599.  
  600.      The attributes must be listed in the order in which they are
  601. to appear in the relation. No attributes can be used which have
  602. not been previously defined, either in the current attributes
  603.  
  604.  
  605.                                                    Page 11
  606.                                                        
  607.                                                        
  608.  
  609.  
  610. definition subsection or in a previous definition of this data
  611. base. Attributes which are defined but not included in a relation
  612. will not become part of the RIM schema.
  613.  
  614.      A RIM data base must have attributes and relations defined, but
  615. passwords and constraint rules are optional. If read or modify
  616. passwords are desired enter:
  617.  
  618. PASSWORDS
  619. {READ PASSWORD}  FOR relname IS password
  620.  RPW
  621.  
  622. {MODIFY PASSWORD} FOR relname IS password
  623.  MPW
  624.  
  625.  
  626. The password definitions are ended by specifying one of the DEFINE
  627. submodule keywords ATTRIBUTES, RELATIONS, RULES, or END.
  628.  
  629.      A password can be any string of 1-8 alphanumeric characters. When
  630. you are doing queries, loads, or modifications, the current password
  631. is specified by the USER command. If this password does not match
  632. the read, modify, or owner password for a given relation, you
  633. cannot query that relation. If this password does not match the modify
  634. or owner password, you cannot load or modify the relation.
  635.  
  636.      Constraint rules are another optional section of the DEFINE submodule.
  637. If rules are specified, they are used during the loading process and
  638. during CHANGE commands to screen out rows which do not meet the
  639. constraint rules. Rules may be defined for REAL, INT, and DOUB
  640. attributes of length 1 and for fixed length TEXT attributes. At most
  641. 10 rules may be specified for a single relation.
  642.  
  643.      Tol define constraint rules enter:
  644.  
  645.  
  646. RULES
  647.   attname [IN relname] {EQ} value [{AND} attname ...]
  648.                         NE          OR
  649.                         GT
  650.                         GE
  651.                         LT
  652.                         LE
  653.  
  654.  
  655.     or
  656.  
  657.  
  658.  
  659.  
  660.                                                    Page 12
  661.                                                        
  662.                                                        
  663.  
  664.  
  665.   attname1 IN relname {EQA} attname2 IN relname [{AND} ...]
  666.                        NEA                        OR
  667.                        GTA
  668.                        GEA
  669.                        LTA
  670.                        LEA
  671.  
  672.  
  673. where EQ, NE, GT, GE, LT, ands LE mean equals, not equal to, greater than,
  674. greater than or equal to, less than, or less than or equal to respectively.
  675. EQA, NEA, etc. mean equals attribute, not equals attribute, and so on.
  676.  
  677.      The rule definitions are ended by specifying one of the DEFINE
  678. submodule keywords ATTRIBUTES, RELATIONS, PASSWORDS, or END.
  679.  
  680.      Atributes referenced in the rule definitions must have been previously 
  681. defined. By specifying rules, you can restrict an attribute to a range
  682. of values or require that the value of an attribute in one relation
  683. have a specific relationship to the values of an attribute in the
  684. same or a different relation. The comparison operators ending in A
  685. are used when the comparison is to an existing attribute rather than
  686. to a constant. A rule expression may have at most 9 boolean operators.
  687. The method used for constraint checking is that the value of the first
  688. attribute mentioned in the rule is obtained from the input (LOAD or
  689. CHANGE command) and checked against the value specified or against
  690. the existing data base value of the second attribute.
  691.  
  692.      To complete schema definition and leave the DEFINE submodule you enter
  693. END.
  694.  
  695.      HELP Command
  696. The HELP command allows you to obtain: a description of the
  697. available RIM commands, a discussion of the general command
  698. syntax, a summary of all available commands, and general news
  699. about the RIM system. HELP is available at any time during
  700. execution except when in the menu mode.
  701. To receive help when in the command mode enter:
  702. HELP [{command name}]
  703.         RIM
  704.         SYNTAX
  705.         WHERE
  706.         SUMMARY
  707.         NEWS
  708.         SORT
  709.         INPUT FORMAT
  710.  
  711.  
  712.  
  713.  
  714.  
  715.                                                    Page 13
  716.                                                        
  717.                                                        
  718.  
  719.  
  720.                                               CURRENT PASSWORD
  721. SECTION NUMBER     COMMAND
  722.                                             OWNER  MODIFY  READ   NONE
  723.  . 2.4.1        . GENERAL                     X       X      X     X
  724.  . 2.4.2        . DEFINE                      X
  725.  . 2.4.3        . LOAD                        X       X
  726.  . 2.4.4        . DATA BASE QUERY             X       X      X
  727.  . 2.4.5        . SCHEMA QUERY                X       X 2    X 2
  728.  . 2.4.6        . COMPUTATION                 X       X      X
  729.  . 2.4.7        . DATA BASE MODIFICATION      X       X
  730.  . 2.4.8        . SCHEMA MODIFICATION         X       X 1
  731.  . 2.4.9        . RELATIONAL ALGEBRA          X       X
  732.  . 2.4.10       . REPORT GENERATION           X       X      X
  733.  . 2.4.11       . COMMUNICATION               X       X
  734.                     1 EXCEPT CHANGE OWNER        2 EXCEPT PRINT RULES
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.                                                    Page 14
  771.                                                        
  772.                                                        
  773.  
  774.  
  775. The HELP submodule available inside the HELP submodule are identical to
  776. the HELP commands except that the keyword HELP is omitted.  The
  777. HELP submodule displays information one screen at a time.  After
  778. each screen you will have the option to continue displaying the
  779. text by entering * or to return to the HELP submodule by entering QUIT.
  780. You will remain in the submodule until you enter an END command which
  781. will return to the command mode.
  782. MENU Command
  783. The MENU command places you in the menu mode.  It may be entered
  784. at any point when in command mode except when in the DEFINE, HELP,
  785. or LOAD submodules.  The menu mode is particularly useful for
  786. schema definition and data loading.
  787.         MENU
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.                                                    Page 15
  826.                                                        
  827.                                                        
  828.  
  829.  
  830. OPEN Command
  831. The OPEN command is required whenever an existing data base is to
  832. be used.  You specify the name of the data base.  RIM uses the
  833. name of the data base to form the names of the three files which
  834. contain the data base.  The data base files must either reside
  835. in your dictionary or you must make a logical file assignment prior
  836. to RIM execution.
  837. OPEN dbname
  838. Only one RIM data base may be open at a time (if you don't close
  839. the present data base before opening a new one, RIM will auto-
  840. matically close the present data base.)  The OPEN command must be
  841. issued before any commands that require data from the data base
  842. can be processed.
  843. CLOSE Command
  844. The CLOSE command permits you to close a RIM data base without
  845. leaving RIM.  This enables you to close one data base, then
  846. open or define a different one, all within one RIM session.
  847. This command is not needed if only one RIM data base is acces-
  848. sed during a RIM session.  This command results in update of
  849. the data base files to reflect all changes you have made to
  850. the data base.
  851.         CLOSE
  852. Note: the current data base will be closed for you when you
  853. leave RIM by issuing an EXIT command.
  854. USER Command
  855. This command is used to specify your user password to RIM.
  856. Your user password is used to check against read and modify
  857. passwords specified for the relations.  Each time this com-
  858. mand is issued, the new password replaces the current user
  859. password.  The default password is the word NONE.
  860.         USER password
  861. INPUT Command
  862. This command is used to specify the name of a file which
  863. contains the RIM commands and/or input data.  Alternate
  864. input file names may be assigned as often as required.
  865. The use of this command allows you to define command pro-
  866. cedures on a file and then have RIM execute the set of
  867. commands without user interaction.
  868.         INPUT filename
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.                                                    Page 16
  881.                                                        
  882.                                                        
  883.  
  884.  
  885. The last command on the alternate input file should be INPUT
  886. INPUT which returns input to the batch input file or your
  887. terminal.  INPUT TERMINAL will, for interactive jobs, do the
  888. same thing.
  889. OUTPUT Command
  890. This command is used to specify the name of the output file.
  891. Specifying a file other than OUTPUT will result in the output
  892. from the RIM commands being placed on the specified file name.
  893. The output file name may be changed as often as desired.  The
  894. use of this command allows the interactive user to get an
  895. offline hardcopy output from RIM.
  896.         OUTPUT filename
  897. OUTPUT OUTPUT will return the output to the batch output file
  898. or your terminal.  OUTPUT TERMINAL will, for interactive
  899. jobs, do the same thing.
  900. ECHO Command
  901. This command is used to control the printing of your input
  902. commands on the output file.  Default is for ECHO printing
  903. enter:
  904.         ECHO
  905. NOECHO Command
  906. The NOECHO command turns off ECHO printing.
  907.         NOECHO
  908. TOLERANCE Command
  909. For attributes which contain floating point numbers, a tolerance
  910. may be used to qualify equality, nonequality and order.  The tol-
  911. erance applies to any real or double precision number you use in a
  912. WHERE clause.  If A is an attribute with value a, and r is a user
  913. specified number used in a WHERE clause, and t a tolerance (posi-
  914. tive, zero, negative), the following are true conditions:
  915.         A EQ r if and only if r-t <= a <= r+t
  916.         A NE r if and only if a < r-t or a > r+t
  917.         A GT r if and only if a > r-t
  918.         A GE r if and only if a => r-t
  919.         A LT r if and only if a < r+t
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.                                                    Page 17
  936.                                                        
  937.                                                        
  938.  
  939.  
  940.         A LE r if and only if a <= r+t
  941. If t is a percentage tolerance, t is to be replaced with t x r/100
  942. in the above expressions to define true conditions for percentage
  943. tolerances.
  944.         TOLERANCE tol [PERCENT]
  945. where tol is the tolerance and the presence or absence of the
  946. keyword PERCENT indicates whether tol is a percentage tolerance
  947. or an absolute tolerance.  The TOLERANCE command can be used
  948. as many times as desired to reset the tolerance.  A tolerance
  949. stays in effect for a session until a new tolerance is speci-
  950. fied.  The default value for tolerance is 0. .
  951. NOCHECK Command
  952. Rule checking applies to the CHANGE and LOAD commands. Default
  953. is that rules, if defined, are enforced.  The NOCHECK command
  954. suppresses the ruler checking.
  955.         NOCHECK
  956. CHECK command
  957. The CHECK command turns on rule checking.  The CHECK and NOCHECK
  958. commands may be issued as many times as required anywhere in
  959. the input stream.
  960.         CHECK
  961. EXIT Command
  962. To leave RIM without dropping your current data base enter:
  963.         {EXIT}
  964.          QUIT           
  965. This command closes your current data base.  Data needed by your data
  966. bases is copied from the incore working areas to the logical files
  967. whose names were determined by the OPEN command or by the data base
  968. name designated in the DEFINE submodule.
  969. RELOAD Command
  970. The RELOAD command is used whenever you want to rebuild the data
  971. files of your data base to recover unused space created by row
  972. deletions, relation removals, and certain attribute changes.
  973. When a row is deleted or a relation removed, its space is not reused
  974. until you issue this command.  In addition, if a variable length
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.                                                    Page 18
  991.                                                        
  992.                                                        
  993.  
  994.  
  995. attribute is modified so that it increases in length, the row is
  996. deleted and replaced with a new one.  the old row becomes unused
  997. space.  If your data base has any KEY attributes, then the access
  998. pointer files maintained for those attributes are also rebuilt.
  999. The syntax for the command is:
  1000.         RELOAD
  1001. 2.1.2  Define Submodule Commands
  1002. Define Submodule Commands
  1003. The Define submodule (prompt = D> ) commands  are used to define the
  1004. structure of the data base and are used in the sequence described
  1005. below.  The definition of the data base is called the schema.  The
  1006. schema name is the name of the data base and forms the essential part
  1007. of the names of the files used for the data base.
  1008. Attributes, relations, passwords, and constraints (rules) are defined
  1009. using this submodule.  The naming conventions for schema definition
  1010. are described in section 2.3.3.  To access this submodule enter:
  1011.         DEFINE dbname
  1012. You must identify the name of the data base whose definition you are
  1013. going to create or expand by specifying the schema name.  This name
  1014. is used to form the name of the files used to store the data base
  1015. tables.  The dbname, when augmented with a single number must be
  1016. a legal filename.  Once dbname is specified you must identify the
  1017. owner password of the definition.
  1018.         OWNER password
  1019. If the data base already exists and you want to define additional
  1020. attributes or relations, "password" is checked against the existing
  1021. owner password.
  1022.         
  1023.         ATTRIBUTES
  1024.         attname type1 [{length}] [KEY]
  1025.                         VAR
  1026.         attname type2 [{row,col}] [KEY]
  1027.                         row,VAR
  1028.                         VAR,VAR
  1029. -
  1030. -
  1031. -
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.                                                    Page 19
  1046.                                                        
  1047.                                                        
  1048.  
  1049.  
  1050. The attribute definitions are ended when you specify one of the
  1051. keywords RELATIONS, PASSWORDS or RULES
  1052. Type1 Attributes:
  1053. RIM supports seven data types of "type1": real (floating point),
  1054. integer, text, double precision, real vectors, integer vectors and
  1055. double precision vectors.  You must enter REAL, INT, TEXT, DOUB,
  1056. RVEC,IVEC or DVEC for type1.  The default length is one number,
  1057. except for TEXT for which it is 8 characters.  The length is speci-
  1058. fied in number of values and characters respectively.  VAR indicates
  1059. variable length.  The optional KEY specification causes an index file
  1060. to be built for the attributes which is used by RIM to quickly find
  1061. qualifying rows for retrievals and updates.  The default is that such
  1062. an index file is not built (non-key attribute).  You should consider
  1063. the cost of building and storing index file data versus the benefits
  1064. you will obtain from quicker retrievals when deciding if a KEY declara-
  1065. tion should be used.  No specific rules can be given here, experience
  1066. should be used to judge.  An attribute can be changed from KEY to NON-
  1067. KEY or vice-versa by using the BUILD KEY and DELETE KEY commands des-
  1068. cribed in section 2.1.8.  For large data bases (more than 1,000 rows) ,
  1069. experience has shown that it is most efficient not to specify a KEY in
  1070. the DEFINE submodule but rather to load the data without keys and to
  1071. later cause index files to be built using the BUILD KEY command.  The
  1072. greater the number of keys, the more efficient this method is.
  1073. Type2 Attributes:
  1074. RIM supports three data types of "type2": real matrices, integer
  1075. matrices or double precision matrices.  You must enter RMAT, IMAT
  1076. or DMAT for type2.  The matrices can be of fixed size, have variable
  1077. column dimension or variable row and column dimensions.  You enter
  1078. the row dimension first, followed by the column dimension.  Default
  1079. dimension is 1x1.  The key-word KEY has the same meaning as for
  1080. "type1" attributes.
  1081. To define relations enter:
  1082.         RELATIONS
  1083.         relname WITH attname1 [attname2...]
  1084.           -
  1085.           -
  1086.           -
  1087. The relation definitions are ended by specifying one of the key-
  1088. words ATTRIBUTES, PASSWORDS, RULES, or END which start the other
  1089. sections of the DEFINE submodule or finishes the schema definition.
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.                                                    Page 20
  1101.                                                        
  1102.                                                        
  1103.  
  1104.  
  1105. The attributes must be listed in the order in which they are to
  1106. appear in the relation.  No attributes can be used which have not
  1107. been previously defined, either in the current attributes definition
  1108. subsection or in a previous definition of this data base.  Attri-
  1109. butes which are defined but not included in a relation will not be-
  1110. come part of the RIM schema.
  1111. A RIM data base must have attributes and relations defined, but
  1112. passwords and constraint rules are optional.  If read or modify
  1113. passwords are desired enter:
  1114.         PASSWORDS
  1115.         {READ PASSWORD} FOR relname IS password
  1116.          RPW
  1117.         {MODIFY PASSWORD} FOR relname IS password
  1118.          MPW
  1119.              -
  1120.              -
  1121.              -
  1122. The password definitions are ended by specifying one of the key-
  1123. words ATTRIBUTES, RELATIONS, RULES, or END which start the other
  1124. sections of the DEFINE submodule or finishes the data base defini-
  1125. tion.  Passwords can be any string of alphanumeric characters up
  1126. to 8 characters long.  When you are doing queries, loads, or modi-
  1127. fications, the current password is specified by the USER command.
  1128. If this password does not match the read, modify, or owner pass-
  1129. word for a given relation, you can query that relation.  If this
  1130. password does not match the modify or owner password, you cannot
  1131. load or modify the relation.
  1132. Constraint rules are another optional section of the DEFINE sub-
  1133. module.  If rules are specified, they are used during the loading
  1134. process or during CHANGE commands to screen out rows which do not
  1135. meet the constraint rules.  Rules are specified by relation.  At
  1136. most
  1137. 10 rules may be specified for a single relation.  There are several
  1138. options available in the rule definition section.  To define
  1139. constraint rules enter:
  1140.         RULES
  1141.         attname [IN relname]  {EQ} value [ {AND} attname ...]
  1142.                                NE            OR
  1143.                                GT
  1144.                                GE
  1145.                                LT
  1146.                                LE
  1147. or
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.                                                    Page 21
  1156.                                                        
  1157.                                                        
  1158.  
  1159.  
  1160.         attname1 IN relname {EQA} attname [ {AND} ...]
  1161.                              NEA              OR
  1162.                              GTA
  1163.                              LTA
  1164.                              LEA
  1165. where:  EQ  = Equals
  1166.         NE  = Not equal to
  1167.         GT  = Greater than
  1168.         GE  = Greater than or equal to
  1169.         LT  = Less than
  1170.         LE  = Less than or equal to
  1171.         EQA = Equals attribute
  1172.         NEA = Not equal to attribute
  1173.         LTA = Less than attribute
  1174.         LEA = Less than or equal to attribute
  1175. The rule definitions are ended by specifying one of the key-
  1176. words ATTRIBUTES, RELATIONS, PASSWORDS, or END which start
  1177. the other sections of the DEFINE submodule or finishes the
  1178. schema definition.  Attributes referenced in the rule defini-
  1179. tions must have been previously defined.  By specifying
  1180. rules, you can restrict an attribute to a range of values or
  1181. require that the value of an attribute in one relation have
  1182. a specified relationship to the values of an attribute in
  1183. the same or different relation.  The comparison operators
  1184. ending in A are used when the comparison is to existing
  1185. attribute values rather than to a specified constant.  A
  1186. rule expression may contain a maximum of 9 Boolean operators.
  1187. The method used for constraint checking is that the first
  1188. attribute mentioned in the rule is taken from the input
  1189. (LOAD or CHANGE command) data and checked against the re-
  1190. mainder of the rule expression using existing values in
  1191. the data base.
  1192. To finish the schema definition you enter the following
  1193. keyword and leave the DEFINE submodule:
  1194.         END
  1195. Example of DEFINE submodule commands:
  1196.         DEFINE RIMDS
  1197.         OWNER ME
  1198.          ATTRIBUTES
  1199.           MODEL TEXT KEY
  1200.           WEIGHT REAL
  1201.           NUMPASS INT
  1202.           CARRIER TEXT
  1203.           FLIGHTNO INT
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.                                                    Page 22
  1211.                                                        
  1212.                                                        
  1213.  
  1214.  
  1215.           NAME TEXT KEY                 
  1216.           AGE INT
  1217.           UPDATE IMAT 4,VAR
  1218.          RELATIONS
  1219.           AIRPLANE WITH MODEL WEIGHT NUMPASS
  1220.           FLIGHTS WITH CARRIER FLIGHTNO MODEL UPDATE
  1221.           PEOPLE WITH NAME AGE
  1222.          PASSWORDS
  1223.           MPW FOR FLIGHTS IS AGENT
  1224.           RPW FOR PEOPLE IS BLUE
  1225.          RULES
  1226.           MODEL IN FLIGHTS EQA MODEL IN AIRPLANE
  1227.           AGE GT 21 AND AGE LT 65
  1228.           NUMPASS IN AIRPLANE LE 350
  1229. 2.1.2 Loading a relation
  1230. 2.1.3  Load Submodule Commands
  1231. The LOAD submodule (prompt = L>) commands are used to add rows to
  1232. a newly defined relation or to add rows to a relation which
  1233. already contains data.  To access this submodule enter:
  1234.         LOAD relname
  1235. You may now load rows into the relation, one row at a time, by
  1236. entering data values in an order corresponding to the attribute
  1237. order:
  1238.         value1 value2 ... valuen
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.                                                    Page 23
  1266.                                                        
  1267.                                                        
  1268.  
  1269.  
  1270. The method used to input values for the different attribute types
  1271. is shown below:
  1272.         Attribute
  1273.           Length or
  1274.   Type    Dimension        Valuei                 Remark
  1275. REAL,INT   n n=>1      (val1 ... valn)          Parentheses
  1276. DOUB,RVEC                                       optional
  1277. IVEC,DVEC
  1278. REAL,INT   VAR         (val1 val2 ...)          Parentheses
  1279. DOUB,RVEC                                       required
  1280. IVEC,DVEC
  1281. TEXT       any         "text string"            In many cases,
  1282.                                               (see section 1.3)
  1283.                                                 " " is optional
  1284. RMAT,IMAT  m,n      ((r1c1...rmc1)(r1c2...) +   Columnwise
  1285. DMAT                     ...rmcn))              Parentheses
  1286.                                                 optional
  1287. RMAT,IMAT  m,VAR    ((r1c1...) (r1c2...)...))   Columnwise
  1288. DMAT        or                                  Parentheses
  1289.            VAR,VAR                              required
  1290. -----------------------------------------------------------------------
  1291. To finish data loading you enter:
  1292.         END
  1293. Multiple relations may be loaded from within the LOAD submodule by
  1294. re-entering the LOAD command instead of the END command.
  1295. Example of LOAD submodule commands:
  1296.                 USER AGENT
  1297.                 LOAD AIRPLANE
  1298.                 DC9 87000.  110
  1299.                 747SP 200000.  350
  1300.                 LOAD PEOPLE
  1301.                 BOB 30
  1302.                 JOE 32
  1303.                 ALICE 29
  1304.                 LOAD FLIGHTS
  1305.                 UAL 16 "757"  ((1,2,3,4) (4,5,6,7))
  1306.                 *3 ((2,4,5,8)(1,2,3,4) (4,5,6,7))
  1307.                 END
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.                                                    Page 24
  1321.                                                        
  1322.                                                        
  1323.  
  1324.  
  1325. If the value for an attribute is unknown, you enter the characters
  1326. -0- for the missing value or use two successive commas.
  1327.         L1011 -0- -0- 250
  1328.         L1011,,,250
  1329. These two input entries have identical meaning.
  1330. 2.1.3 Querying A Relation
  1331. 2.1.4  Commands for Querying the Data Base
  1332. SELECT Command
  1333. The SELECT command is used for displaying or printing data from
  1334. one relation.  It has many options.  To print all the data from a
  1335. relation:
  1336.         SELECT ALL FROM relname
  1337. To print selected attribute values from all rows in a relation:
  1338.         SELECT attname1 [  attname2 ... attnamen ] FROM relname
  1339. The above command will print up to 20 attributes in any order.
  1340. The number of attributes is limited by space available in a line.
  1341. As a rule of thumb, 7 attributes may be selected when running at
  1342. an 80 character interactive terminal and 11 when running in the
  1343. batch mode or at an 132 character terminal.
  1344. For variable length attributes or for attributes of fixed length
  1345. that would otherwise not fit on aline alone or together with
  1346. other attributes, you may format the output using the optional
  1347. field width control:
  1348.         SELECT attname1 [ =fw1 ] [ attname2 [ =fw2 ] ... ] +
  1349.         FROM
  1350. fwi is the output field width for attnamei.  For a text type
  1351. attribute, fwi is the width of the output paragraph in number
  1352. of characters, for other attribute types it is the number of
  1353. values.  When the field width option is used, RIM will use as
  1354. many output lines as required for each row.
  1355. The field width defaults depend on the attribute type. For a
  1356. fixed width atrtribute, other than matrix, no paragraphing is
  1357. attempted. For a fixed length matrix,the default paragraph
  1358. width is a full row. The system wil use a field width equal
  1359. to the attribute length or column dimension to display the value(s)
  1360. of the attribute. For a variable length attribute of type TEXT,
  1361. the default field width is 40 characters with paragraphing. For
  1362. variable length attribtes of type REAL, INT, DOUB, the default
  1363. is 4 values with paragraphing. For variable length vector type
  1364. attributes, the default is a display of the length and 3 values
  1365. with paragraphing. For variable length matrix attributes the
  1366. default is a display of the row and column dimensions and 3
  1367. values with paragraphing. Each row starts on a new line.
  1368. If a field width is specified, the system will display the
  1369. dimension of variable length vectors and matrices and use one
  1370. of the specified output positions for these values. However,
  1371. if a field width of 1 is specified for such an attribute, the row
  1372. and column dimensions will not be displayed.
  1373.  
  1374.  
  1375.                                                    Page 25
  1376.                                                        
  1377.                                                        
  1378.  
  1379.  
  1380. Defaults are rather complex.  For a fixed length attribute,
  1381. other than matrix, no paragraphing is attempted.  For a fixed
  1382. length matrix, the default paragraph width is a full row.  The
  1383. system will use the field width required to display the value(s)
  1384. of the attribute.  For a variable length attribute of type TEXT,
  1385. the default is a display of a maximum of 40 characters with
  1386. paragraphing.  For variable length attributes of types REAL, INT,
  1387. DOUB, the default is 4 elements with truncation.  For variable
  1388. length vector type attributes, the default is 4 elements with
  1389. paragraphing (no truncation).  For variable length matrix at-
  1390. tributes the default is 4 elements with paragraphing (no trun-
  1391. cation).  A row starts on a new line.
  1392. Whether field width is specified or not, the system will display
  1393. the dimension of variable length vectors and matrices using one
  1394. of the output positions.  However, should you specify a width of
  1395. one for such an attribute, the row and column dimensions will not
  1396. be displayed.
  1397. Further information about line width, number of lines per page,
  1398. defaults and user specifications is given in section 2.1.10 as
  1399. part of the RIM report writing features.
  1400. When paragraphing TEXT type attributes, RIM will identify sub-
  1401. strings of text separated by blanks.  The substring is placed
  1402. on the current line if there is space available.  If the current
  1403. line contains less than four characters, the number of characters
  1404. that fit on the line are removed from (the front of) the substring
  1405. and put on the line (without hyphen) and continued on the next
  1406. line.  If the current line contains more than four characters,
  1407. the substring will be placed on the next line.
  1408. Examples of SELECT command:
  1409. SELECT ivecvar FROM rel1
  1410.         DIM     IVECVAR
  1411. -----------------------------------
  1412.          7        1     2       3
  1413.                   4     5       6
  1414.                   7
  1415.          1       10
  1416. SELECT imatvv FROM rel1
  1417.        ROW    COL    IMATVV
  1418. ---------------------------------------
  1419.         2      5      11     12     13
  1420.                       14     15
  1421.                       21     22     23
  1422.                       24     25
  1423.         1      1      11        
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.                                                    Page 26
  1431.                                                        
  1432.                                                        
  1433.  
  1434.  
  1435. SELECT textv = 9 FROM rel 1
  1436. TEXTV
  1437. ------------
  1438. THIS IS
  1439. AN EXAMPL
  1440. E OF
  1441. WRAPAROUN
  1442. D OF TEXT
  1443. THIS IS
  1444. ANOTHER
  1445. EXAMPLE
  1446. OF TEXT
  1447. The attribute name attnamei may be replaced by its correspond-
  1448. ing attribute number (attnum1).  The attribute number is deter-
  1449. mined by the position of the attribute in the relation.  Specific
  1450. elements of a vector or a matrix may also be designated. The general
  1451. form of the unconditional SELECT command is:
  1452. SELECT {attname1 [ = fw1 ]} [attname2 [= fw2] ...] +
  1453.         attnum1 [ = fw1 ]
  1454.         attname1(i)
  1455.         attname1(i,j)
  1456.         attnum1(i)
  1457.         attnum1(i,j)
  1458.         ALL
  1459. FROM  relname
  1460. To print all attributes from a relation where certain conditions
  1461. are met:
  1462.   SELECT ALL FROM relname WHERE condition1 [ {AND} condition2 ...]
  1463.                                                OR
  1464. Up to ten conditions may be combined using the Boolean operators
  1465. AND/OR.  The conditions are combined from left to right.
  1466. A LIMIT condition, if used, does not count as one of the 10
  1467. conditions.
  1468. Each condition may be one of the following forms:
  1469.         attname EXISTS
  1470.         attname FAILS
  1471.         attname EQ MAX
  1472.         attname EQ MIN
  1473.         attname EQ value
  1474.         attname EQS value
  1475.         attname NE value        
  1476.         attname GT value
  1477.         attname GE value
  1478.         attname LT value
  1479.         attname LE value
  1480.         attname EQ list
  1481.         attname NE list
  1482.         attname1 EQA attname2
  1483.  
  1484.  
  1485.                                                    Page 27
  1486.                                                        
  1487.                                                        
  1488.  
  1489.  
  1490.         attname1 NEA attname2
  1491.         attname1 GTA attname2
  1492.         attname1 GEA attname2
  1493.         attname1 LTA attname2
  1494.         attname1 LEA attname2
  1495.         ROWS EQ rownumber
  1496.         ROWS NE rownumber
  1497.         ROWS LT rownumber
  1498.         ROWS LE rownumber
  1499.         ROWS GE rownumber
  1500.         ROWS GT rownumber
  1501.         ROWS EQ list
  1502.         ROWS NE list
  1503.         LIMIT EQ number
  1504. where:  EQ  = Equals    
  1505.         EQS = Contains the text string
  1506.         NE  = Not equals
  1507.         GT  = Greater than
  1508.         GE  = Greater than or equal to
  1509.         LT  = Less than
  1510.         LE  = Less than or equal to
  1511.         EQA = Equals attribute
  1512.         NEA = Not equals attribute
  1513.         GTA = Greater than attribute
  1514.         GEA = Greater than or equal to attribute
  1515.         LTA = Less than attribute
  1516.         LEA = Less than or equal to attribute
  1517.         MAX = Maximum value
  1518.         MIN = Minimum value
  1519. Attname, attname1, attname2 may refer to an element of a vector
  1520. or a matrix.
  1521. When an attribute has been assigned a value, then EXISTS will
  1522. qualify those attributes.  If an attribute has not been assigned
  1523. a value, but was loaded with -0-, then FAILS will qualify those
  1524. attributes.
  1525. MAX and MIN comparison can only be made for integer, real and
  1526. double precision attributes of fixed length equal to 1.
  1527. Value in a comparison statement must follow the rules of section
  1528. 2.1.3 for vectors and matrices, i.e., if the attribute is of
  1529. variable length or dimension, parentheses must be used to input
  1530. a vector or a matrix value or a list of vector and matrix values.
  1531. EQS applies to text strings only.  In such a comparison, value is
  1532. a text string and the comparison is true if value is found as a
  1533. substring anywhere within the attribute for which comparison is
  1534. requested.
  1535. NE comparison when applied to matrices or vectors is true if the
  1536. length or dimension is different from the length or dimension of
  1537. your specified comparison vector or matrix or if any vector or
  1538.  
  1539.  
  1540.                                                    Page 28
  1541.                                                        
  1542.                                                        
  1543.  
  1544.  
  1545. matrix elements differs.
  1546. GT and LT comparisons for vector and matrix attributes are
  1547. "lexicographical", i.e. a comparison is made element by
  1548. element (columnwise for matrices) and continued until a true
  1549. or false condition is detected.  If no such condition is detected
  1550. after the last element is checked, a false condition is assumed.
  1551. Comparison is made only for vectors and matrices of the same
  1552. sizes as comparison data.
  1553. GE and LE comparisons for vector and matrix attributes are similar
  1554. to GT and LT comparisons except it continues if an equal condi-
  1555. tion is detected and if no condition is detected after the last
  1556. element is checked, a true condition is assumed.
  1557. Comparison rules for vector attributes apply also to real, integer
  1558. and double precision attributes of fixed or variable length.
  1559. A list is a simple list (a1, a2, a3,...,an) of values.
  1560. The comparison key words ending in A are used when comparing
  1561. the value of one attribute to the value of another attribute
  1562. in the same row of the relation.
  1563. ROWS refer to row numbers in a relation.  Note that a relation is
  1564. loaded in input row order but that subsequent operations
  1565. (changes) to the data base may cause the order of the rows to
  1566. change.
  1567. When the LIMIT clause is used, only the first LIMIT number of
  1568. the rows that otherwise would qualify will actually qualify.
  1569. Processing the WHERE condition can be speeded up greatly if
  1570. index processing is used.  Index processing involves using
  1571. the indices created for KEY attributes rather than looking
  1572. at each row of a relation to find the rows qualified by
  1573. the WHERE conditions.  Index processing will be used when
  1574. the following are all true:
  1575.         1)   The last condition uses an attribute which is KEY
  1576.         2)   The last condition uses EQ
  1577.         3)   The last condition is not combined by OR with the
  1578.              other conditions.
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.                                                    Page 29
  1596.                                                        
  1597.                                                        
  1598.  
  1599.  
  1600. The output can be sorted by specifying sorting attributes.  The
  1601. sorting order is user specified with default low to high.
  1602.         SELECT ... FROM relname
  1603.         SORTED BY attname1 [ {=A}  ] { attname2 [={A} ] ...] +
  1604.                                D                   D
  1605.         [ WHERE ...]
  1606. A and D stands for ascending and descending order respectively.
  1607. If a sort on more than one attribute is requested, the output will
  1608. first be ordered according to the first mentioned attribute.  In
  1609. case there are duplicates for the first sort attribute, these will
  1610. be ordered by the second sort attribute, duplicates within this by
  1611. the third and so on.  A maximum of 5 sorts may be specified.  When
  1612. multiple attributes are used, ascending and descending order may
  1613. be used in any combination.  Variable length attributes may not be
  1614. used as sort attributes.  When fixed length attributes are used as
  1615. sort attributes, only the first 20 characters and the first value
  1616. is used for sort.
  1617. All these options can be described using the following general
  1618. syntax:
  1619.         SELECT {attname1 [ = fw1 ] [...attname [ = fwn ] ] } +
  1620.                 attnum1...
  1621.                 attname1(i)...
  1622.                 attname1(i,j)...
  1623.                 attnum1(i)...
  1624.                 attnum1(i,j)...
  1625.                 ALL
  1626.         FROM relname +
  1627.         [SORTED BY attname [{=A} ]... ] +
  1628.                               D
  1629.         [WHERE condition1 [{AND} condition2 ... ]]
  1630.                             OR
  1631. If the sum of the lengths (or fwi) of the attributes requested
  1632. exceeds the line capacity, the data line will be truncated.
  1633. See section 2.1.10 for further expanation of line width control.
  1634. TALLY Command
  1635. The TALLY command prints a tally for an attribute giving each
  1636. unique value and the number of times it occurs in a relation.
  1637. The tally is ordered ascending or descending per user input.
  1638. Default is ascending.  The WHERE clause is optional and uses
  1639. the same syntax as in the SELECT command.
  1640.         TALLY attname [{=A}] FROM relname [ WHERE ... ]
  1641.                          D
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.                                                    Page 30
  1651.                                                        
  1652.                                                        
  1653.  
  1654.  
  1655. Examples of SELECT and TALLY commands:
  1656.    SELECT ALL FROM AIRPLANE
  1657.    SELECT MODEL FROM AIRPLANE
  1658.    SELECT ALL FROM AIRPLANE WHERE WEIGHT GT 100000.
  1659.    *8 AND NUMPASS LT 200
  1660.    SELECT AGE FROM PEOPLE WHERE NAME EQ BOB
  1661.    SELECT ALL FROM AIRPLANE SORTED BY MODEL=D
  1662.    TALLY MODEL FROM FLIGHTS
  1663.    TALLY MODEL FROM FLIGHTS WHERE CARRIER EQ UNITED
  1664.    SELECT ALL FROM DIMENS WHERE HEIGHT GTA WIDTH
  1665.    SELECT FILE TITLE=4 OWNER FROM PFDATA
  1666. 2.1.4 Querying the Schema
  1667. 2.1.5  Commands for Querying the Schema
  1668. When you use any of these commands, RIM will display only
  1669. the data you are authorized to access according to your
  1670. current user password.
  1671. LISTREL Command
  1672. The purpose of LISTREL is to provide you with information
  1673. about the relations in the data base.
  1674. There are three formats for the LISTREL command.  The first
  1675. consists of simply entering:
  1676.         LISTREL
  1677. Using LISTREL in this fashion provides you with a list of
  1678. all relations currently defined in your data base.  If you
  1679. wish to display the definition of a specific relation, then
  1680. the syntax is:
  1681.         LISTREL relname
  1682. The use of LISTREL in this manner also provides a count of
  1683. the number of rows defined for the specified relation.
  1684.         LISTREL ALL
  1685. This command (restricted by user password) will display the
  1686. definitions of all relations in the data base, including
  1687. counts of the number of defined rows in each relation.
  1688. EXHIBIT Command
  1689. The purpose of the EXHIBIT command is to allow you to query
  1690. the RIM dictionary to obtain the names of all relations
  1691. having a specific set of attributes.  For example, if you
  1692. want to know which relations contain the attribute attname
  1693. you would enter:
  1694.         EXHIBIT attname
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.                                                    Page 31
  1706.                                                        
  1707.                                                        
  1708.  
  1709.  
  1710. You would then obtain either a list of the relations having
  1711. this attribute, or a message indicating that this attribute
  1712. was not found in any relations in the data base.
  1713. The EXHIBIT command also allows you to query fro a list of
  1714. attributes(maximum of 10).  Suppose that you wanted to know
  1715. which relations contian both attname1 and attname2.  The
  1716. command would then be:
  1717.         EXHIBIT attname1 attname2
  1718. The general syntax of this command is:
  1719.         EXHIBIT attname1 [attname2 ... attnamen ]
  1720. PRINT RULES Command
  1721. This command can be used when the current user password
  1722. matches the owner password of the data base definition.  To
  1723. obtain a complete list of all constraint rules enter:
  1724.         PRINT RULES
  1725. 2.1.6  Computation Command
  1726. COMPUTE Command
  1727. The COMPUTE command is used to compute simple functional
  1728. values of an attribute.  A WHERE clause is optional and uses
  1729. the same syntax as is used in the SELECT command.
  1730.   COMPUTE {COUNT} attname FROM relname [WHERE... ]
  1731.             MAX
  1732.             MIN
  1733.             AVE
  1734.             SUM
  1735. There are some restrictions as to the type and word length
  1736. of the attribute when using these computed functions.  All
  1737. of these functions exclude any -0- values when making their
  1738. computations.  The following table describes the attribute
  1739. type and length restrictions for each function:
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.                                                    Page 32
  1761.                                                        
  1762.                                                        
  1763.  
  1764.  
  1765. FUNCTION  ATTRIBUTE TYPE       ATTRIBUTE LENGTH
  1766. COUNT     any                  any
  1767. MIN       any of fixed length  1 for non-text, ANY for text
  1768. MAX       any of fixed length  1 for non-text, ANY for text
  1769. AVE       int, real, double    1
  1770. SUM       int, real, double    1
  1771. Examples of COMPUTE command:
  1772.     COMPUTE AVE NUMPASS FROM FLIGHTS
  1773.     COMPUTE MAX WEIGHT FROM FLIGHTS WHERE NUMPASS LT 100
  1774.     COMPUTE COUNT NAME FROM PEOPLE WHERE AGE GT 30
  1775. 2.1.6 Modification Commands
  1776. 2.1.7  Data Base Modification Commands
  1777. These commands are used to change the contents of the data
  1778. base.  a modify or owner password correlation is required in
  1779. order to use these commands.
  1780. CHANGE Command
  1781.  
  1782.      CHANE (Attribute values)
  1783.  
  1784.      The CHANGE command is used to change the value of an
  1785. attribute in a relation where certain conditions are met.
  1786.    CHANGE {attname1}    TO value [IN relname] WHERE ...
  1787.            attname(i)
  1788.            attname(i,j)
  1789. Value has the same form as described in Section 2.1.3.  The
  1790. WHERE clause is required and uses the same syntax as in the
  1791. SELECT command.  If the relation name is not specified, the
  1792. attribute is changed in all relations where the attribute is
  1793. found and the conditions are met.
  1794.  
  1795.      CHANGE (passwords)
  1796.  
  1797.      The read or modify passwords may be changed using the command
  1798.  
  1799. CHANGE {RPW} TO newpass FOR relname
  1800.         MPW
  1801.  
  1802.  
  1803.      CHANGE OWNER
  1804.  
  1805.      The CHANGE OWNER command is used to change the name of the data
  1806. base owner. Only the curent owner may use this command.
  1807.  
  1808.      DELETE ROWS Command
  1809. The DELETE ROW command is used to delete selected rows in a
  1810. relation.
  1811.         DELETE ROW FROM relname WHERE ...
  1812. The name of the relation must be specified as well as a
  1813.  
  1814.  
  1815.                                                    Page 33
  1816.                                                        
  1817.                                                        
  1818.  
  1819.  
  1820. WHERE clause.  The syntax for the WHERE clause is the same
  1821. as in the SELECT command.
  1822. DELETE DUPLICATES Command
  1823. This command is used to remove any duplicate rows from a
  1824. relation.  It is particularly useful on relations which have
  1825. been created by any of the relational algebra commands
  1826. (JOIN, INTERSECT, SUBTRACT, or PROJECT).  The syntax for
  1827. this command is:
  1828. DELETE DUPLICATES [attname1, attname2,...] from relname
  1829. Duplicates are checked only for the specified (combination
  1830. of) attribute(s).  Default is to check the complete row (all
  1831. attributes).
  1832. Examples of CHANGE, DELETE, and DELETE DUPLICATES commands:
  1833.    CHANGE NUMPASS TO 320 IN AIRPLANES WHERE MODEL EQ 747SP
  1834.    CHANGE NAME TO ROBERT WHERE NAME EQ BOB
  1835.    DELETE ROW FROM AIRPLANES WHERE MODEL EQ DC10
  1836.    CHANGE STABILITY TO LOW IN DIMENSIONS WHERE HEIGHT GTA
  1837. WIDTH
  1838. 196z   DEL DUP NUMPASS FRO AIRPLANES
  1839.  
  1840.      DELETE RULE
  1841.  
  1842.      The DELETE RULE command is used to delete a specified constraining
  1843. rule. The USER password must match the owner. Rulenumber is obtained
  1844. using the PRINT RULES command. The format of the command is
  1845.  
  1846. DELETE RULE rulenumber
  1847.  
  1848.  
  1849. 2.1.8  Schema Modification Commands
  1850. These commands are used to change the data base schema
  1851. definition.  Except for the CHANGE OWNER command, a modify
  1852. or owner password correlation is required in order to use
  1853. these commands.
  1854. CHANGE OWNER Command
  1855. The CHANGE OWNER command is used to change the name of the
  1856. data base password.  Only the current owner is allowed to
  1857. use this command.
  1858.         CHANGE OWNER TO newowner
  1859. RENAME Attribute Command
  1860. The RENAME attribute command is used to change the name of
  1861. an attribute in the data base definition (schema).
  1862.    RENAME attname1 TO attname2 [IN relname]
  1863. THe old name is attname1 and the new name is attname2.  if
  1864. the name of the relation is not specified, then the name
  1865. change takes place in every relation that contains the old
  1866. name.  If the relname is specified and attname1 occurs more
  1867. than once, the first occurence will be changed.
  1868.  
  1869.  
  1870.                                                    Page 34
  1871.                                                        
  1872.                                                        
  1873.  
  1874.  
  1875. RULES and KEY(s) defined for attname1 will automatically be
  1876. redefined to apply to attname2.
  1877. Examples of RENAME command:
  1878.    RENAME MODEL TO VERSION IN AIRPLANES
  1879.    RENAME NUMPASS TO CAPACITY
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.                                                    Page 35
  1926.                                                        
  1927.                                                        
  1928.  
  1929.  
  1930. BUILD KEY Command
  1931. This command is used to change an attribute from non-key to
  1932. KEY.  An index is built from existing data values by amking
  1933. a pass through current rows of the specified relation.  This
  1934. index is then used and maintained just as if the attribute
  1935. had been declared to be KEY in the original data base
  1936. definition.
  1937.         BUILD KEY FOR attname IN relname
  1938. Keys are not transferred to relations created by relational
  1939. algebra commands.
  1940. DELETE KEY Command
  1941. This command is used to change an attribute from KEY to
  1942. non-key.  The index file for that attribute is deactivated
  1943. and no longer maintained or used once the attribute  has
  1944. been changed to non-key with this command.
  1945.         DELETE KEY FOR attname IN relname
  1946. CHANGE PASSWORD Command
  1947. The read or modify passwords may be changed by using the
  1948. following command:
  1949.         CHANGE {RPW} TO newpass FOR relname
  1950.                 MPW
  1951. RENAME RELATION Command
  1952. You may change the name of a relation by using the following
  1953. command:
  1954.         RENAME RELATION relname TO newname
  1955. RULES applying to relname will automatically apply to
  1956. newname.
  1957. REMOVE Command
  1958. The REMOVE command is used to remove a relation definition
  1959. and its data from the data base.
  1960.         REMOVE relname
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.                                                    Page 36
  1981.                                                        
  1982.                                                        
  1983.  
  1984.  
  1985. 2.1.9  Relational Algebra Command
  1986. These commands allow you to create new relations from
  1987. existing relations.  All relational algebra commands require
  1988. modify permission on the constituent relations.
  1989. INTERSECT Command
  1990. The purpose of the INTERSECT command is to allow you to
  1991. combine the rows of relations into a third relation based on
  1992. common values within a set of specified attributes.  The
  1993. syntax of the INTERSECT command is:
  1994.    INTERSECT relname1 WITH relname2 FORMING relname3 +
  1995.    [USING attname1 [attname2 ... attnamen]]
  1996. The USING clause identifies the attributes that form the
  1997. resulting relation. The attributes used in the INTERSECT
  1998. process are the subset of those identified by the USING
  1999. clause which are present in both relations.
  2000. For example, assume that you have the following two
  2001. relations defined:
  2002.           REL-1                          REL-2
  2003. NAME     DEPT      JOB        DEPT       JOB          PAY       
  2004. -----    -----     -----      -----      -----        ----
  2005. BOB      A         ENGR       A          ENGR         800
  2006. JIM      C         SUPR       B          ENGR         450
  2007. BOB      B         ENGR       C          ENGR         750
  2008. RAY      C         ENGR
  2009. You may INTERSECT two relations restricted to specific sets
  2010. of attributes (the USING clause) or use all attributes of
  2011. both relations.  In either case RIM will identify the common
  2012. attributes and use the common values within these attributes
  2013. to identify the conditions for intersect generation.
  2014. Suppose you want to INTERSECT the two relations using
  2015. attributes DEPT, NAME, and JOB.  The command for this would
  2016. be:
  2017. INTERSECT REL-1 WITH REL-2 FORMING REL-3 USING DEPT NAME JOB
  2018. The result would be the new relation REL-3 shown on the next
  2019. page.
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.                                                    Page 37
  2036.                                                        
  2037.                                                        
  2038.  
  2039.  
  2040.                      REL-3
  2041.             DEPT     NAME      JOB
  2042.             ----     -----     -----
  2043.             A        BOB       ENGR
  2044.             B        BOB       ENGR
  2045.             C        RAY       ENGR
  2046. In this example there are no duplicate rows in REL-3.
  2047. However, it is possible that the intersect command will
  2048. create duplicate rows.  Since, in general, duplicate rows
  2049. are not desired in a relation, they can be removed with the
  2050. DELETE DUPLICATES command.  Note also that by specifying
  2051. which attributes the INTERSECT is using, you restrict the
  2052. number of attributes in the resulting relation to only those
  2053. specified in the USING clause.
  2054. Suppose you want RIM to use all the attributes in the two
  2055. relations.  In this instance you would enter:
  2056.    INTERSECT REL-1 WITH REL-2 FORMING REL-4
  2057. The result would be REL-4 consisting of the attributes
  2058. NAME, DEPT, JOB, and PAY, shown below in the resulting rows:
  2059.                       REL-4
  2060.            NAME    DEPT     JOB      PAY
  2061.            -----   -----    ----     ---
  2062.            BOB     A        ENGR     800
  2063.            BOB     B        ENGR     450
  2064.            RAY     C        ENGR     750
  2065. There may be situations where an INTERSECT is impossible to
  2066. perform.  These include:
  2067.    1)  The name of the resulting relation already exists
  2068.    2)  The two relations have no common attributes
  2069.    3)  The attributes in the USING clause do not exist in
  2070.        the relation being intersected
  2071.    4)  The resulting relation exceeds 1021 words
  2072. If any of the above situations is encountered, you are
  2073. warned of the problem and the INTERSECT command processing
  2074. is stopped.  In the case where common attribute names exist
  2075. but there are no matching values, the operation will be
  2076. successful resulting in an empty relation (0 orws).
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.                                                    Page 38
  2091.                                                        
  2092.                                                        
  2093.  
  2094.  
  2095. The INTERSECT command is a powerful tool and may be used as
  2096. a step towards satisfying queries which require attributes
  2097. from more than on relation.
  2098. JOIN Command
  2099. The JOIN command is a function operating on two relations to
  2100. form a third relation.  The purpose of the JOIN is to
  2101. juxtapose two relations based on a specified attribute from
  2102. each.  The result of the JOIN command is a third relation
  2103. containing all of the attributes from both relations.  Rows
  2104. are generated in the new relation as a result of the
  2105. comparison conditions between attributes being satisfied.
  2106. The syntax of the JOIN command is:
  2107.    JOIN relname1 USING  attname1 WITH relname 2 USING +
  2108.    attname2 FORMING relname3 [ WHERE {EQ} ]
  2109.                                       NE
  2110.                                       GT
  2111.                                       GE
  2112.                                       LT
  2113.                                       LE
  2114. The WHERE clause of the JOIN command is different form the
  2115. WHERE clause of the SELECT command.  In JOIN it applies only
  2116. to the comparison of the two attributes upon which JOIN is
  2117. based.  If the WHERE clause is omitted (default), EQ is
  2118. used.
  2119. The value of attname1 in the first row of relname11 is
  2120. compared to all the values of attname2.  Rows which qualify
  2121. are generated in relname3.  The value of attname1 in the
  2122. second row of relname1 is compared to all the values of
  2123. attname2, etc.  Each row from relname1 may generate 0, 1, 2,
  2124. or more rows in relname3.
  2125. For example, consider the relations REL1 AND REL2:
  2126.           REL1                     REL2
  2127.  A        B        C            D        E
  2128. ---      ---      ---          ---      ---
  2129.  1        2        3            3        1
  2130.  4        5        6            6        2
  2131.  7        8        9
  2132. The following JOIN command would produce the result shown.
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.                                                    Page 39
  2146.                                                        
  2147.                                                        
  2148.  
  2149.  
  2150.         JOIN REL1 USING B WITH REL2 USING D +
  2151.         FORMING REL3 WHERE LT
  2152.                  REL3
  2153.  A        B         C          D         E
  2154. ---      ---       ---        ---       ---
  2155.  1        2         3          3         1
  2156.  1        2         3          6         2
  2157.  4        5         6          6         2
  2158. The JOIN will function correctly on any comparison providing
  2159. that you compare attributes of the same data type.  All
  2160. attribute names in the resultant relation must be unique in
  2161. order for you to obtain accurate results from subsequent
  2162. commands using the relation.  Any duplicate attribute names
  2163. should be change using the RENAME command before doing
  2164. queries or updates to the new relation.  In the case of
  2165. duplicate attribute names, RENAME when applied to a specific
  2166. relation will change the first attribute name.
  2167. There may be situations where a JOIN is impossible to
  2168. perform.  These may include:
  2169.    1)  The name of the resulting relation already exists
  2170.    2)  The attribute in the USING clause does not exist in
  2171.        the relation being joined
  2172.    3)  The attributes being compared are different data
  2173.        types or lengths
  2174.    4)  An attribute in either of the relations greater than
  2175.        300 computer words
  2176.    5)  The resulting relation exceeds 1021 words
  2177. If any of the above situations are encountered you are
  2178. warned of the problem and the JOIN command processing is
  2179. stopped.
  2180. PROJECT Command
  2181. The function of a PROJECT command is to create a new
  2182. relation as a subset of an existing relation.  You may want
  2183. to create the new relation from the old one by removing
  2184. attributes, removing rows, or both.  The syntax for the
  2185. PROJECT command is:
  2186. PROJECT relname1 FROM relname2 USING {attname1...attnamen} +
  2187.                                       ALL
  2188. [WHERE ...]
  2189. The WHERE clause is optional but it is specified, it has the
  2190. same syntax as in the SELECT command.  You are required to
  2191. specify which attributes are to be retained in the new
  2192. relation.  The old relation is relname2 and the new relation
  2193. is relname1.
  2194. For example consider the following relation:
  2195.                         PEOPLE
  2196. EMPNUM     EMPNAME      BOSS      POSITION        GROUP
  2197. ------     -------      ------    --------        ------
  2198.  
  2199.  
  2200.                                                    Page 40
  2201.                                                        
  2202.                                                        
  2203.  
  2204.  
  2205.  2181      JONES        SMITH     MANAGER         AADE
  2206.  3964      ERICKSON     BUSS      APPL-MGR        ACC
  2207.  6543      GRAY         PARKER    ASST-MGR        PHOTO
  2208.  2233      SCHMITZ      BUSS      APPL-MGR        ACC
  2209. To create a new relation with EMPNAME and GROUP as the only
  2210. attributes and where now rows contain PARKER as BOSS enter
  2211. the command:
  2212.     PROJECT TEMP1 FROM PEOPLE USING EMPNAME GROUP +
  2213.     WHERE BOSS NE PARKER
  2214.                         TEMP1
  2215.               EMPNAME         GROUP
  2216.               -------         ------
  2217.               JONES           AADE
  2218.               ERICKSON        ACC
  2219.               SCHMITZ         ACC
  2220. The PROJECT command is useful to reduce the size of a
  2221. relation when only a subset of the data is needed.  RIM will
  2222. not eliminate any duplicate rows formed in the new relation.
  2223.  You must do that yourself with the DELETE DUPLICATES
  2224. command.
  2225. There may be situations where a PROJECT is impossible to
  2226. perform.  These include:
  2227.    1)  The name of the resulting relation already exists
  2228.    2)  An attribute in the USING or WHERE clause is not in
  2229.        the relation
  2230. SUBTRACT Command
  2231. The SUBTRACT command is similar to the PROJECT command in
  2232. that the new relation is a subset of an existing relation.
  2233. The rows, however, are selected based on the data in another
  2234. relation rather than on a WHERE clause within the same
  2235. relation.  Where the INTERSECT command looked for rows of
  2236. two relations which matched up, the SUBTRACT command does
  2237. just the opposite.  It looks for rows in the relation which
  2238. do not match any rows in the other relation.  The syntax for
  2239. the SUBTRACT command is:
  2240.   SUBTRACT relname1 FROM relname2 FORMING relname3 +
  2241.   [USING attname1 [attname2 ... attnamen]]
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.                                                    Page 41
  2256.                                                        
  2257.                                                        
  2258.  
  2259.  
  2260. All rows in the new realtion will come from relname2.  If
  2261. the USING clause is not specified, then all attributes of
  2262. relname2 will be attributes of relname3.  Relname1 is the
  2263. relation that rows of relname2 are checked against for
  2264. matches.  If a USING clause is specified at least one of the
  2265. attributes in the clause must be common to both relations.
  2266. As an example consider these two example relations:
  2267.          EMPDATA                         BOSSDATA
  2268. EMPNUM   EMPNAME   BOSS         BOSS     POSITION    GROUP
  2269. ------   -------   ------       ------   --------    --------
  2270.  2181    JONES     SMITH        SMITH    MANAGER     AADE
  2271.  3964    ERICKSON  BUSS         PARKER   ASST-MGR    PHOTO
  2272.  6543    GRAY      PARKER       BUSS     APPL-MGR    ACC
  2273.  8461    BROWN     WHITE
  2274.  2233    SCHMITZ   BUSS
  2275. The following command will produce a new relation from
  2276. EMPDATA:
  2277.  SUBTRACT BOSSDATA FROM EMPDATA FORMING TEMP USING +
  2278.  EMPNAME BOSS
  2279. The resulting relation TEMP would contain only one row:
  2280.                         TEMP
  2281.                   EMPNAME  BOSS
  2282.                   -------  -----
  2283.                   BROWN    WHITE
  2284. There may be situations where a SUBTRACT is impossible to
  2285. perform. These include:
  2286.    1)  The name of the resulting relation already exists
  2287.    2)  The relations have no common attributes
  2288.    3)  The number of attributes in the USING clause is
  2289.        greater than the number in relname1
  2290.    4)  An attribute in the USING clause is not in the
  2291.        relations
  2292. 2.1.10  Report Generation Commands
  2293. These commands establish a limited report generation
  2294. capability.
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.                                                    Page 42
  2311.                                                        
  2312.                                                        
  2313.  
  2314.  
  2315. NEWPAGE Command
  2316. This command causes a new page to be issued.  It applies to
  2317. batch output only.  The command is:
  2318.         NEWPAGE
  2319. BLANK Command
  2320. Blank lines can be inserted into the output stream by using
  2321. the command:
  2322.         BLANK n
  2323. where n is the number of blank lines written.
  2324. TITLE Command
  2325. The command:
  2326.         TITLE "titlestring"
  2327. causes the text "titlestring" to be printed, centered on the
  2328. line.  If the length of "titlestring" is longer than current
  2329. lines width it will be truncated and a warning issued.
  2330. DATE Command
  2331. The command:
  2332.         DATE
  2333. will cause the current date to be printed, centered on the
  2334. line.
  2335. LINES Command
  2336. This command controls the number of lines per page
  2337. (exclusive of title.)  The command is:
  2338.         LINES n
  2339. will establish page size to n lines.  Default is 56.
  2340. WIDTH Command
  2341. This command controls the width of a printed line.  The
  2342. command:
  2343.         WIDTH n
  2344. will establish a line width of n characters.  Default is 78
  2345. if output is to a terminal, 132 if output is to a batch
  2346. printer.  If n is specified to be less than 20, 20 will be
  2347. used.
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.                                                    Page 43
  2366.                                                        
  2367.                                                        
  2368.  
  2369.  
  2370. 2.1.11  Communication Command
  2371. UNLOAD Command
  2372. The UNLOAD command permits you to off-load a portion or all
  2373. of your data base onto a previously designated file (see
  2374. OUTPUT command).  The file will contain 80 characters text
  2375. records and can be read by RIM as an input file on the same
  2376. or on a different computer using the INPUT command.  Default
  2377. file name is for006.  The syntax of this command is:
  2378.         UNLOAD [dbname = newname] {ALL   } +
  2379.                                    SCHEMA
  2380.                                    DATA
  2381.         [relname1 [ mpw1 ] relname2 [ mpw2 ] ... ]
  2382. Specifying SCHEMA will off-load the schema of your data
  2383. base, DATA will off-load the data of your data base and ALL
  2384. will off-load both schema and data.
  2385. Optionally, you may rename your data base by entering dbname
  2386. =newname where dbname is the name of the currently open data
  2387. base.  By specifying relation names, you will only off-load
  2388. data and/or schemas for the specific relations.  The modify
  2389. password does not allow you to modify access to the
  2390. relation.
  2391. There are implicit password restrictions to the unload
  2392. command as follows:  If you are the data base owner, you may
  2393. off-load any data and/or schema.  If you are not the owner,
  2394. you may off-load data and/or schema for the relations for
  2395. which you have modify access permission.  Your password
  2396. becomes the owner of the off-loaded data base.  Rules, if
  2397. any, will only be off-loaded if you are the owner of the
  2398. data base and you have used the option ALL.
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.                                                    Page 44
  2421.                                                        
  2422.                                                        
  2423.  
  2424.  
  2425. 2.2  MENU MODE EXECUTION OVERVIEW
  2426. The RIM menu mode provides you with the capability to build
  2427. the schema for a new data base and to update an existing
  2428. data base definition.
  2429. The options (create, update, query, command, and exit)
  2430. available in menu mode are shown in figure 2.2-1.
  2431. Executions may be terminated at anytime by entering the word
  2432. QUIT.  EXIT, in response to an input prompt, will return you
  2433. to the top menu.  The data base will be purged following a
  2434. QUIT command.
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.                                                    Page 45
  2476.                                                        
  2477.                                                        
  2478.  
  2479.  
  2480.                l----------------l
  2481.                l  BEGIN RIM 5.0 l
  2482.                l----------------l
  2483.                       l
  2484.                       l
  2485.              RIM COMMAND MODE
  2486.              ENTER "MENU" FOR MENU MODE
  2487.             R>MENU    l
  2488.                       l
  2489.                       l
  2490.              SELECT THE EXECUTION OPTION DESIRED
  2491.                  1)  CREATE A NEW DATABASE
  2492.                  2)  UPDATE AN EXISTING DATABASE
  2493.                  3)  QUERY AN EXISTING DATABASE
  2494.                  4)  ENTER COMMAND MODE
  2495.                  5)  EXIT
  2496.                       l
  2497.    l------------------------------------------------l
  2498.    l              l             l         l         l
  2499.    l              l             l         l         l
  2500. CREATE OPTION     l         QUERY OPTION  l       EXIT
  2501. SECTION 2.2.1     l         SECTION 2.2.3 l   SECTION 2.1.1
  2502.                   l                       l
  2503.              UPDATE OPTION         COMMAND MODE
  2504.              SECTION 2.2.2         SECTION 2.1
  2505. Figure 2.2-1 Section References for the Menu Mode Options
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.                                                    Page 46
  2531.                                                        
  2532.                                                        
  2533.  
  2534.  
  2535. 2.2.1  Data Base Creation Option
  2536. The purpose of this option is to construct a schema by
  2537. prompting you for the data base, owner, the names of the
  2538. relations, their associated attributes and read/modify
  2539. passwords.
  2540. After compilation of the schema, you have the opportunity to
  2541. interactively load the data base and/or query the data base.
  2542. In the command mode, you have available the full set of RIM
  2543. commands (section 2.1) allowing the direct definition of the
  2544. schema using the DEFINE submodule commands and the loading
  2545. of the data base using the LOAD submodule commands.
  2546. 2.2.2 Data Base Update Option
  2547. With this option you may add/modify relations and/or load
  2548. additional data into the data base.  If additional relations
  2549. are desired, you are prompted for the names of the
  2550. relations, their associated attributes and read/modify
  2551. passwords.  If additional data is to be loaded, the list of
  2552. relations in the data base is displayed and your enter the
  2553. required data.  Removal or modification of data in the data
  2554. base is done using the RIM data base modification commands.
  2555. In this command mode, you have available the full set of RIM
  2556. commands (section 2.1) allowing the direct addition of
  2557. relations using the DEFINE submodule commands and the
  2558. loading of data using the LOAD submodule commands.  The data
  2559. base modification commands are used to update existing data.
  2560. 2.2.3  Query Option
  2561. With this option you are prompted for the data base name.
  2562. The full set of RIM commands (section 2.1) is available to
  2563. you for data base query.  In addition to query, all other
  2564. data base activities are available through the RIM command
  2565. mode.
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.                                                    Page 47
  2586.                                                        
  2587.                                                        
  2588.  
  2589.  
  2590. 2.3  RIM MENU MODE INTERACTIVE DIALOGUE
  2591. This section presents the questions and menus that appear in
  2592. the menu mode.  The response options are also discussed.
  2593. The menu mode is accessed by entering MENU anytime in the
  2594. command mode when a R> prompt is present.
  2595. 2.3.1  General Option and Questions
  2596. SELECT THE EXECUTION OPTIION DESIRED
  2597.         1)  CREATE A NEW DATA BASE
  2598.         2)  UPDATE AN EXISTING DATA BASE
  2599.         3)  QUERY AN EXISTING DATA BASE
  2600.         4)  ENTER COMMAND MODE
  2601.         5)  EXIT
  2602. SELECT THE UPDATE OPTION DESIRED
  2603.         1)  DEFINE ADDITIONAL RELATIONS
  2604.         2)  LOAD ADDITIONAL DATA
  2605.         The desired update option is selected by entering
  2606.         either the integer 1, allowing the definition of
  2607.         additional relations, or 2, allowing the loading of
  2608.         additional data into the data base.
  2609. DO YOU WANT TO QUERY THE DATA BASE AT THIS TIME--Y OR N
  2610.         You may switch to the command mode for query by
  2611.         entering "Y".  If the query option is not desired
  2612.         "N".
  2613. 2.3.2  Data Base Files
  2614. ENTER THE NAME OF THE DATA BASE
  2615.         The 1-6 character alphanumeric name assigned to the
  2616.         data base is entered here.  The name is used to
  2617.         create the names of the logical files that contain
  2618.         the data base.
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.                                                    Page 48
  2641.                                                        
  2642.                                                        
  2643.  
  2644.  
  2645. 2.3.3  Schema Definitions
  2646. ENTER THE NAME OF THE DATA BASE
  2647.  The 1-6 character alphanumeric name assigned to the data
  2648.  base is entered here.  All future references to this data
  2649.  will be via the assigned data base name.
  2650. ENTER THE NAME OF THE DATA BASE OWNER
  2651.  The 1-8 character alphanumeric name of the data base owner
  2652.  is entered here.  This name is used as the schema password.
  2653.  Additional schema definitions will not be permitted unless
  2654.  the user password matches the owner password assigned here.
  2655. ENTER THE NAME ASSIGNED TO THIS RELATION
  2656.  A 1-8 character alphanumeric name assigned to the relation
  2657.  being defined.
  2658. ENTER THE READ PASSWORD FOR THIS RELATION
  2659.  A 1-8 character alphanumeric string assigned by the owner
  2660.  as the read password for the relation being defined.  if
  2661.  the owner has assigned a read password the user password
  2662.  must match in order to query the relation.  If no read
  2663.  password is desired enter NONE.
  2664. ENTER THE MODIFY PASSWORD FOR THIS RELATION
  2665.  A 1-8 character alphanumeric string by the owner as the
  2666.  modify password for the relation being defined.  if the
  2667.  owner has assigned a modify password the user password must
  2668.  match in order to load or modify the relation.  if no read
  2669.  password is desired enter NONE.
  2670. ENTER THE ATTRIBUTES OF THIS RELATION
  2671. ENTER END WHEN COMPLETE
  2672.    attname  type  length (IF >) "KEY" (IF KEY)
  2673. Attname = 1-8 character alphanumeric string identifying
  2674.           the attribute being defined.
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.                                                    Page 49
  2696.                                                        
  2697.                                                        
  2698.  
  2699.  
  2700. Type =  INT    (Integer)
  2701.         REAL   (Real)
  2702.         TEXT   (Text)
  2703.         DOUB   (Double Precision)
  2704.         RVEC   (Real Vector)
  2705.         IVEC   (Integer Vector)
  2706.         DVEC   (Double Precision Vector)
  2707.         RMAT   (Real Matrix)
  2708.         IMAT   (Integer Matrix)
  2709.         DMAT   (Double Precision Matrix)
  2710. Length = number of characters (text) or number of values
  2711.          (all others)
  2712. 1,2,3 ..., etc., or VAR    INT
  2713.                            TEXT
  2714.                            REAL
  2715.                            DOUB
  2716.                            RVEC
  2717.                            IVEC
  2718.                            DVEC
  2719.      row, column or        RMAT
  2720.      row, VAR or           IMAT
  2721.      VAR, VAR              DMAT
  2722. A variable length (or length greater than one) INT, REAL, or
  2723. DOUB can be considered to be functionally identical to IVEC,
  2724. RVEC, or DVEC.
  2725. KEY = the word key indicates the attribute is key.
  2726. Example:  To define a text string attribute (TEXTST) of 60
  2727. characters, a real attribute (TEXTST) of 60 characters, a
  2728. real attribute (REAL1), an integer key attribute (INT-1),
  2729. and a real matrix with dimensions 6x8 (MAT68), the following
  2730. entries would be made:
  2731.         R> TEXTST TEXT 60
  2732.         R> REAL1 REAL
  2733.         R> INT-1 INT KEY
  2734.         R> MAT68 RMAT 6,8
  2735. To end the definition of the attributes for this relation,
  2736. the word "END" is entered.
  2737. DO YOU HAVE ADDITIONAL RELATIONS TO DEFINE--Y OR N
  2738.   Additional relations may be defined by entering the
  2739.   character "Y".  If no additional relations are to be
  2740. defined at this time, enter "N".
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.                                                    Page 50
  2751.                                                        
  2752.                                                        
  2753.  
  2754.  
  2755. 2.3.4  Data Base Loading
  2756. DO YOU WANT TO LOAD THE DATA BASE--Y OR N
  2757.  The data base is available for data loading if desired.
  2758.  Enter "Y" if you want to load the data base at this time.
  2759.  Enter "N" if no data is to be loaded.
  2760. SELECT THE RELATION TO BE LOADED
  2761.  The relations defined in the data base will be listed.  You
  2762.  select the relation to be loaded by entering the integer
  2763.  corresponding to the desired relation.
  2764. ENTER THE MODIFY PASSWORD FOR THIS RELATION
  2765.  No data loading will be allowed for the selected relation
  2766. unless the proper modify password is entered here.
  2767. ENTER THE ATTRIBUTE VALUES IN THE SPECIFIED SEQUENCE
  2768. ENTER END WHEN COMPLETE
  2769.  Entering data values at this point loads the data base.
  2770.  The values are entered in the order indicated and the value
  2771.  entered must correspond to the attribute type.  If a text
  2772.  string contains embedded blanks, or commas, or if entirely
  2773.  numeric text is entered, it must be enclosed in quotation
  2774.  marks .  Unused trailing characters in fixed length text
  2775.  strings will be blank filled.  It is recommended that
  2776.  leading blanks not be used in text strings.  If vectors or
  2777.  matrices are loaded, all values must be specified. Enter
  2778.  "END" when data loading is complete.  It is recommended
  2779.  that large data bases and data bases that have vectors and
  2780.  matrices use the application program interface for loading
  2781.  data.
  2782. DO YOU HAVE ADDITIONAL RELATIONS TO LOAD--Y OR N
  2783.  If you want to load another relation, enter "Y". If all the
  2784.  data base to be loaded at this time has been loaded, enter
  2785.  "N".
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.                                                    Page 51
  2806.                                                        
  2807.                                                        
  2808.  
  2809.  
  2810. 3.0  RIM EXECUTION THROUGH THE APPLICATION PROGRAM INTERFACE
  2811. Any programming language which can call FORTRAN subroutines
  2812. can access and modify a pre-defined RIM data base through
  2813. FORTRAN-callable subroutines contained in the RIM
  2814. application program interface library(RIMLIB).  Data is
  2815. accessed one row at a time.  The RIM data access subroutines
  2816. store data in and retrieve data from an array you provide in
  2817. your program logic.  In either case the array used must be
  2818. large enough to hold one complete row for each relation
  2819. accessed.
  2820. Attributes which contain text data must be given particular
  2821. care.  In general, Hollerith format (left adjusted, blank
  2822. filled) is used.  Some textual parameters like those for
  2823. data base, relation and attribute names must allow for eight
  2824. characters (8H), others like key words such as INT, REAL
  2825. etc. must allow room for four characters (4H).  Values of
  2826. textual attributes or text strings used in conditional
  2827. expressions are passed in an array packed together with
  2828. other kinds of information.  Such text strings are left
  2829. adjusted with unspecified fill.  The number of words such
  2830. text strings occupy depends upon the length of the text
  2831. string.  there are special instructions in appropriate
  2832. sections on how to pass such attributes.
  2833. The application program interface requires you to manage the
  2834. data base files.  The data base files must exist on three
  2835. properly named logical files before your program can be
  2836. executed.
  2837. Password checks operate in the application program interface
  2838. in much the same way as in the standalone system.  No
  2839. password permission is requird for RMOPEN, RMUSER, RMRULE,
  2840. or RMTOL.  Read permission is required for all other calls
  2841. except RMLOAD and RMPUT  for which modify permission is
  2842. required.  Modify permission implies read permission.
  2843. 3.1  INITIALIZING THE DATA BASE
  2844.         CALL RMOPEN  (abname)
  2845.         ---------------------
  2846.         Input parameter:
  2847.            Dbname-- the name of the data base in Hollerith
  2848.              format
  2849. This routine initializes the internal tables used by RIM and
  2850. opens the specified data base by reading the data base
  2851. control information into the incore working areas.
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.                                                    Page 52
  2861.                                                        
  2862.                                                        
  2863.  
  2864.  
  2865.         CALL RMCLOS
  2866.         -----------
  2867. This routine closes the current data base and copies the
  2868. incore working areas to the logical data base files.  This
  2869. routine is required (if you have modified the data base)
  2870. before your program can access another data base.
  2871. 3.2  STATUS OF DATA BASE ACTIVITY
  2872. When an operation on the data base has been attempted, the
  2873. status of the operation is returned to the application
  2874. program via the RMSTAT variable in the RIMCOM common block.
  2875. This common block must be declared in the calling program as
  2876. follows:
  2877.         COMMON /RIMCOM/ RMSTAT
  2878.         INTEGER RMSTAT
  2879. The value of RMSTAT should be checked after each operation.
  2880. A non-zero value indicates the operation was not successful.
  2881.  as a result, subsequent operations may not function as
  2882. expected.  The RMSTAT values and meanings are as follows:
  2883.    -1  NO MORE DATA AVAILABLE FOR RETRIEVAL
  2884.     0  OK - OPERATION SUCCESSFUL
  2885.    10  DATA BASE FILES DO NOT CONTAIN A RIM DATA BASE
  2886.    11  DATA BASE NAME DOES NOT MATCH FILE CONTENTS
  2887.    12  INCOMPATIBLE DATA BASE FILES (DATE,TIME,ETC)
  2888.    13  DATA BASE IS ATTACHED IN READ ONLY MODE
  2889.    14  DATA BASE IS BEING UPDATED
  2890.    15  DATA BASE FILES ARE NOT LOCAL FILES
  2891.    16  DATA BASE HAS BEEN OPENED
  2892.    20  UNDEFINED RELATION
  2893.    30  UNDEFINED ATTRIBUTE
  2894.    40  MORE THAN 10 AND/OR OPERATORS IN THE WHERE CLAUSE
  2895.    41  ILLEGAL "LIMIT EQ N" CONDITION
  2896.    42  UNRECOGNIZED COMPARISON OPERATOR
  2897.    43  EQS ONLY AVAILABLE FOR TEXT ATTRIBUTES
  2898.    44  ILLEGAL USE OF MIN/MAX IN THE WHERE CLAUSE
  2899.    45  UNRECOGNIZED AN/OR OPERATOR
  2900.    46  COMPARED ATTRIBUTES MUST BE THE SAME TYPE/LENGTH
  2901.    47  LISTS ARE VALID ONLY FOR EQ AND NE
  2902.    50  RMFIND NOT CALLED
  2903.    60  RMGET NOT CALLED
  2904.    70  RELATION REFERENCE NUMBER OUT OF RANGE
  2905.    80  VARIABLE LENGTH ATTRIBUTES MAY NOT BE SORTED
  2906.    81  THE NUMBER OF SORTED ATTRIBUTES IS TOO LARGE
  2907.    89  SORT SYSTEM ERROR
  2908.    90  UNAUTHORIZED RELATION ACCESS
  2909.   100  ILLEGAL VARIABLE LENGTH ROW DEFINITION (LOAD/PUT)
  2910.   110  UNRECOGNIZED RULE RELATIONS
  2911.   111  MORE THAN 10 RULES PER RELATION
  2912.  
  2913.  
  2914.  
  2915.                                                    Page 53
  2916.                                                        
  2917.                                                        
  2918.  
  2919.  
  2920. THE FOLLOWING CODES SHOULD NOT BE ENCOUNTERED IN NORMAL USE
  2921.    1001 BUFFER SIZE PROBLEM - BLKCHG,BLKDEF
  2922.    1002 UNDEFINED BLOCK - BLKLOC
  2923.    1003 CANNOT FIND A LARGER B-TREE VALUE - BTADD,PUTDAT
  2924.    1004 CANNOT FIND B-TREE BLOCK - BTPUT
  2925.    21XX RANDOM FILE ERROR XX ON FILE1
  2926.    22XX RANDOM FILE ERROR XX ON FILE2
  2927.    23XX RANDOM FILE ERROR XX ON FILE3
  2928.    24XX RANDOM FILE ERROR XX ON FILE4
  2929. 3.3  GENERAL ROUTINES
  2930. The following routines are used to set the internal switches
  2931. for rule checking, to specify the data base passwords, and
  2932. to set the tolerance for real numbers.  These routines may
  2933. be called any number of times with the new value overwriting
  2934. the current value.
  2935.         CALL RMUSER (password)
  2936.         ---------------------
  2937.         Input Parameters:
  2938.           password--the password in Hollerith (8H).
  2939. This routine is used to provide the password necessary for
  2940. checking data base access, relation read permission and
  2941. relation modify premission.
  2942.         CALL RMRULE (switch)
  2943.         -------------------
  2944.         Input Parameters:
  2945.          switch--- 0 no rule checking (NOCHECK RULES) (int)
  2946.                    1 check rules (CHECK RULES)
  2947. This routine turns rule checking on and off (default--on if
  2948. rules are defined).
  2949.         CALL RMTOL (val,percent)
  2950.         ------------------------
  2951.         Input Parameters:
  2952.          val------the value of the tolerance (real)
  2953.          percent--0 if "val" is the absolute tolerance value
  2954.                      (int)      
  2955.                   1 if "val" is the tolerance percent
  2956. This routine sets the tolerance for floating point numbers,
  2957. (default: 0.).
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.                                                    Page 54
  2971.                                                        
  2972.                                                        
  2973.  
  2974.  
  2975. 3.4  ACCESSING THE SCHEMA
  2976. The following routines are used to obtain information about
  2977. the data base schema.
  2978.         CALL RMLREL
  2979.         -----------
  2980. This routine sets an implicit pointer (used by the routine
  2981. RMGREL) to the first relation in the data base.  it must be
  2982. called before data about any relations may be obtained.  If
  2983. there are no relations defined for which the current user
  2984. password has read permission, RMSTAT will return 90,
  2985. otherwise 0.
  2986.    CALL RMGREL (rname,row,mpw,lastmod,numatt,numrows)
  2987.    Output Parameters:
  2988.      rname---relation name (8H)
  2989.      rpw-----read password (.TRUE. or .FALSE.)
  2990.      mpw-----modify password (.TRUE. or .FALSE.)
  2991.      lastmod-date of last modification of relation data (8H)
  2992.      numatt--number of attributes in the relation (int)
  2993.      numrows-number of rows of data in the relation (int)
  2994. This routine returns the data about the current relation
  2995. (the relation indicated by the current pointers) and the
  2996. increments the implied pointer to point to the next relation
  2997. for which read permission is available.  A successful
  2998. execution of this routine sets RMSTAT equal to 0.  I f you
  2999. change passwords between calls to RMLREL and RMGREL or
  3000. between successive calls to RMGREL, unpredictable results
  3001. may occur.  When the last relation is accessed RMSTAT will
  3002. be set to -1.
  3003. The following example shows how to use RMLREL and RMGREL to
  3004. obtain the data about all relations in the data base.
  3005.                  .
  3006.                  .
  3007.                  .
  3008.         COMMON /RIMCOM/ RMSTAT
  3009.         INTEGER RMSTAT
  3010.                  .
  3011.                  .
  3012.                  .
  3013.         CALL RMOPEN (dbname)
  3014.         CALL RMUSER (password)
  3015.                  .
  3016.                  .
  3017.                  .
  3018.         CALL RMLREL
  3019.         IF (RMSTAT.EQ.0) GO TO 100
  3020.                  .
  3021.                  .
  3022.  
  3023.  
  3024.  
  3025.                                                    Page 55
  3026.                                                        
  3027.                                                        
  3028.  
  3029.  
  3030.                  .
  3031.     print message that no relations are available
  3032.     using the current password
  3033.                  .
  3034.                  .
  3035.                  .
  3036.     GO TO 200
  3037. 100 CONTINUE
  3038.     CALL RMGREL(rname,rpw,mpw,lastmod,numatt,numrows)
  3039.                  .
  3040.                  .
  3041.                  .
  3042.     printout the data about the relation, etc..........
  3043.                  .
  3044.                  .
  3045.                  .
  3046.     GO TO 100
  3047. 200 CONTINUE
  3048.                  .
  3049.                  .
  3050.                  .
  3051.     CALL RMLATT (rname)
  3052.     ------------------
  3053.     Input Parameters:
  3054.        rname --- relation name (8H)
  3055. This routine sets an implied pointer to the first attribute
  3056. of the specified relation.  if the relation exists and the
  3057. current password allows access to relational data, RMSTAT
  3058. will return 0.
  3059.     CALL RMGATT(aname,type,matvec,var,len1,len2,column,key)
  3060.     -------------------------------------------------------
  3061.     Output Parameters:
  3062.        aname---attribute name (8H)
  3063.        type----attribute type (INT,REAL,DOUB,TEXT) (4H)
  3064.        matvec--attribute type (VEC or MAT -otherwise
  3065.                blank)(4H)
  3066.        var-----variable length attribute (.TRUE. or .FALSE.)
  3067.        len1----attribute length data as follows (int):
  3068.                TEXT-number of characters
  3069.                INT,REAL,DOUB,VEC-number of items
  3070.                MAT-row dimension
  3071.        len2----column location in the relation (int)
  3072.                (otherwise 0) (int)
  3073.        column--attribute column location in the relation
  3074.                (int)
  3075.        key-----keyed attribute (.TRUE. or .FALSE.)
  3076. This routine returns the data about the current attribute
  3077. (the attribute indicated by the implied pointer) and
  3078.  
  3079.  
  3080.                                                    Page 56
  3081.                                                        
  3082.                                                        
  3083.  
  3084.  
  3085. increments the implied pointer to point to the next
  3086. attribute.  When the last attribute is accessed, RMSTAT will
  3087. return -1.
  3088. The following example shows the use of RMLREL,RMGREL,RMLATT,
  3089. and RMGATT to obtain the data about all attributes for all
  3090. realtions.  (the equivalent of LISTREL ALL)
  3091.                 .
  3092.                 .
  3093.                 .
  3094.      COMMON /RIMCOM/ RMSTAT
  3095.      INTEGER RMSTAT
  3096.                 .
  3097.                 .
  3098.                 .
  3099.      CALL RMOPEN(dbname)
  3100.      CALL RMUSER(password)
  3101.                 .
  3102.                 .
  3103.                 .
  3104.      CALL RMLREL
  3105. 100  CONTINUE
  3106.      CALL RMGREL(rname,rpw,mpw,lastmod,numatt,numrows)
  3107.      IF (RMSTAT.NE.0) GO TO 300
  3108.      CALL RMLATT(rname)
  3109.      DO 200 K=1,numatt
  3110.      CALL RMGATT(aname,type,matvec,var,len1,len2,column,key)
  3111.      IF(RMSTAT.NE.0) GO TO 300
  3112.                 .
  3113.                 .
  3114.                 .
  3115.      printout the relation and attribute data, etc..........
  3116.                 .
  3117.                 .
  3118.                 .
  3119. 200 CONTINUE
  3120.     GO TO 300
  3121. 300 CONTINUE
  3122.                 .
  3123.                 .
  3124.                 .
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.                                                    Page 57
  3136.                                                        
  3137.                                                        
  3138.  
  3139.  
  3140. 3.5  ACCESSING THE DATA BASE
  3141. The routines which access the data base allow the following
  3142. operations:
  3143. 1) GET an existing row of data from aspecified relation and
  3144. store it in a local array (must be preceded by a RMFIND).
  3145. 2) LOAD a new row of data from a local array to the bottom
  3146. of a specified relation (must be preceded by a RMFIND).
  3147. 3) PUT an existing row of data back into a specified
  3148. relation after it has been modified (must be preceded by a
  3149. RMFIND, RMGET).
  3150. 4) DELETE an existing row of data from a specified relation
  3151. (must be preceded by a RMFIND, RMGET).
  3152. Each of the above operations works on one row of data at a
  3153. time.  RMGET increments the pointers to point to the next
  3154. row.  The initial pointers must be established before the
  3155. required operation can be performed (RMFIND).  The rows
  3156. returned may be qualified with a WHERE clause (default - all
  3157. rows) and the rows may also be returned in a sorted order
  3158. (RMGET only).
  3159. To support concurrent access to multiple relation, a
  3160. parameter is provided to allow the assigning of a number to
  3161. identify the set of pointers for a given relation.  In this
  3162. way the operations on the data base are related to a number
  3163. which in turn corresponds to the pointers for a single
  3164. Each of the GET, LOAD, PUT, and DELETE operations work on
  3165. one row of data at a time. GET, PUT and DELETE use an
  3166. implied row pointer initialized by RMFIND and incremented
  3167. by RMGET. You have 6 pointers numbered 0-5 at your disposal.
  3168. You may use more than one pointer for a given relation. RMPUT,
  3169. which must be preceded by RMGET, simply puts a row back where
  3170. it was taken from. RMLOAD, while not specifically using the
  3171. pointers from RMFIND, requires a call to RMFIND. In this case
  3172. RMFIND simply identifies the relation. RMLOAD adds rows to the
  3173. relation, not replacing them like RMPUT.
  3174. A call toi RMFIND establishes an implied pointer chain to all
  3175. the rows in a relatuion in the internal order of the rows. You may
  3176. restrict the number of rows in the implied pointer chain by a call
  3177. to RMWHER following the RMFIND call. You may also sort the
  3178. rows qualified by the implied pointer chain by calling RMSORT. Thus
  3179. for each pointer you want to use, you must first call RMFIND,
  3180. then possibly RMWHER and/or RMSORT. You must not call RMGET, RMLOAD,
  3181. RMPUT, ro RMDEL between the calls to RMFIND, RMWHER, and RMSORT
  3182. unless a new pointer chain is being established.
  3183. If a relation is modified (using RMPUT, RMDEL, and RMLOAD), only
  3184. one pointer should be in effect for the relation. If more than
  3185. one pointer is used, the results are unpredictable.
  3186. A pointer may be redefined as many times as desired. Each RMFIND
  3187. call redefines the pointer. The logical sequence of RMFIND, RMWHER 
  3188.  
  3189.  
  3190.                                                    Page 58
  3191.                                                        
  3192.                                                        
  3193.  
  3194.  
  3195. (optional), RMSORT (optional) calls must be set up prior to
  3196. the first call to RMGET. Note that a new RMWHER or RMSORT call
  3197. requires a new RMFIND call.
  3198.    CALL RMFIND (number,relname)
  3199.    ----------------------------
  3200.    Input Parameters:
  3201.      number---number (0-5) assigns a pointer for the
  3202.               relation (int)    
  3203.      relname--relation name (8H)
  3204. This routine establishes the initial pointer number for a
  3205. relation.  A call to RMFIND must be made before calls to
  3206. RMGET, RMWHER, RMLOAD, and RMSORT.
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.                                                    Page 59
  3246.                                                        
  3247.                                                        
  3248.  
  3249.  
  3250. CALL RMWHER (number,attname,operator,value,numval,nextboo,numboo)
  3251. ----------------------------------------------------------------
  3252. Input Parameters:
  3253.   number--number (0-5) identifies the relation pointer for
  3254.           this operation (int)
  3255.   attname-array of attribute names (may also be attribute
  3256.           number, ROWS or LIMIT) where the nth attname
  3257.           corresponds to the nth WHERE clause (Hollerith)
  3258.   operator-array of operators (EQ,GT,EQA,EXIS,FAIL,etc.)
  3259.           where the nth operator corresponds to the nth
  3260.           WHERE clause (each 4H)
  3261.   value---2-dimensional array of (any type, fixed, or
  3262.           variable) where the nth row corresponds to the nth
  3263.           WHERE clause
  3264.           The organization of the array is dependent on the
  3265.           of the array is dependent on the attribute type
  3266.           and length.  Let vset represent a list of values
  3267.           (in most cases the list has one in vset (see the
  3268.           SELECT command).  The rows are organized as
  3269.           follows:
  3270.           Fixed length attributes--------------------------
  3271.            vset(1),vset(2),......,vset(numval)
  3272.            where numval is equal to the number o f values in
  3273.            the list (note if the EQA condition is used there
  3274.            can only be one member in the vset, see the
  3275.            SELECT command)
  3276.           Variable length attributes------------------------
  3277.            TEXT - c(1),0,vset(1),c(2),0,vset(2)............,
  3278.                   c(numval),0,vset(numval)
  3279.                   where c is the number of characters in the
  3280.                   corresponding vset and numval is equal to
  3281.                   the number of values in the list.
  3282.           INT,REAL,DOUB,VEC - items(1),0,vset(1),items(2),0,
  3283.           vset(2)....,items(numval),0,vset(numval)
  3284.           where items is the number of items in the
  3285.           corresponding vset and numval is equal to the
  3286.           number of values in the list
  3287.           MAT-rows(1),col(1),vset(1),rows(2),col(2),vset(2),
  3288.           ......,rows(numval),col(numval),vset(numval)
  3289.           where rows is the number of rows and cols is the
  3290.           number of columns in the matrix
  3291. Note that a call to RMFIND must precede a call to RMWHER.
  3292.   numval-number of values in the list of values (vset) where
  3293.          the nth numval corresponds to the nth WHERE clause
  3294.          (int array)
  3295.   nextboo-array of "AND" "OR" operators (each 4H)
  3296.   numboo-number of WHERE conditions (int).
  3297. This routine qualifies a set of rows for retrieval (this
  3298.  
  3299.  
  3300.                                                    Page 60
  3301.                                                        
  3302.                                                        
  3303.  
  3304.  
  3305. corresponds to the where clause).
  3306. For example, if the following WHERE clause were required:
  3307. WHERE ATT1 EQ 4 7 12 OR ATT2 EQS "TEXT STRING" AND ATT3 +
  3308. GT 5. AND ATT3 EQA ATT4
  3309. (ATT1 -- integer length 1)
  3310. (ATT2 -- text variable length)
  3311. (ATT3 -- real length 1)
  3312. (ATT4 -- real length 1)
  3313. The arrays would contain:
  3314. attname(1)   = 8HATT1
  3315. attname(2)   = 8HATT2
  3316. attname(3)   = 8HATT3
  3317. attname(4)   = 8HATT3
  3318. operator(1)  = 4HEQ
  3319. operator(2)  = 4HEQS
  3320. operator(3)  = 4HGT
  3321. operator(4)  = 4HEQA
  3322. value(1,1)   = 4
  3323. value(1,2)   = 7
  3324. value(1,3)   = 12
  3325. value(1,4)   = value(1,5) = 0
  3326. value(2,1)   = 11
  3327. value(2,2)   = 0
  3328. value(2,3)   = 4HTEXT
  3329. value(2,4)   = 4 H STR
  3330. value(2,5)   = 3HING
  3331. value(3,1)   = 5.
  3332. value(3,2)   = value(3,3) = value(3,4) = value(3,5)=0
  3333. value(4,1)   = 4HATT4
  3334. value(4,2)   = value(4,3) = value(4,4) = value(4,5)=0
  3335. numval(1)    = 3
  3336. numval(2)    = 1
  3337. numval(3)    = 1
  3338. numval(4)    = 1
  3339. nextboo(1)   = 4HOR
  3340. nextboo(2)   = 4HAND
  3341. nextboo(3)   = 4HAND
  3342. nextboo(4)   = 0
  3343. numboo       = 4
  3344. "Value" would be dimensioned (4,5) in the above example.
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.                                                    Page 61
  3356.                                                        
  3357.                                                        
  3358.  
  3359.  
  3360. CALL RMSORT (number,attname,numsort,sortype)
  3361. Input Parameters:
  3362.    number --- number (0-5) identifies the pointer for the
  3363.               relation sorted (int)
  3364.    attname -- array of "numsort" attribute names to sort
  3365.               on (each 8H)
  3366.    numsort -- number of attributes to sort (int)
  3367.    sortype -- sort control numbers, corresponding to
  3368.               attname LT 0 causes descending sort,
  3369.               GE 0 causes ascending sort (int array)
  3370. This routine sorts the data prior to retrieval (this is
  3371. equivalent to the SORTED BY clause).
  3372. For example, if the following SORTED BY clause were
  3373.   required:
  3374.     SORTED BY ATT1=A ATT2=A ATT3=D
  3375. The array would contain:
  3376.         
  3377.   attname(1) = 8HATT1
  3378.   attname(2) = 8HATT2
  3379.   attname(3) = 8HATT3
  3380.   sortype(1) = 1
  3381.   sortype(2) = 1
  3382.   sortype(3) = -1
  3383.   numsort  = 3
  3384.    CALL RMGET (number,array)
  3385.    ------------------------
  3386.    Input Parameters:
  3387.      Number --- number (0-5) identifies the relation
  3388.                 pointer for this operation (int).
  3389.    Output Parameters:
  3390.      Array ---  array to receive the row of data (any type).
  3391.                 Let "coli" be the column number in the
  3392.                 relation for the ith attribute (see RMGATT).
  3393.                 Fixed length attributes--------------------
  3394.                  Array (coli) contains the start of the
  3395.                  value for the i-th attribute.
  3396.                 Variable length attributes----------------
  3397.                  Array (coli) contains the pointer "N"
  3398.                  which points to the start of the attribute
  3399.                  data in array.
  3400.                 Array(N) contains one of the following:
  3401.                 TEXT - number of characters
  3402.                 INT,REAL,DOUB,VEC - number of items
  3403.                 MAT(N+2) ,.....contains attribute values
  3404. This routine gets a row of data from the specified relation
  3405. and advances the pointer to the next qualifying row (as
  3406. determined by RMWHER and RMSORT conditions).
  3407.  
  3408.  
  3409.  
  3410.                                                    Page 62
  3411.                                                        
  3412.                                                        
  3413.  
  3414.  
  3415.      The following figure illustrates the organization of fixed and variable
  3416. length data in the array. The pointer word, array(p) contains values
  3417. as shown. Word p+1 contains 0 or the column dimension for matrix attribute
  3418. type.
  3419.  
  3420.         Figure 3.5-1 -- Organization of Array
  3421.  
  3422.  
  3423.      Fixed    Variable        Fixed             Variable Length   Variable
  3424.    Length=1    Length       Length=2             Attribute         Length
  3425.    Attribute  Attribute   Attribute              Parameters       Attribute
  3426.                         /------^--------\
  3427. +--+---------+---------+---------+---------+-+---------+---------+---------+-+
  3428. |  |         |         |         |         |X|         |         |         | |
  3429. >  |    3    |    4    |    5    |    6    |X|    N    |  N+1    |  N+2    | >
  3430. <  |         |         |         |         |X|         |         |         | <
  3431. |  |         |         |         |         |X|         |         |         | |
  3432. +--+---------+---------+---------+---------+-+---------+---------+---------+-+
  3433.       VALUE    POINTER   \-------v--------/   /---^---\             VALUE
  3434.                               VALUE           * NO. Chars   0
  3435.                 +---+                           (text)
  3436.                 | N |                         * NO. Words   0
  3437.                 +-+-+                           (Int, Real)
  3438.                   |                           * NO. Items   0
  3439.                   |                             (DOUB, DVEC)
  3440.                   |                           * NO. Items   0
  3441.                   |                             (Ivec, RVEC)
  3442.                   |                           * Row Dimens. Col. Dimens.
  3443.                   |                             (Matrix)    (Matrix)
  3444.                   |                            \--v--/
  3445.                   |                               ^
  3446.                   |                               |
  3447.                   +-------------------------------+
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.                                                    Page 63
  3466.                                                        
  3467.                                                        
  3468.  
  3469.  
  3470.    CALL RMLOAD (number,array)
  3471.    -------------------------
  3472.    Input Parameters:
  3473.      number --- number (0-5) identifies the relation to
  3474.                 load (int).
  3475.      array ---- array containing the row of data to load
  3476.                 (any type).
  3477.                 (see RMGET for a description of array)
  3478. RMLOAD will load a row of data into a specified relation. Calls
  3479. to RMLOAD may be repeated, with each row being loaded at the
  3480. bottom of the relation. A call to RMFIND must have preceded
  3481. the RMLOAD call to establish the validity of number by
  3482. associating it with a relation.
  3483. This sequence of calls will modify a row of data in a
  3484. specified relation.
  3485.     CALL RMGET (number,array)
  3486.     ------------------------
  3487.               .
  3488.               .
  3489.               .
  3490.     CALL RMDEL (number)
  3491.     -------------------
  3492.     Input Parameters:
  3493.       number --- number (0-5) identifies the relation
  3494.                  from which rows are to be deleted (int).
  3495. This sequence of calls will delete a row of data in a
  3496. specified relation.
  3497. Calls to RMPUT and RMDEL must be preceded by calls to RMGET
  3498. since neither RMPUT or RMDEL advances the pointer they
  3499. operate on to the next row. The RMPUT call works like that
  3500. for RMDEL; array in this case is included so the call is
  3501.  
  3502.  
  3503. CALL RMPUT (number, array)
  3504.  
  3505.  
  3506.      where number is the pointer number 0-5 identifying the
  3507. relation to be modified; the row to be modified is established
  3508. by a call to RMGET prior to the RMPUT call, and
  3509.  
  3510.      array is the array containing the modified row of data.
  3511.  
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.                                                    Page 64
  3521.                                                        
  3522.                                                        
  3523.  
  3524.  
  3525. RIM Handy Reference Card
  3526.  
  3527. DEFINING A DATABASE SCHEMA
  3528.          DEFINE dbname
  3529.          OWNER password
  3530.          ATTRIBUTES
  3531.          attname {REAL} [{length}][KEY]
  3532.                  INT      VAR
  3533.                  TEXT
  3534.                  DOUB
  3535.                  RVEC
  3536.                  IVEC
  3537.                  DVEC
  3538.          attname {RMAT}  {row,col} [KEY]
  3539.                  IMAT     row,VAR
  3540.                  DMAT     VAR,VAR
  3541.          RELATIONS
  3542.          relname WITH attname1 [attname2...]
  3543.          PASSWORDS
  3544.          {READ PASSWORD} FOR {relname} IS password
  3545.          RPW                     ALL
  3546.          {MODIFY PASSWORD} FOR {relname} IS password
  3547.          MPW                     ALL
  3548.          RULES
  3549.          attname [IN relname]    {EQ} value [{AND}...]
  3550.                                   NE          OR
  3551.                                   GT
  3552.                                   GE
  3553.                                   LT
  3554.                                   LE
  3555.          attname IN relname      {EQA} attname IN relname [{AND}...]
  3556.                                   NEA                       OR
  3557.                                   GTA
  3558.                                   GEA
  3559.                                   LTA
  3560.                                   LEA
  3561.          END
  3562.  
  3563. LOADING A RELATION
  3564.          LOAD relname
  3565.          value1 value2 ... valueN
  3566.          END
  3567.          value: SCALARS val1
  3568.                 TEXT "text string"
  3569.                 VECTOR (val1, val2, ...)
  3570.                 MATRIX(r1c1,r2c1,...),(r1c2,r2c2,...)...)
  3571.  
  3572. QUERYING A RELATION
  3573.  
  3574.  
  3575.                                                    Page 65
  3576.                                                        
  3577.                                                        
  3578.  
  3579.  
  3580.          SELECT {attname1 [=fid1],attname2[=fid2],...} FROM relname +
  3581.                  attnum1 [=fid1],...
  3582.                  attname1(i),...
  3583.                  attname1(i,j)...
  3584.                  ALL
  3585.                  [SORTED BY attname1 [={A}],[attname2 [={A}]...]]+
  3586.                                         D                D
  3587.                  [WHERE ...]
  3588.          TALLY attname [={A}] FROM relname [WHERE...]
  3589.                           D
  3590.  
  3591.          WHERE CLAUSE:
  3592.  
  3593.          WHERE   attname         {EXISTS}                [{AND}...]
  3594.                                   FAILS                    OR
  3595.                                   EQS    value
  3596.                                   EQ     {value}
  3597.                                   NE      MAX
  3598.                                   GT      MIN
  3599.                                   LT
  3600.                                   LE
  3601.                                   GE
  3602.  
  3603.          WHERE   attname         {EQA}   attname         [{AND}...]
  3604.                                   NEA                      OR
  3605.                                   GTA
  3606.                                   GEA
  3607.                                   LTA
  3608.                                   LEA
  3609.  
  3610.          WHERE   ROWS            {EQ}    rownumber       [{AND}...]
  3611.                                   NE                       OR
  3612.                                   LT
  3613.                                   LE
  3614.                                   GE
  3615.                                   GT
  3616.  
  3617.          WHERE   {attname}       {EQ}    list            [{AND}...]
  3618.                   ROWS            NE                       OR
  3619.  
  3620.          WHERE   LIMIT           EQ      number          [{AND}...]
  3621.                                                            OR
  3622. ...
  3623.  
  3624. QUERYING THE SCHEMA
  3625.  
  3626.          LISTREL [relname]
  3627.                   ALL
  3628.  
  3629.  
  3630.                                                    Page 66
  3631.                                                        
  3632.                                                        
  3633.  
  3634.  
  3635.          EXHIBIT attname1 [attname2...]
  3636.          PRINT RULES
  3637.  
  3638. COMPUTATION COMMAND
  3639.  
  3640.          COMPUTE {COUNT} attname FROM relname [WHERE...]
  3641.                   MIN
  3642.                   MAX
  3643.                   AVE
  3644.                   SUM
  3645.  
  3646. MODIFICATION COMMANDS
  3647.  
  3648.          CHANGE {attname} TO value [IN relname] WHERE ...
  3649.                  attname(i)
  3650.                  attname(i,j)
  3651.          CHANGE {RPW} TO newpass FOR relname
  3652.                  MPW
  3653.          CHANGE OWNER TO newowner
  3654.          DELETE ROWS FROM relname WHERE ...
  3655.          DELETE DUPLICATES [attname1,attname2,...] FROM relname
  3656.          DELETE RULE rulenumber
  3657.          RENAME ATTRIBUTE attname TO newname [IN relname]
  3658.          RENAME RELATION relname TO newname
  3659.          REMOVE relname
  3660.  
  3661. RELATIONAL ALGEBRA COMMANDS
  3662.  
  3663.          INTERSECT relname1 WITH relname2 FORMING relname3 +
  3664.                  [USING attname1 [attname2,...]]
  3665.          JOIN relname1 Using attname1 WITH relname2 USING attname2 +
  3666.                  FORMING relname3 [WHERE {EQ}]
  3667.                                           NE
  3668.                                           GT
  3669.                                           GE
  3670.                                           LT
  3671.                                           LE
  3672.          SUBTRACT relname1 FROM relname2 FORMING relname3 +
  3673.                  [USING attname1 [attname2,...]]
  3674.          PROJECT relname1 FROM relname2 USING +
  3675.                  {attname1,[attname2,...]} [WHERE ...]
  3676.                   ALL
  3677.  
  3678. REPORT COMMANDS
  3679.  
  3680.          NEWPAGE
  3681.          BLANK n
  3682.          TITLE "title"
  3683.  
  3684.  
  3685.                                                    Page 67
  3686.                                                        
  3687.                                                        
  3688.  
  3689.  
  3690.          DATE
  3691.          LINES n
  3692.          WIDTH n
  3693.  
  3694. KEY COMMANDS
  3695.  
  3696.          BUILD KEY FOR attname IN relname
  3697.          DELETE KEY FOR attname IN relname
  3698.  
  3699. RIM-TO-RIM COMMAND
  3700.  
  3701.          UNLOAD [dbname [=newdbname]]   {SCHEMA} [relname1 [=mpw] +
  3702.                                          DATA
  3703.                                          ALL
  3704.                  [relname2 [=mpw],...]
  3705.  
  3706. GENERAL COMMANDS
  3707.  
  3708.          INPUT {filename}
  3709.                 TERMINAL
  3710.          OUTPUT {filename}
  3711.                 TERMINAL
  3712.          EXIT
  3713.          QUIT
  3714.          MENU
  3715.          HELP [command name]
  3716.          USER password
  3717.          ECHO
  3718.          NOECHO
  3719.          CHECK
  3720.          NOCHECK
  3721.          TOLERANCE xx.xx [PERCENT]
  3722.          RELOAD
  3723.          CLOSE
  3724.  
  3725. HOST DEPENDENT COMMANDS (note: may be CDC syntax)
  3726.  
  3727.          OPEN dbname [=filename],[UN=account],[PW=password],+
  3728.                  [DIRECT={R}]
  3729.                           W
  3730.          ZIP "jet statement"
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.                                                    Page 68
  3741.                                                        
  3742.                                                        
  3743.  
  3744.  
  3745.                                  Summary of the Application Program Interface
  3746. INITIALIZING THE DATA BASE
  3747.   CALL RMOPEN (dbname)
  3748.          Input parameter:
  3749.                  dbname -- the name of the data base in Hollerith format
  3750.   CALL RMCLOS
  3751.  
  3752. GENERAL ROUTINES
  3753.   CALL RMUSER (password)
  3754.          Input parameters:
  3755.                  password -- the password text
  3756.   CALL RMRULE (switch)
  3757.          Input parameters:
  3758.                  switch -- 0 - no rule checking (Nocheck)
  3759.                            1 - check rules (CHECK)
  3760.   CALL RMTOL (value,switch)
  3761.          Input parameters:
  3762.                  value -- the value of the tolerance (real)
  3763.                  switch - 0 if "val" is tolerance value (int)
  3764.                           1 if "val" is tolerance percent
  3765. ACCESSING THE SCHEMA
  3766.   CALL RMLREL
  3767.   CALL RMGREL(rname,rpw,mpw,lastmod,numatt,numrows)
  3768.          Output parameters:
  3769.           rname - relation name (text)
  3770.           rpw     read password, .TRUE. or .FALSE.
  3771.           mpw     modify password, .TRUE. or .FALSE.
  3772.           lastmod date of last modification in relation data in
  3773.                  yy/mm/dd format
  3774.           numatt  number of attributes in relation (int)
  3775.           numrows number rows of data in relation (int)
  3776.   CALL RMLATT(rname)
  3777.          Input parameters:
  3778.           rname - relation name in hollerith (text) format
  3779.   CALL RMGATT(aname,type,matvec,var,len1,len2,column,key)
  3780.          Output parameters:
  3781.           aname - attribute name
  3782.           type - attribute type (INT, REAL, DOUB, or TEXT)
  3783.           matvec- attribute type (VEC or MAT, else blank)
  3784.           var    variable length attribute, .TRUE. or .FALSE.
  3785.           len1 - attribute length data as follows (int):
  3786.                  TEXT - number of characters
  3787.                  INT, REAL, DOUB, VEC - number of items
  3788.                  MAT - row dimension
  3789.          len2 - Column dimension of MAT attributes, otherwise 0 (int)
  3790.          column- attribute column location in relation (int)
  3791.          key -   keyed attribute (.TRUE. or .FALSE.)
  3792.  
  3793.  
  3794.  
  3795.                                                    Page 69
  3796.                                                        
  3797.                                                        
  3798.  
  3799.  
  3800. ACCESSING THE DATA BASE
  3801.   CALL RMFIND(number,relname)
  3802.          Input parameters:
  3803.            number - user assigned number (0-5) used to reference the
  3804.                          pointer for the relation (int)
  3805.            relname- relation name (characters, H format)
  3806.   CALL RMWHER(number,attname,operator,value,numval,nextboo,numboo)
  3807.          Input parameters:
  3808.            number - number (0-5) which identifies the relation pointer
  3809.                  for this operation (int)
  3810.            attname - array of attribute names, attribute numbers, the
  3811.                  keyword ROWS, or LIMIT
  3812.            operator - array of operators (EQ, GT, EQS, EQA, etc.)
  3813.            value -  2 dimensional array of WHERE clause "values"
  3814.            numval - Number of "values" in list of values
  3815.            nextboo - array of "AND" "OR" operators
  3816.            numboo - Number of WHERE conditions (int)
  3817.  
  3818.   CALL RMSORT(number,attname,numsort,sortype)
  3819.          Input parameters:
  3820.            number - number (0-5) which identifies the relation pointer
  3821.                  for this operation (int)
  3822.            attname - array of "numsort" attribute names to sort on
  3823.            numsort - number of attributes to sort on (int)
  3824.            sortype - sort control numbers: -1 = descending sort,
  3825.                          +1 = ascending sort.
  3826.   CALL RMGET(number,array)
  3827.          Input parameters:
  3828.            number - number (0-5) which identifies the relation pointer
  3829.                  for this operation (int)
  3830.          OUTPUT Parameters:
  3831.            array - array to receive the row of data
  3832.  
  3833.   CALL RMLOAD(number,array)
  3834.          Input parameters:
  3835.            number - number (0-5) which identifies the relation pointer
  3836.                  for this operation (int)
  3837.            array- array containing the row of data to load
  3838.  
  3839.   CALL RMPUT(number,array)
  3840.          Input parameters:
  3841.            number - number (0-5) which identifies the relation pointer
  3842.                  for this operation (int)
  3843.            array - array containing the modified row of data.
  3844.  
  3845.   CALL RMDEL (number)
  3846.          Input parameters:
  3847.            number - number (0-5) which identifies the relation pointer
  3848.  
  3849.  
  3850.                                                    Page 70
  3851.                                                        
  3852.                                                        
  3853.  
  3854.  
  3855.                  to be deleted. (int)
  3856.  
  3857.  
  3858.  
  3859.  
  3860.      The following is a small sample program in VAX Fortran to show how
  3861. RIM may access the AERODB data base. It prints the following:
  3862.  
  3863. 1. All information about the schema (LISTREL ALL)
  3864.  
  3865. 2. The data in the relation REL300 sorted for the airports in
  3866. Brazil sorted by descending altitude. CITYNAME is variable length
  3867. and the commands are SELECT ALL FROM REL300 SORTED BY ALTITUDE=D
  3868. WHERE CITYNAME EQS "BRAZIL".
  3869.  
  3870.          LOGICAL RPW,MPW,VAR,KEY
  3871.          COMMON/RIMCOM/RMSTAT
  3872.          INTEGER RMSTAT
  3873.          REAL*8 NAME,LASTMD,NAMEA,NAMEC,IVAR,DB,NAME
  3874.          DIMENSION NVAL(20)
  3875.          DIMENSION NAMEQS(5)
  3876. C OPEN THE DATA BASE
  3877.          DBNAME=6HAERODB
  3878.          CALL RMOPEN(DBNAME)
  3879. C LISTREL ALL
  3880.          CALL RMLREL
  3881. 100      CONTINUE
  3882.          CALL RMGREL(NAME,RPW,MPW,LASTMD,NUMATT,NUMROW)
  3883.          IF(RMSTAT.NE.0)GOTO 200
  3884.          LRP=3HNO 
  3885.          IF(RPW) LRP=3HYES
  3886.          MRP=3HNO
  3887.          IF(MPW)MRP=3HYES
  3888.          WRITE(6,110)NAME,LRP,MRP,LASTMD,NUMATT,NUMROW
  3889. 110      FORMAT(1X,A8,2(1X,A4),1X,A8,2I8)
  3890.          CALL RMLATT(NAME)
  3891. 120      CONTINUE
  3892.          CALL RMGATT(NAMEA,ITYPE,MAT,VAR,LEN1,LEN2,NCOL,KEY)
  3893.          IF(RMSTAT.NE.0)GOTO 100
  3894.          IVAR=5HFIXED
  3895.          IF(VAR)IVAR=8HVARIABLE
  3896.          IKEY=2HNO
  3897.          IF(KEY)IKEY=3HYES
  3898.          WRITE(6,130)NAMEA,ITYPE,MAT,IVAR,LEN1,LEN2,NCOL,IKEY)
  3899. 130      FORMAT(1X,A8,2(1X,A5),1X,A8,3I8,1X,A3)
  3900.          GOTO 120
  3901. 200      CONTINUE
  3902. C SELECT ALL FROM REL300 SORTED BY ALTITUDE=D+
  3903.  
  3904.  
  3905.                                                    Page 71
  3906.                                                        
  3907.                                                        
  3908.  
  3909.  
  3910. C  WHERE CITYNAME EQS "BRAZIL"
  3911.          NAME=6HREL300
  3912.          CALL RMFIND(1,NAME)
  3913.          IF(RMSTAT.NE.0)GOTO 999
  3914.          NAMEQS(1)=6
  3915.          NAMEQS(2)=0
  3916.          NAMEQS(3)=4HBRAZ
  3917.          NAMEQS(4)=2HIL
  3918.          NAMEC=8HCITYNAME
  3919.          IBOOOP=3HEQS
  3920.          CALL RMWHER(1,NAMEC,IBOOOP,NAMEQS,1,0,1)
  3921.          IF(RMSTAT.NE.0)GOTO 500
  3922.          NAMEA=8HALTITUDE
  3923.          CALL RMSORT(1,NAMEA,1,-1)
  3924.          IF(RMSTAT.NE.0)GOTO 999
  3925. 300      CONTINUE
  3926.          CALL RMGET(1,NVAL)
  3927.          IF(RMSTAT.NE.0)GOTO 500
  3928.          NUMX=(NVAL(5)-1)/10+1
  3929.          NUMP=6+NUMX
  3930.          WRITE(6,400)(NVAL(K),K=1,NUMP)
  3931. 400      FORMAT(A4,5I6,2X,30A1)
  3932.          GOTO 300
  3933. 500      CONTINUE
  3934.          IF(RMSTAT.LT.0)GOTO 1000
  3935. 999      CONTINUE
  3936.          WRITE(6,9001)RMSTAT
  3937. 9001     FORMAT(' RMSTAT:',I5)
  3938. C CLOSE THE DATA BASE
  3939. 1000     CONTINUE
  3940.          CALL RMCLOS
  3941.          STOP
  3942.          END
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.                                                    Page 72
  3961.                                                        
  3962.                                                        
  3963.  
  3964.  
  3965.                                                   LIMITATIONS
  3966.  
  3967.      There is no limit on the number of rows of a relation except disk size.
  3968.  
  3969.      A row in a relation must fit in 1021 words. If len(i) is the fixed length
  3970. (in words) of the ith attribute and var(j) is the length (in words) of
  3971. the jth variable length attribute, then
  3972. SUM(len(i) for i=1 to max)+sum((var(j)+3) for j=1 to max) must be less
  3973. than 1021. This can mean that relations that fit on 60 bit
  3974. machines may not fit on 32 bit machines.
  3975.  
  3976.      A relation or attribute name must not begin with the character string
  3977. "RMRUL".
  3978.  
  3979.      The following words may not be used in attribute or relation names:
  3980. TO, FROM, BY, USING, WHERE, IN, FORMING, ROWS, LIMIT, DUPLICATE.
  3981. Also, names must not be a substring of the above
  3982. which is 3 characters or more long starting with the first
  3983. character. Thus FOR and FORM are illegal, however FORT is OK.
  3984.  
  3985.      In loading data, the value of the first attribute, if it is text,
  3986. is limited as follows:
  3987. If the relation contains only 1 or 2 attributes, then the following
  3988. text strings and their RIM substrings are not allowed as values for
  3989. the first attribute:
  3990. CHECK, NOCHECK, ECHO, NOECHO, END, HELP, INPUT, OUTPUT, QUIT.
  3991. If the relation contains three attributes then the value for the
  3992. first attribute may not be HELP or HEL.
  3993.  
  3994.      The number of items in one command may not exceed 100.
  3995.  
  3996.      The number of rules specified for one relation may not exceed 10.
  3997.  
  3998.      The number of conditions used in the SELECT WHERE clause may not
  3999. exceed 10.
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.                                                    Page 73
  4016.                                                        
  4017.                                                        
  4018.  
  4019.  
  4020.                                   Entering Input with the RIM User Interface
  4021.  
  4022.      The following discusses the reading and parsing of commands and
  4023. data in the standalone system.
  4024.  
  4025.      The RIM user interface is a free-field input routine used by the RIM
  4026. standalone system which separates user input into items which are
  4027. grouped into records.
  4028.  
  4029.                                                   Terminology
  4030.  
  4031.      1.   LINE - One line of information with a maximum of 80 characters
  4032.          including blanks.
  4033.  
  4034.      2.   ITEM - One piece of information. An item may be a real number,
  4035.          an integer or text. Items are delimited by blanks or commas. Multiple
  4036.          blanks count as a single blank. Multiple commas generate null items.
  4037.  
  4038.      3.   RECORD - A collection or list of up to 100 items entered in
  4039.          response to a single request for data by the calling program.
  4040.  
  4041.      4.   INTEGER - all characters must be numeric except that the first
  4042.          may be a + or - sign. For example: -1 23 +10000
  4043.  
  4044.      5.   REAL - An item of the form I1.I2EI3 where I1 and I3 may be
  4045.          signed integers and I2 is an unsigned integer. The entire form is
  4046.          not necessary but at least one digit and the . or two digits
  4047.          separated by the E are required.
  4048.  
  4049.      6.   TEXT - Any single item that is not integer or real. If a text
  4050.          item looks like an integer or real it must be enclosed in quotes (").
  4051.  
  4052.                                                Composing Records
  4053.  
  4054.      Ordinarily records consist of one line. However multiple records may be put
  4055. on a line by separating them with dollars or semicolons. Alternatively,
  4056. a record may span several lines by ending all but the last line with a
  4057. plus. Items must be wholly contained on one line with the exception of
  4058. quoted text items and comments.
  4059.                                             Special Items - +,(, )
  4060.  
  4061.      Equals and left and right parentheses are treated as single items
  4062. unless enclosed in quoted text items. Thus a=3. is 3 items, two
  4063. text and one real rather than one. "a=3." is one item.
  4064.                                                 Multiple Commas
  4065.  
  4066.      If more than one comma separates 2 items, each additional comma
  4067. will generate a text item with 3 characters, "-0-".
  4068.  
  4069.  
  4070.                                                    Page 74
  4071.                                                        
  4072.                                                        
  4073.  
  4074.  
  4075.                                              Rules for Text Items
  4076.  
  4077.      A quoted text item is terminated by a record separator (dollar
  4078. or semicolon). Quoted text items may be continued on multiple
  4079. lines. If the trailing quote is omitted on the last item in a
  4080. record, the quoted item is terminated at the record separator, if
  4081. any, or the last nonblank character on the line. Quotes may be included
  4082. in quoted text strings by doubling the quotes (e.g., "a,""b"
  4083. yields a,"b as a text string). The total number of characters for all
  4084. text strings in a record is limited to 2000.
  4085.                                                    Comments
  4086.  
  4087.      Comments may be included anywhere in the input stream by enclosing them
  4088. between *( and ). For example *( this is a comment). Comments are
  4089. completely ignored by the user interface. Empty lines between records
  4090. are ignored and may be used to paragraph input. An alternative form
  4091. of comment is */ ... / which may be used if you need to have parentheses
  4092. inside the comment.
  4093.                                                 DATA GENERATION
  4094.  
  4095.      Activities such as entering large volumes of data can be eased by
  4096. using the data generation facilities.
  4097.  
  4098.      REPEATING ITEMS ON PREVIOUS RECORD
  4099.  
  4100.      A data item of the form *n where n is an unsigned integer, indicates
  4101. that the next n items are identical to the corresponding n items in
  4102. the previous record.
  4103. An isolated * is taken as *1. Double asterisks (**) indicate
  4104. that the remaining items in the previous record are to be copied
  4105. to the current record.
  4106.  
  4107.      REPEATING AN ITEM IN THE CURRENT RECORD - *=N, *=N+STEP
  4108.  
  4109.      An item of the form *=n, where n is an unsigned integer, indicates
  4110. that the next n items are identical to the immediately preceding
  4111. item. An item of the form *=n+step or *=n-step, where step is an
  4112. unsigned real or integer, indicates that the next n items are to
  4113. be generated by consecutively incrementing the immediately preceding
  4114. item.
  4115.  
  4116.      GENERATING MULTIPLE RECORDS *+N
  4117.  
  4118.      A record beginning with *+n where n is an unsigned integer indicates
  4119. that the next n records are to be generated from the preceding
  4120. record. Each item of the generated record is formed by adding an
  4121. item of the *+n record to the corresponding item of the immediately
  4122. preceding record. A zero (integer) item should be inserted
  4123.  
  4124.  
  4125.                                                    Page 75
  4126.                                                        
  4127.                                                        
  4128.  
  4129.  
  4130. in an *+n record for text items in the preceding record. The number of
  4131. items after the *+n must match the number in the preceding record.
  4132.  
  4133.                                            Notes on Generating Items
  4134.  
  4135.      When increments are specified, either on the *+n record or as
  4136. step on an *=n+step item they must match the item thye are
  4137. incrementing in type. It should be noted that the *+n record
  4138. generation optuion is based on the expanded representation of
  4139. the previous record. The generation does not operate on the card
  4140. image of the preceding record if it contains data generation items.
  4141. Therefore it is not possible to repeat or increment an asterisk-type
  4142. item.
  4143.  
  4144.                                                    Examples
  4145.  
  4146.      Consider the following 7 input records to illustrate data generation
  4147. features:
  4148.  
  4149. 1 2 3 4 5 6 7 8 9 10 11 12
  4150. 2 1 *2 4 *=2 1 *=2+2 **
  4151. *+1 0 *=3 0 *=5 **
  4152. *+1 0 *=11
  4153. *+1 *12
  4154. *+1 **
  4155. **
  4156.  
  4157.      Twelve data items are defined by each of these records. Each of the
  4158. last six records is translated into the same internal record which
  4159. is: 2 1 3 4 4 4 4 1 3 5 11 12
  4160. Note - the last 5 records could be replaced by the single record
  4161. *+5 **
  4162. instead.
  4163.  
  4164.  
  4165.                                           Changing Special Characters
  4166.  
  4167.      It is possible to change the special characters the user interface
  4168. uses to break apart records. These special characters may either be
  4169. changed to others or set to null so they are ignored. This is useful
  4170. for reading specially formatted files or to allow special characters
  4171. to appear as input in text items. To change special characters enter
  4172. the following special comment as the only entry on a line between
  4173. records:
  4174.  
  4175. *(SET KEYWORD=newvalue)
  4176.  
  4177. where KEYWORD can be DOLLAR, SEMI, QUOTES, BLANK, PLUS, or COMMA
  4178.  
  4179.  
  4180.                                                    Page 76
  4181.                                                        
  4182.                                                        
  4183.  
  4184.  
  4185. and newvalue is either the word NULL or the new special character.
  4186. For example if one wanted to use dollar to delimit items rather
  4187. than records and not to have commas delimit items one would enter:
  4188.  
  4189. *(SET DOLLAR=NULL)
  4190. *(SET COMMA=$)
  4191.  
  4192.  and commas could now be used in unquoted text strings. Note the function
  4193. is altered, so for example the + sign still has its usual function
  4194. in real numbers. To restore the original delimiters one could say:
  4195.  
  4196. *(SET DOLLAR=$)
  4197. *(SET COMMA=,)
  4198.  
  4199.  
  4200.  
  4201.  
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.  
  4232.  
  4233.  
  4234.  
  4235.                                                    Page 77
  4236.                                                        
  4237.                                                        
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.  
  4249.  
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.  
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.                                                    Page 78
  4291.                                                      INDEX
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297. ATTRIBUTES   19
  4298.  
  4299. BLANK Command   43
  4300. BUILD KEY Command   36
  4301.  
  4302. CHANGE Command   33
  4303. CHANGE OWNER Command   34
  4304. CHANGE PASSWORD Command   36
  4305. CLOSE Command   16
  4306. COMPUTE Command   32
  4307.  
  4308. Data Base Creation Option   47
  4309. Data Base Update Option   47
  4310. DATE Command   43
  4311. Define RELATIONS   20
  4312. Define RULES   21
  4313. Define Submodule Commands   19, 22
  4314. DELETE DUPLICATES Command   34
  4315. DELETE KEY Command   36
  4316. DELETE ROW Command   33
  4317.  
  4318. ECHO Command   17
  4319. EXHIBIT Command   31
  4320. EXIT Command   18
  4321.  
  4322. HELP Command   13
  4323.  
  4324. INPUT Command   16
  4325. INTERSECT Command   37
  4326.  
  4327. JOIN Command   39
  4328.  
  4329. LINES Command   43
  4330. LISTREL Command   31
  4331. Load Submodule Commands   23
  4332.  
  4333. MENU Command   15
  4334.  
  4335. NEWPAGE Command   43
  4336. NOCHECK Command   18
  4337. NOECHO Command   17
  4338.  
  4339. OPEN Command   16
  4340. OUTPUT Command   17
  4341. OWNER password   19
  4342.  
  4343.  
  4344.  
  4345.                                                    Page X-1
  4346.                                                        
  4347.                                                        
  4348.  
  4349.  
  4350. PRINT RULES Command   32
  4351. PROJECT Command   40
  4352.  
  4353. Query Option   47
  4354.  
  4355. RELOAD Command   18
  4356. REMOVE Command   36
  4357. RENAME Attribute Command   34
  4358. RENAME RELATION Command   36
  4359.  
  4360. SELECT command   25, 26, 27
  4361. SUBTRACT Command   41
  4362.  
  4363. TALLY Command   30
  4364. TITLE Command   43
  4365. TOLERANCE Command   17
  4366. Type1 Attributes   20
  4367. Type2 Attributes   20
  4368.  
  4369. UNLOAD Command   44
  4370. USER Command   16
  4371.  
  4372. WIDTH Command   43
  4373.  
  4374.  
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.                                                    Page X-2
  4401.