home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / db3retxt.zip / DB3REF11.TXT
Text File  |  1989-03-20  |  29KB  |  959 lines

  1. REFERENCE NOTES FOR dBASE III version 1.1
  2. -----------------------------------------
  3.  
  4. R E F E R E N C E - dBASE III
  5. -----------------------------
  6.  
  7. @...GET...RANGE
  8.  
  9. RANGE is used in conjunction with @...GET to specify an
  10. acceptable continuous set of input values to date or numeric
  11. fields.  The RANGE is initialized by specifying lower and upper
  12. bounds (inclusive) which may be literal values, memory variables,
  13. or expressions.  For example:
  14.  
  15.      1) Literal values:
  16.  
  17.           @ 10,10 GET var1  RANGE 1,9
  18.           @ 11,10 GET mdate RANGE CTOD('12/12/84'),CTOD('12/12/85')
  19.  
  20.      2) Memory variables:
  21.  
  22.           STORE 1 TO low
  23.           STORE 9 TO high
  24.           @ 10,10 GET var1 RANGE low,high
  25.  
  26.           STORE CTOD('12/12/84') TO low_date
  27.           STORE CTOD('12/12/85') TO high_date
  28.           @ 10,10 GET mdate RANGE low_date,high_date
  29.  
  30.      3) Expressions:
  31.  
  32.           @ 10,10 GET var1  RANGE low+365,high+(365*10)
  33.           @ 11,10 GET mdate RANGE DATE(),high_date+120
  34.  
  35. Entries outside of the defined range will generate an error
  36. message and input will be prompted until a valid entry is made.
  37.  
  38.  
  39.  
  40. @...GET...PICTURE
  41.  
  42. Assuming a memvar is initialized with zero (that is, memvar = 0),
  43. when the user types a period at an @...GET memvar PICTURE
  44. "9999.99", dBASE will proceed to the next command line.  This
  45. will not occur when the memory variable is initialized to two
  46. decimal places (that is, memvar = 0.00).  Only the integer
  47. portion of the number just entered will be stored to memvar if
  48. the period is typed.
  49.  
  50.  
  51.  
  52. @...SAY...PICTURE
  53.  
  54. To display a dollar-sign character ("$") in front of a numeric
  55. value and not have the possibility of a lot of "$"s filling the
  56. blank areas, do the following:
  57.  
  58.      * ---To display a single "$".
  59.      STORE 123.56 TO num
  60.      @ 10,10 SAY "$"
  61.      @ 10,11 SAY num PICTURE "99,999.99"
  62.  
  63.      This will generate:
  64.  
  65.                $  123.56
  66.  
  67.      * ---The other option available is:
  68.      STORE 123.56 TO num
  69.      @ 10,10 SAY num PICTURE "$$,$$$.$$"
  70.  
  71.      This will generate:
  72.  
  73.               $$$123.56
  74.  
  75.  
  76. @...SAY using relative addressing
  77.  
  78. We use the '$' function in dBASE II to control relative screen
  79. addressing with the @...SAY function.  For example, we can have a
  80. command file print the contents of a datafile to the screen as
  81. follows:
  82.  
  83. * ---This is dBASE II syntax.
  84. USE <datafile>
  85. DO WHILE .NOT. EOF
  86.    *
  87.     @ 5,  5 SAY <Field1>
  88.    @ $+1,$ SAY <Field2>
  89.    @ $+1,$ SAY <Field3>
  90.    @ $+1,$ SAY <Field4>
  91.     SKIP
  92.    *
  93.    ENDDO [while .not. eof]
  94.  
  95. The dBASE III utility, dCONVERT, is used to convert dBASE II
  96. programs, datafiles, etc. to dBASE III formats.  dCONVERT does
  97. not change the '$' function to ROW() and COL(); it leaves it
  98. alone.  However, this will not cause any problems when executing
  99. the code in dBASE III.  dBASE III will treat the '$' function as
  100. a relative addressing function.
  101.  
  102.  
  103.  
  104.  
  105. APPEND FROM <filename> [SDF/DELIMITED [WITH <delimiter>]]
  106.  
  107. The DELIMITED form of the APPEND FROM command should be
  108. documented as having a WITH clause.  WITH is not mentioned
  109. in the reference section.  Below are a few examples:
  110.  
  111.  
  112. Example 1. To read a comma delimited file in which the
  113.            character strings are enclosed in double quotes:
  114.  
  115.            APPEND FROM <filename> DELIMITED
  116.         or
  117.            APPEND FROM <filename> DELIMITED WITH "
  118.  
  119.  
  120. Example 2. To read a comma delimited file in which the
  121.            character strings are enclosed in single quotes:
  122.  
  123.            APPEND FROM <filename> DELIMITED WITH '
  124.  
  125.  
  126. Example 3. To read a comma delimited file in which the
  127.            character strings are not enclosed at all:
  128.  
  129.            dBASE III CANNOT READ A FILE OF THIS FORMAT!
  130.  
  131.  
  132. Also, the syntax of the APPEND command does not include a WHILE
  133. option as the manual indicates.  The correct syntax is
  134.  
  135.      APPEND FROM <file name> [FOR <condition>]
  136.             [SDF/DELIMITED [WITH <delimiter>]]
  137.  
  138.  
  139.  
  140. --End--
  141.  
  142.  
  143.  
  144. R E F E R E N C E - dBASE III
  145. -----------------------------
  146.  
  147. COPY TO <filename> [SDF/DELIMITED [WITH <delimiter>]]
  148.  
  149. (1) COPY TO <filename> DELIMITED does not enclose logical fields
  150. with the specified delimiters.   Numeric and date fields are also
  151. treated this way.  Date fields go out in the format YYYYMMDD.
  152.  
  153.  
  154. (2) COPY TO <filename> DELIMITED WITH , encloses the character
  155. fields in commas and separates the fields with another comma.
  156. This command behaves differently from dBASE II as shown below:
  157.  
  158.       In dBASE II:
  159.  
  160.           . USE file1
  161.           . COPY TO file2 DELIMITED WITH ,
  162.  
  163.      will result in:
  164.  
  165.           SANTA,CLAUS,NORTH POLE,ALASKA
  166.  
  167.  
  168.       In dBASE III:
  169.  
  170.           . USE file1
  171.           . COPY TO file2 DELIMITED WITH ,
  172.  
  173.      will result in:
  174.  
  175.           ,SANTA,,,CLAUS,,,NORTH POLE,,,ALASKA,
  176.  
  177.  
  178.  
  179. COPY FILE <source filename> TO <target filename>
  180.  
  181. The COPY FILE command copies files in 512 byte blocks; whereas,
  182. the COPY TO command will copy a .DBF file until the end-of-file.
  183. Therefore, the COPY FILE command will usually create a slightly
  184. larger file than the COPY TO command.  However, the COPY FILE is
  185. faster.
  186.  
  187.  
  188.  
  189. COPY STRUCTURE EXTENDED
  190.   CREATE FROM
  191.  
  192. COPY STRUCTURE EXTENDED and CREATE FROM are fully implemented in
  193. dBASE III although not documented.  A brief description is given
  194. below.
  195.  
  196.      1) COPY STRUCTURE EXTENDED creates a file in which the field
  197.      names become the contents of one record.  The syntax for
  198.      this COPY option is:
  199.  
  200.           COPY STRUCTURE EXTENDED TO <new file>
  201.  
  202.      2) CREATE FROM forms a new database (.DBF) file in which the
  203.      structure is determined by the contents of a file created
  204.      with COPY STRUCTURE EXTENDED.  The syntax is:
  205.  
  206.           CREATE <new file> FROM <structure extended file>
  207.  
  208.  
  209. Date conversion from dBASE II
  210.  
  211. The dBASE BRIDGE manual (pages 23-24) lays out an elaborate
  212. scheme for converting dBASE II "dates" to dBASE III date fields.
  213. A much easier way is to simply convert the dBASE II database file
  214. to a dBASE III file and modify the structure from character to
  215. date field.  All dates stored in a dBASE II character field as
  216. "MM/DD/YY" will directly convert to a dBASE III date field.
  217.  
  218.  
  219. Dates that are blank
  220.  
  221. CTOD() and DTOC() are intended to be inverse functions.  That is,
  222. if DTOC(date) = char, then CTOD(char) = date.  This is true in
  223. all circumstances except when the date is blank and the character
  224. string is " / / ".  To detect a blank date, you must use the
  225. DTOC() function rather than CTOD().  For example:
  226.  
  227. reg_date = CTOD("11/09/84")
  228. ? reg_date = CTOD("11/09/84")
  229. .T.
  230. ? DTOC(reg_date) = "11/09/84"
  231. .T.
  232. * ---With a blank date the following occurs:
  233. blank_date = CTOD("  /  /  ")
  234. ? blank_date = CTOD("  /  /  ")
  235. .F.
  236. ? DTOC(blank_date) = "  /  /  "
  237. .T.
  238.  
  239. As is evident from the example, the blank date is handled
  240. differently than the non-blank date.
  241.  
  242.  
  243. DISPLAY and LIST
  244.  
  245. The DISPLAY and LIST commands are documented in the manual as not
  246. having a FIELDS clause as part of the syntax, while the ASSIST
  247. and HELP menu options assume the FIELDS clause is required.
  248. dBASE III will accept either syntax for these two commands.
  249.  
  250.  
  251. FILE() function
  252.  
  253. The FILE() function only searches the current directory.  SET
  254. PATH TO does not affect this function.  If other directories are
  255. to be searched, they must be supplied to the function.  For
  256. example,
  257.  
  258.      * ---This will not find Data.dbf, if Data.dbf is in the
  259.      * ---subdirectory ACCTS.
  260.      SET PATH TO \DBASE\ACCTS
  261.      IF FILE( "DATA.DBF" )
  262.         DO Process
  263.      ENDIF
  264.  
  265. Workaround:
  266.  
  267.      * ---This method will work.
  268.      mpath = "\DBASE\ACCTS\"
  269.      SET PATH TO &mpath
  270.      IF FILE( mpath + "DATA.DBF" )
  271.         DO Process
  272.      ENDIF
  273.  
  274.  
  275. --End--
  276.  
  277.  
  278. R E F E R E N C E - dBASE III
  279. -----------------------------
  280.  
  281.  
  282. FIND
  283.    SEEK
  284.  
  285. FIND and SEEK are both used to move the record pointer of an
  286. indexed database to the first instance of the index key that
  287. matches the search argument.  FIND searches on a literal
  288. character string while SEEK searches on an expression the value
  289. of which may be character, date, or numeric.
  290.  
  291. The proper choice of command is related to the context and data
  292. type of the index key.  Generally, FIND will only be used to
  293. search for a literal character string and SEEK for all other
  294. searches. The following are some typical cases:
  295.  
  296.      (1) You have an index key that is character and are
  297.          working from the dot prompt:
  298.  
  299.               . FIND Lee
  300.        {or}   . SEEK "Lee"
  301.  
  302.  
  303.      (2) You have an index key that is numeric or date and
  304.          are working from the dot prompt:
  305.  
  306.               . SEEK 1250
  307.               . SEEK CTOD('12/12/85')
  308.  
  309.  
  310.      (3) You are working within a command file and are
  311.          initializing a memory variable as a search key:
  312.  
  313.               STORE SPACE(10) TO skey
  314.               @ 10,10 SAY 'Enter value to search for' GET skey
  315.               READ
  316.               SEEK skey
  317.  
  318.  
  319.      (4) You have a database field that is character, Code, and
  320.          the contents are numeric digits and right-justified:
  321.  
  322.               ACCEPT 'Enter code to search for' to skey
  323.               SEEK SPACE(LEN(Code) - LEN(skey)) + skey
  324.  
  325.  
  326.      (5) You are working with several databases and want to
  327.          search for a key value in the current work area using a
  328.          field variable from a non-active area with an alias
  329.          name:
  330.  
  331.                SELECT 1
  332.                USE File1 INDEX File1
  333.                SELECT 2
  334.                USE File2 INDEX File2
  335.                SELECT File1
  336.                SEEK File2->Field1
  337.  
  338.  
  339.  
  340. Function Keys
  341.  
  342. F1 toggles the cursor control menu on and off in the following
  343. full screen edit modes.
  344.  
  345.      APPEND    EDIT      MODIFY LABEL        MODIFY STRUCTURE
  346.      BROWSE    CHANGE    MODITY REPORT
  347.  
  348.  
  349.  
  350. INPUT
  351.  
  352. The INPUT command does not initialize a memory variable of any
  353. type if <RETURN> is pressed at its prompt.  The dBASE III manual
  354. says this will produce a syntax error (page 4-58).  What really
  355. happens is that a syntax error will result if the non-existent
  356. memvar is later referenced.
  357.  
  358.  
  359.  
  360. MEMO fields
  361.  
  362. (1) MEMO fields are used to contain up to 5,000 characters of
  363. text information that is to be associated with a database record.
  364. Information may be read into a MEMO field using Ctrl-K-R and
  365. written to text files using Ctrl-K-W. Information from MEMO
  366. fields can be displayed or printed by using LIST, DISPLAY, ?.
  367. The field must be specified  with these commands.  However, these
  368. commands cause the MEMO field to wrap at 50 columns.  The REPORT
  369. FORM may be used to output MEMO fields with line widths of more
  370. or less than 50 characters.
  371.  
  372. (2) PACKing a database file with memo fields will not decrease
  373. the amount of disk space used by the .DBT file.  The command file
  374. below demonstrates how to remove the deleted records and free the
  375. unused disk space.
  376.  
  377.           SET DELETED ON
  378.           USE Filea
  379.           COPY TO Temp
  380.           CLOSE DATABASE
  381.           ERASE Filea.dbf
  382.           ERASE Filea.dbt
  383.           RENAME Temp.dbf TO Filea.dbf
  384.           RENAME Temp.dbt TO Filea.dbt
  385.           SET DELETED OFF
  386.  
  387.  
  388.  
  389. MODIFY STRUCTURE
  390.  
  391. In MODIFY STRUCTURE, Ctrl-Home will bring up a menu on line 0 with
  392. the four choices listed below.
  393.  
  394.      Bottom        Top       Field #     Menu
  395.  
  396. They are selected with cursor control keys and <RETURN>.
  397. Bottom moves the cursor to the last field, Top to the first.
  398. Field # allows selection of a field number, then moves the
  399. cursor to it.  Menu toggles the cursor control menu off and
  400. on.  This feature is not documented under MODIFY STRUCTURE.
  401.  
  402.  
  403. MODIFY STRUCTURE
  404.  
  405. The "Warning" in the documentation on page 4-73 of dBASE III
  406. version 1.00 and WARNING of page 4-80 of dBASE III version 1.10
  407. should read as follows:
  408.  
  409.      WARNING: Although you may change field names and field
  410.      lengths, if you change both at once, the data of the
  411.      fields that have been modified will not be appended
  412.      into the new structure.
  413.  
  414. Note that in the ASSIST mode, the following screen message is not
  415. entirely true, "Information in the database file is preserved
  416. where field names remain the same."  As noted above, if only
  417. field names are changed or only the length, the data is appended
  418. into the new structure.  The correct procedure when both field
  419. name(s) and field length(s) need to be changed, is to modify the
  420. field name(s) first, and then re-enter MODIFY STRUCTURE and
  421. modify the field length(s).
  422.  
  423. Also, note that deleting a field (with Ctrl-U) has the same
  424. effect as modifying the field length.  Therefore, make deletions
  425. at the same time you make field length changes.
  426.  
  427.  
  428. --End--
  429.  
  430.  
  431.  
  432. R E F E R E N C E - dBASE III
  433. -----------------------------
  434.  
  435. Numeric fields with decimal places
  436.  
  437. Although not documented, dBASE III expects the user to allow for
  438. a leading digit and a decimal point on numeric fields containing
  439. decimal places.  For example, a numeric field of two decimal
  440. places should not be defined any smaller than four digits in
  441. length--one position for the leading digit, one position for the
  442. decimal point, and two positions for the two decimal places.
  443.  
  444. If the structure for a numeric field does not allow for a leading
  445. digit (such as, a width of three and two decimal places), numeric
  446. input to the numeric field will always be stored as zero.  Also,
  447. if other numeric fields follow this field, they might
  448. automatically be zeroed out when numeric data is entered to the
  449. first field.
  450.  
  451.  
  452. Numeric input of large numbers
  453.  
  454. If a variable is initialized to zero, dBASE III does not allow
  455. input larger than 10 digits when using the @...GET command, even
  456. if the PICTURE clause is used.  For example:
  457.  
  458. x = 0
  459. @ 5,5 SAY "Enter digits" GET x PICTURE "99999999999"
  460.    (There are eleven 9's) ----------^
  461. READ
  462.  
  463. The display is:
  464.  
  465.             Enter digits           0
  466.  
  467. If an eleven digit value is entered, the display is:
  468.  
  469.             Enter digits  **********  (10 asterisks)
  470.  
  471. This can be avoided by initializing 'x' to a value greater than
  472. ten digits (such as, 1000000000).  This problem does not occur if
  473. a field is used rather than a memory variable.
  474.  
  475.  
  476. PARAMETERS, passing Fields
  477.  
  478. (For a manual update, see the TechNotes "Policies" section.)
  479. In the documentation concerning PARAMETERS when used in
  480. conjunction with the DO <filename> [WITH <parameter list>]
  481. command, page 4-76 of the version 1.0 manual states, "A passed
  482. parameter may be any legitimate expression."  Also, in the
  483. Glossary (page 7-3) the definition for Expression is, "Expression
  484. may consist of a field, a memory variable, a function, a
  485. constant, or any combination thereof."  However, when a DO is
  486. invoked with a field in the parameter list, dBASE III will give
  487. the message, "Variable not found."
  488.  
  489. In order to use a field name in the parameter list, you must use
  490. the Alias -> Fieldname form.  For example:
  491.  
  492.                USE Filea
  493.                DO <Filename> WITH Filea -> Field1
  494.  
  495. will work, but the following will not.
  496.  
  497.                USE Filea
  498.                DO <Filename> WITH Field1
  499.  
  500.  
  501. --End--
  502.  
  503.  
  504.  
  505. R E F E R E N C E - dBASE III
  506. -----------------------------
  507.  
  508.  
  509. PRIVATE
  510.  
  511. In dBASE III, all variables are PRIVATE to the routine in which
  512. they are initialized unless otherwise declared.  Variables
  513. created at the dot prompt will automatically be PUBLIC no matter
  514. how they are declared.
  515.  
  516. Declaring a variable PRIVATE in a command file hides any outer-
  517. level definition of a variable with the same name from the
  518. current routine.  It also hides any deeper-level routines from
  519. viewing any outer-level definition of a variable with the same
  520. name.  In the example below, programs B.PRG and C.PRG do not have
  521. access to variable X in program A.PRG.  Program C.PRG, therefore,
  522. will display X with a value of 15 and not 10.  Program A.PRG,
  523. however, will display X with the old value of 10 even after
  524. executing program B.PRG.
  525.  
  526.      * A.PRG
  527.      x = 10
  528.      DO B    ----------> * B.PRG
  529.      ? x                 PRIVATE x
  530.      RETURN              x = 15
  531.                          DO C    ----------> * C.PRG
  532.                          RETURN              ? x
  533.                                              RETURN
  534.  
  535. In programming, you will want to declare a variable PRIVATE in a
  536. subroutine if you do not want this variable to interfere with an
  537. outer-level variable having the same name.
  538.  
  539. To illustrate the use of PRIVATE, the command files MAIN.PRG and
  540. SUB.PRG are listed below, with the displayed output.  Notice that
  541. all the variables are released when MAIN.PRG returns control to
  542. the dot prompt.  Also notice that the variables initialized in
  543. MAIN.PRG are PRIVATE in the memory display even though they are
  544. never explicitly declared.  Lastly, notice that the value
  545. assigned to  height  in SUB.PRG  is not  returned to MAIN.PRG, but
  546. the value assigned to  area  in SUB.PRG  is  returned.  This is
  547. because  height  is declared PRIVATE in SUB.PRG and  area  is not.
  548.  
  549.  
  550. LISTINGS:
  551.  
  552.      * MAIN.PRG
  553.      * --------
  554.      area = 0
  555.      height = 304
  556.      ? "Before call to SUB:"
  557.      ? "-------------------"
  558.      DISPLAY MEMORY
  559.      DO Sub    ------------------> * SUB.PRG
  560.      ? "After call to SUB:"        * -------
  561.      ? "------------------"        PRIVATE height
  562.      DISPLAY MEMORY                height = 30
  563.      RETURN                        area = 10 * 20 * height
  564.      * EOF: MAIN.PRG               ? "Inside SUB:"
  565.                                    ? "-----------"
  566.                                    DISPLAY MEMORY
  567.                                    RETURN
  568.                                    * EOF: SUB.PRG
  569.  
  570. OUTPUT:
  571.  
  572. Before call to SUB:
  573. -------------------
  574. AREA        priv  N           0  (         0.00000000)
  575. HEIGHT      priv  N         304  (       304.00000000)
  576.     2 variables defined,       18 bytes used
  577.   254 variables available,   5982 bytes available
  578.  
  579.  
  580. Inside SUB:
  581. -----------
  582. AREA        priv  N        6000  (      6000.00000000)
  583. HEIGHT      priv  (hidden)  N         304  (       304.00000000)
  584. HEIGHT      priv  N          30  (        30.00000000)
  585.     3 variables defined,       27 bytes used
  586.   253 variables available,   5973 bytes available
  587.  
  588.  
  589. After call to SUB:
  590. ------------------
  591. AREA        priv  N        6000  (      6000.00000000)
  592. HEIGHT      priv  N         304  (       304.00000000)
  593.     2 variables defined,       18 bytes used
  594.   254 variables available,   5982 bytes available
  595.  
  596.  
  597.  
  598. When DISPLAY MEMORY is entered from the dot prompt the following
  599. two lines will display:
  600.  
  601.     0 variables defined,        0 bytes used
  602.   256 variables available,   6000 bytes available
  603.  
  604.  
  605. >>> PROCEDURE
  606.  
  607. Calling Command Files from Procedures within dBASE III
  608. ------------------------------------------------------
  609.  
  610. To call a command file from a procedure, you must follow a few
  611. rules.
  612.  
  613. Rule 1:
  614.  
  615. The command file cannot have the same name as any of the
  616. procedures in the file even if the extension is included as part
  617. of the filename.  An attempt to do this will cause the
  618. inappropriate error message, "Unrecognized phrase/keyword in
  619. command."  For example:
  620.  
  621.      * Proc_One.PRG
  622.      PROCEDURE One
  623.         * ---The next command will not work because
  624.         * ---Two is a procedure in this file.
  625.         DO Two.PRG
  626.      RETURN
  627.      *
  628.      PROCEDURE Two
  629.         * ---The next command will work.
  630.         DO Three.PRG
  631.      RETURN
  632.      * EOF: Proc_One.PRG
  633.  
  634. This can be avoided by renaming either the command file or
  635. procedure.  To avoid this problem you might want to begin
  636. procedure names with a prefix that command files will not have.
  637. For instance, in the previous example the procedures could have
  638. been called P_One and P_Two.
  639.  
  640. Rule 2:
  641.  
  642. Once the command file is invoked from a procedure file, it must
  643. not DO another procedure in the procedure file.  Instead, it
  644. should RETURN to the calling procedure.  Otherwise, the called
  645. procedure will usually execute, but an error message will be
  646. displayed for a command line that does not exist.
  647.  
  648. Rule 3:
  649.  
  650. Internal procedure calls (that is, a procedure that calls either
  651. itself or another procedure in the same file) must be kept to
  652. eighteen nested calls or less.  The nineteenth call attempt will
  653. return execution to the calling command file with no error
  654. message.
  655.  
  656.  
  657. PUBLIC
  658.  
  659. PUBLIC is used to declare memory variables as global and to
  660. prevent their release when control is returned to the dot prompt.
  661.  
  662. PUBLIC variables must be declared prior to being initialized, and
  663. once declared, these variables will be assigned a logical false
  664. value until initialized.  PUBLIC variables can be re-declared as
  665. PUBLIC without losing the values already stored in them.
  666.  
  667. In programming, declaring all variables as PUBLIC in the main
  668. routine would make dBASE III behave similar to dBASE II.
  669. However, there is one difference in dBASE III, PUBLIC variables
  670. can only be released by the CLEAR MEMORY, CLEAR ALL, and RELEASE
  671. <variable list> commands, but not the RELEASE ALL command.
  672.  
  673.  
  674.  
  675. RELEASE ALL
  676.    CLEAR MEMORY
  677.  
  678. RELEASE ALL and CLEAR MEMORY are not equivalent commands as the
  679. dBASE III manual states.  CLEAR MEMORY clears all memory
  680. variables, regardless where they were initialized.  RELEASE ALL,
  681. however, will release all memory variables except those declared
  682. PUBLIC or initialized in a nested command file.
  683.  
  684.  
  685.  
  686. REPLACE
  687.  
  688. REPLACE ALL does not replace all records correctly if an index is
  689. in use and the key field is replaced.  Only the first record and
  690. those that logically follow the new value will be replaced.  This
  691. occurs because the index is automatically updated (in-place key
  692. updating) when it is edited.  The record pointer moves to the
  693. record following the new position, not to the record following
  694. the old position.  This can be illustrated in the example given
  695. below (the data file has five records with the field CHARS-C-1,
  696. and is indexed on this field):
  697.  
  698.           . LIST
  699.           Record#  CHARS
  700.                 1  a
  701.                 2  b
  702.                 3  c
  703.                 4  i
  704.                 5  j
  705.  
  706.           . REPLACE ALL Chars WITH 'd'
  707.                 3 records replaced
  708.           . LIST
  709.                 2  b
  710.                 3  c
  711.                 1  d
  712.                 4  d
  713.                 5  d
  714.  
  715. The manual warns against block replacements to the key field.
  716. The correct procedure would be to REPLACE with no indexes in use,
  717. open the indexes with SET INDEX TO, and then REINDEX.
  718.  
  719.  
  720.  
  721. REPORT FORM
  722.   MODIFY REPORT
  723.  
  724. (1) The report generator will right-justify field headings for
  725. numeric fields when the report is run.
  726.  
  727. (2) If the PLAIN clause is specified with REPORT FORM TO PRINT,
  728. no page ejects occur.  The report prints through to the end
  729. without page breaks.
  730.  
  731. (3) MODIFY REPORT will allow the number of decimal places to be
  732. changed from the default.  If this is done and the report is
  733. run, everything is as expected.  However, if the report is
  734. modified again, the number of decimal places reverts to the
  735. default when the cursor reaches the "# decimal places" field.
  736.  
  737. (4) Although not documented in the manual or in the cursor
  738. control menu, Ctrl-N inserts a column in a report being created
  739. or modified.  However, its counterpart (Ctrl-U which deletes a
  740. column) is documented and included in the help menu.
  741.  
  742.  
  743. --End--
  744.  
  745.  
  746.  
  747. R E F E R E N C E - dBASE III
  748. -----------------------------
  749.  
  750.  
  751. Reserved words
  752.  
  753. Page 1-138 of the tutorial in the first edition f te mnua
  754. uses a sample routine which creates a memory vrible ith he
  755. name 'continue.' Since this is a reserved wod, BAE II wil
  756. give the message, "No database in USE, enter filenam."  dBASE
  757. III is assuming you intend to CONTINUE on a LOCATE command.
  758. This will only happen if you use the <variable> = <value> form of
  759. assignment; dBASE III will execute correctly when you use the
  760. STORE <value> TO <variable> form.  Other words that will not work
  761. with the first syntax are: AVERAGE, COUNT, and SUM.
  762.  
  763.  
  764.  
  765. ROW()
  766.    COL()
  767.  
  768. After a READ, the ROW() function always returns 24; however, the
  769. COL() function does not change.  For example:
  770.  
  771.      SET TALK OFF
  772.      var = SPACE(2)
  773.      @ 5,40 GET var
  774.      ? ROW(), COL()      <--- This returns 6 and 3.
  775.      READ
  776.      ? ROW(), COL()      <--- This returns 24 and 3.
  777.  
  778.  
  779.  
  780. RUN (or !)
  781.  
  782. The RUN command requires that COMMAND.COM be in the boot drive or
  783. the directory indicated by SET COMSPEC.  Otherwise, the incorrect
  784. error message "Insufficient memory" is displayed.
  785.  
  786.  
  787. RUN COMMAND
  788.  
  789. You can get the equivalent to Framework's DOS Access in dBASE III
  790. by issuing RUN COMMAND.  This will leave you at the DOS operating
  791. system level, and will allow you to enter any DOS commands. To
  792. get back to the dBASE III dot prompt, type EXIT.
  793.  
  794.  
  795. SET ALTERNATE TO
  796.  
  797. dBASE III will not send a linefeed (that is, CHR(10)) to an
  798. alternate file (Word Perfect looks for this linefeed character in
  799. its mail merge program).  The following command file:
  800.  
  801.      SET ALTERNATE TO x
  802.      SET ALTERNATE ON
  803.      ?? "first LF"
  804.      ?? CHR(10)
  805.      ?? "second LF"
  806.      SET ALTERNATE OFF
  807.      CLOSE ALTERNATE
  808.  
  809. will generate the following test file:
  810.  
  811.      first LFsecond LF
  812.  
  813. As you can see, there is no linefeed in the file.
  814.  
  815. SET CONSOLE ON/OFF
  816.  
  817. The SET CONSOLE ON/OFF command behaves differently in dBASE III
  818. than it does in dBASE II.  Specifically, it has no effect when
  819. issued at the dot prompt, and if SET CONSOLE OFF is issued in a
  820. command file that neglects to SET CONSOLE ON, dBASE III will
  821. automatically set the console back on upon the termination of
  822. execution of that file.  This includes normal termination as well
  823. as termination by means of pressing the escape key.
  824.  
  825.  
  826.  
  827. SET MENUS ON/OFF
  828.  
  829. The default for SET MENUS is OFF.  However, ASSIST leaves MENUS
  830. SET ON even if they were off prior to entering ASSIST.
  831.  
  832.  
  833.  
  834. SET PROCEDURE TO
  835.   PARAMETERS, PROCEDURE
  836.  
  837. The following program and procedure files illustrate the use of
  838. parameter passing with procedures.  FUTVALUE.PRG calculates the
  839. future value of an investment and the future value of an annuity
  840. with the use of the BUSINESS.PRG procedure file.  Notice how the
  841. parameters can be passed to BUSINESS.PRG.  They can either be
  842. literal numbers, expressions, or variables.  Also, notice that
  843. the PARAMETERS command is included after each PROCEDURE that
  844. receives parameters.
  845.  
  846.  
  847. LISTINGS:
  848.  
  849.      * FUTVALUE.PRG
  850.      * ------------
  851.      SET TALK OFF
  852.      SET FIXED ON
  853.      SET PROCEDURE TO  Business
  854.      *
  855.      * { Calculate future value of an investment }
  856.      result = 0.00
  857.      DO  FV  WITH  6000.00, 8.5, 4, 5, result
  858.      ? result
  859.      *
  860.      * { Calculate future value of regular deposits (Annuity) }
  861.      result = 0.00
  862.      DO  FVA  WITH  150.00, 7.0, 12, 2, result
  863.      ? result
  864.      *
  865.      CLOSE PROCEDURE
  866.      SET FIXED OFF
  867.      SET TALK ON
  868.      RETURN
  869.      * EOF: FUTVALUE.PRG
  870.  
  871.  
  872.      * BUSINESS.PRG  { Library of business procedures }
  873.      * ------------
  874.      *
  875.       PROCEDURE  FV  { Calculate future value of an investment }
  876.       PARAMETERS  amount, rate, periods, years, result
  877.        rate = rate / periods / 100
  878.        result = amount * (1 + rate) ^ (periods * years)
  879.        result = ROUND( result, 2 )
  880.       RETURN
  881.      *
  882.       PROCEDURE  FVA  { Calculate future value of regular deposits }
  883.       PARAMETERS  amount, rate, periods, years, result
  884.        rate = rate / periods / 100
  885.        result = amount * ( (1 + rate) ^ (periods *;
  886.                   years) - 1 ) / rate
  887.        result = ROUND( result, 2 )
  888.       RETURN
  889.      *
  890.      * EOF: BUSINESS.PRG
  891.  
  892.  
  893. OUTPUT:
  894.  
  895.       9136.77
  896.       3852.15
  897.  
  898.  
  899.  
  900. --End--
  901.  
  902. INDEX OF TOPICS    R E F E R E N C E - dBASE III
  903. Select   Topic
  904. ------   ---------------------------------------
  905. 1.       @...GET...RANGE
  906.          @...GET...PICTURE
  907.          @...SAY...PICTURE
  908.          @...SAY using relative addressing
  909.          APPEND FROM [SDF/DELIMITED [WITH <delimiter>]]
  910.  
  911. 2.       COPY TO <filename> [SDF/DELIMITED [WITH <delimiter>]]
  912.          COPY FILE <source filename> TO <target filename>
  913.          COPY STRUCTURE EXTENDED
  914.            CREATE FROM
  915.          Date conversion from dBASE II
  916.          Dates that are blank
  917.          DISPLAY and LIST
  918.          FILE() function
  919.  
  920. 3.       FIND
  921.            SEEK
  922.          Function Keys
  923.          INPUT
  924.          MEMO fields
  925.          MODIFY STRUCTURE
  926.  
  927. 4.       Numeric fields with decimal places
  928.          Numeric input of large numbers
  929.          PARAMETERS, passing fields
  930.  
  931. 5.       PRIVATE
  932.          PROCEDURE  - Calling Command Files from Procedures
  933.          PUBLIC
  934.          RELEASE ALL
  935.            CLEAR MEMORY
  936.          REPLACE
  937.          REPORT FORM
  938.            MODIFY REPORT
  939.  
  940. 6.       Reserved words
  941.          ROW()
  942.            COL()
  943.          RUN (or !)
  944.          RUN COMMAND.COM
  945.          SET ALTERNATE TO
  946.          SET CONSOLE ON/OFF
  947.          SET MENUS ON/OFF
  948.          SET PROCEDURE TO
  949.            PARAMETERS, PROCEDURE
  950.  
  951. 7.       SET RELATION TO <expression> INTO <alias>
  952.          SET UNIQUE ON/OFF
  953.          Warning against using a dBASE III file with dBASE II
  954.  
  955.  
  956.  
  957. --End--
  958.  
  959.