
									A-1




	I.	INTRODUCTION TO DATATRIEVE

	Today I am going to introduce you to DATATRIEVE.  I will talk 
	about some of the basic features in DATATRIEVE and hopefully
	give you a taste of how it works.  Subsequent course modules
	will go into more detail on individual commands.


	WHAT IS DATATRIEVE?

	Digital describes DATATRIEVE as an interactive query and report
		writing language.

	Users often draw similarities between it and a file cabinet.

	DATATRIEVE can be used by the novice user to interactively STORE,
		MODIFY, DELETE, and PRINT, in various formats, data that
		is contained in a file.

	DATATRIEVE can also be used by experienced programmers to develop
		sophisticated procedures and to interface with another
		language such as FORTRAN, COBOL, or BASIC thus combining
		the best features of both.
                        
	DATATRIEVE's report writer allows sophisticated reports to be
		immediately printed on the terminal, a printer, or in a
		file that can later be edited if needed.



									A-2



	WHY USE DATATRIEVE?

	Easy to get the basics down and get started

		*  Help
		*  Documentation
		*  Guide Mode
		*  Application Design Tool (ADT)


	Interactive use gives immediate results


	Many possibilities

		*  Combined with FMS or TDMS
		*  Accessed through DCL command procedures
		*  Combined with the Call Interface
		*  Adding Functions to DATATRIEVE





	WHY NOT TO USE DATATRIEVE?


	Cost of the Product


	Extensive use of System Resources


	Lost of Control over Data


	Difficult for Some Programmers to Use



									A-3



	TERMS OF IMPORTANCE


        1. PRINT
	   Causes DATATRIEVE to format and write to your terminal
	   field names or values of expressions.  Examples A-4.


        2. ALPHABETIC
	   Any combination of characters in the alphabet and spaces.
	   Alphabetic fields are designated by an "A".  Examples A-4.


        3. NUMERIC
	   Any combination of numbers and optionally a sign (+ or -).
	   Numeric fields are designated by a "9".  Examples A-4.


        4. ALPHANUMERIC
	   Any combination of characters including non-printable ones.
	   Alphanumeric fields are designated by a "X".  Examples A-4.


        5. STRING
	   A particular sequence of connected characters from zero to
	   many characters.  "" is a special type of string called the
	   null string that has nothing in it.  "B" is also a string.
	   So is "TESTing 1,2,3 ".  Examples A-4.


        6. NUMERIC OPERATIONS
	   DATATRIEVE can multiply, divide, add, or subtract using your
	   normal computer symbols (*, /, +, -).  The "()" characters
	   can help clarify your numeric operation.  Examples A-4.


        7. EDIT_STRING
	   Lets you tell DATATRIEVE how you want the value displayed.


        8. HELP
	   As with almost all of Digital's products, there is HELP
	   while in DATATRIEVE.  You can even specify where on the 
	   screen you want the HELP displayed so that your current
	   command lines are not covered.  Example A-5.


        9. SHOW
	   Displays your entire DATATRIEVE dictionary, parts of the
	   dictionary, or individual dictionary objects.  Example A-6.



									A-4




             DTR> PRINT 4321100 USING $$,$$$,$$$
             $4,321,100



             DTR> PRINT 4321100 USING ZZ,ZZZ,ZZZ
              4,321,100



             DTR> PRINT "And a 1 and a 2 and a 3.  Wunnerful."
             And a 1 and a 2 and a 3.  Wunnerful.



             DTR> PRINT "DATATRIEVE DOES NOT KORRECT SPELING" USING T(10)
             DATATRIEVE
             DOES NOT
             KORRECT
             SPELING



             DTR> PRINT 44444 * 1000 USING $$$,$$$,$$$
             $44,444,000



	     DTR> PRINT ((400 / 40) + 30)
	     40



									A-5







        DTR> HELP

   Information available:

   ABORT      ADT        ALLOCATION Assignment BEGIN_END  Boolean
   CDD_Versions          CHOICE     CLOSE      COMMIT     COMPUTED_BY
   Condition  CONNECT    CROSS      DBMS       DECLARE    DEFAULT_VALUE
   DEFINE     DEFINEP    DELETE     DELETEP    Dictionary DISCONNECT DISPLAY
   DISPLAY_FORM          DROP       EDIT       EDIT_STRING           ERASE
   ERROR      EXECUTE    EXIT       EXTRACT    FIND       FINISH     FOR
   Forms      Functions  Guide      HELP       IF         Invoke     LIST
   MATCH      Missing    MISSING_VALUE         MODIFY     New_Features
   Node       OCCURS     ON         OPEN       Path_name  PICTURE    PLOT
   PRINT      Procedure  PURGE      QUERY_HEADER          QUERY_NAME Quit
   Rdb        READY      RECONNECT  REDEFINE   REDEFINES  REDUCE     RELEASE
   Release_notes         REPEAT     REPORT     Restructure           ROLLBACK
   RSE        SCALE      Search     SELECT     SET        SHOW       SHOWP
   SIGN       SORT       Specify    Startup    STORE      SUM
   SYNCHRONIZED          Synonyms   THEN       USAGE      VALID_IF   Value
   Versions   Video      WHILE      Wombat

   Topic?




									A-6






             DTR> SHOW ALL


     Domains:
             ACC1;1          EIGHTY;1        FAMILIES;1      NAME;1
             SR_CLASS;1      TEMP;1          UAF;1           VOTE;1
             WHEELS;1        WORDS;1         YACHTS;1

     Records:
             EIGHTY_REC;1    SRCLAS_REC;1    STUDENT_REC;1   TEMP_REC;1
             UAF_REC;1       VOTE_REC;1      WHEELS_REC;1    WORDS_REC;2
             YACHT;1

     Procedures:
             NAME_REPORT;1   NAME_RPT;1      STORE_VOTE;1    STORE_WHEELS;1
             VOTE_RPT;1      WELCOME;1       WHEELS_RPT;1

     Tables:
             VALID_ACCT;1

     Plots:
             HAPPY;1

     The default directory is CDD$TOP.DT.BRAGG

     No established collections.

     No ready domains.

     No loaded tables.




									A-7



	GETTING INTO DATATRIEVE


             $ DTR

             VAX Datatrieve T3.2-1
             DEC Query and Report System
             Type HELP for help
             DTR>




             Not getting into Datatrieve


             $ DTR

             %CDD-E-NODNOTFND, directory or object not found
             %CDD-E-NODNOTFND, directory or object not found
             $



             $ DTR

             %DCL-W-IVVERB, unrecognized command
               \DTR\



             $ MCR DTR32

             %DCL-W-ACTIMAGE, error activating image DTR32
             -CLI-E-IMAGEFNF, image file not found
               SYS$SYSROOT:[SYSEXE]DTR32.EXE;



									A-8




	          The most important concept in Datatrieve


                         DOMAINS, RECORDS, and FILES



          A record definition shows the size and type of data that is
          stored in a data file.  It is found in your dictionary.



          A domain definition associates the data file with the record
          definition.  It is found in your dictionary.



          A data file is an ordinary file.  It can be INDEXED, RELATIVE,
          or SEQUENTIAL.  It does not have to be created by Datatrieve.
          It is found in your directory.



          A field is part of the information about a record.  Such as
          ZIP in a record holding department store locations or SSOC
          in a record holding employee information.  Fields are found
          in record definitions which are in your dictionary.



									A-9




	           Example of Defining a Datatrieve Record


             DEFINE RECORD PERSONNEL_REC USING
             01 PERSON.
                05 SSOC                     PIC IS 9(9).
                05 EMPLOYEE_STATUS          PIC IS X(11).
                05 EMPLOYEE_NAME.
                   10 FIRST_NAME            PIC IS X(10).
                   10 LAST_NAME             PIC IS X(10).
                05 DEPT                     PIC IS XXX.
                05 START_DATE               USAGE IS DATE.
                05 SALARY                   PIC IS 9(5).
                05 ID                       PIC IS 9(5).
             ;





                   Example of Defining a Datatrieve Domain


             DEFINE DOMAIN PERSONNEL USING PERSONNEL_REC ON PERSONNEL.DAT;






                   Example of Defining a Datatrieve File


             DEFINE FILE FOR PERSONNEL KEY = SSOC;



									A-10




	READY Command

	Gives access to a domain and controls access until the user
	leaves DATATRIEVE or types FINISH.  READY domain SHARED READ
	is the default.  READY domain MODIFY allows the information
	to be modified as well as read.  READY domain WRITE allows
	the information to be STOREd or DELETEd as well as modified
	or read.  SHARED allows other people to access the same do-
	main.  EXCLUSIVE keeps other people from accessing. 



        Boolean Operators and Relational Operators

	Are used to form expressions that get just certain records
	from a domain.  Example A-11.



        SORT Key

	Is a field used as the basis for a sort.  Records can be sorted
	according to any field.	  Example A-12.



        Record Selection Expression

	A RSE is a statement that controls the creation of a specified
	stream of records.  Every record must meet specific conditions
	listed in the RSE before they are included in the record stream.
	The phrase STOCK WITH QTY LT 10 is an example of a RSE.



									A-11



                            BOOLEAN EXPRESSIONS


         =                EQUAL TO             PRINT INVENTORY WITH
         EQ                                    STOCK-NO EQ 1234
         EQUAL

         NE               NOT EQUAL TO         PRINT INVENTORY WITH
         NOT-EQUAL                             STOCK-NO NE 9999

         >                GREATER THAN         PRINT INVENTORY WITH
         GT                                    ITEM-NAME GT "PAINT"
         GREATER-THAN

         GE               GREATER THAN OR      PRINT INVENTORY WITH
         GREATER-EQUAL    EQUAL TO             AMOUNT GE 100

         <                LESS THAN            PRINT INVENTORY WITH
         LESS-THAN                             AMOUNT <  20

         LE               LESS THAN OR         PRINT INVENTORY WITH
         LESS-EQUAL       EQUAL TO             STOCK-NO LE 2000

         BT               VALUE IS BETWEEN     PRINT INVENTORY WITH
         BETWEEN          x AND y INCLUSIVE    AMOUNT BT 20, 100

         CONT             VALUE IS CONTAINED   PRINT INVENTORY WITH
         CONTAINING       ANYWHERE WITHIN      ITEM-NAME CONT
                          FIELD NAME           "RED"

         STARTING         VALUE IS CONTAINED   PRINT INVENTORY WITH
                          WITHIN AND STARTS    ITEM-NAME STARTING
                          FIELD NAME           "B"



									A-12







             PRINT ALL  field-1, field-2  OF  domain  WITH
                   record-selection-expression  SORTED BY  sort-key






             PRINT ALL ENMLAST, EMPN, PAY OF EMPLOYEES WITH
                   PAY GREATER-THAN "500" SORTED BY NAME





             PRINT ALL TYPE, PRICE, LOA OF YACHTS WITH
                   LOA > "35" AND PRICE > "2000" SORTED BY TYPE



									A-13



	Collection

	A subset of a domain formed with the FIND command.  You can
	refer to a collection just like a domain until you replace
	it with another collection, RELEASE it, FINISH the domain,
	or EXIT DATATRIEVE.  Example A-14.



	FIND

	Establishes a collection of records from a domain or a col-
	lection.  The collection formed with the FIND command has a
	special name of CURRENT.  Example A-14.



	CURRENT

	The most recently formed collection.  A new collection replaces
	an old one as the current collection.



        FINISH

	Ends control over domains and any collections formed from that 
	domain.



	RELEASE

	Ends control over one or more collections.



									A-14






         FIND  collection-name  IN  domain-name  WITH
                record-selection-expression  SORTED BY  sort-key






         FIND ACCOUNTANTS IN EMPLOYEES WITH DEPARTMENT = "ACCOUNTS" -
                SORTED BY NAME

         PRINT ALL NAME, EMPLOYEE-NUMBER OF ACCOUNTANTS





         FIND BIG-BOATS IN YACHTS WITH LOA > "35" AND BEAM GT "12" -
                SORTED BY LOA

         PRINT ALL TYPE, PRICE, LOA, BEAM OF BIG-BOATS

