home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / a / dbtips.lbr / DBANOM.NZE / DBANOM.NTE
Encoding:
Text File  |  1993-10-26  |  33.1 KB  |  941 lines

  1. dBASE II: A N O M A L I E S   I N D E X
  2. =======================================
  3. Menu Choice   Item
  4. --------------------------------------
  5.  
  6.    1     Instructions
  7.  
  8.    2     @...GET and numeric overflow
  9.          @...GET...PICTURE with 9 or #
  10.          @...SAY and relative addressing
  11.          @...SAY past 128 lines
  12.          @...SAY with the substring ($) function
  13.          @...SAY with uninitialized variable
  14.          Sending @...SAYs to the Printer
  15.          APPEND SDF large records
  16.          APPEND with large numeric fields
  17.  
  18.    3     CHANGE and the Esc key
  19.          COPY STRUCTURE
  20.          DELETE ALL / PACK and ghost field values
  21.          DISPLAY RECORD <number> with INDEX
  22.          DO WHILE at byte 257
  23.          DO WHILE using Boolean expressions
  24.          EDIT after a NO FIND
  25.  
  26.    4     EOF
  27.          File Structure corruption
  28.          FILE() function
  29.          Ignored commands after OTHERWISE and ELSE
  30.          INDEX
  31.          INDEX balancing
  32.          INDEX ON
  33.  
  34.    5     INDEXing with $ (substring) function
  35.          INSERT BLANK
  36.          JOIN
  37.          JOIN, repeated use of
  38.          Memory variable corruption
  39.          Memory variables with long names
  40.          Memory variables, Changing data types of
  41.  
  42.    6     MODIFY STRUCTURE and header corruption
  43.          MODIFY STRUCTURE procedures
  44.          Parentheses Limitations
  45.          QUIT TO on Wang PC
  46.          QUIT TO with an ALTERNATE file open
  47.          READ resetting the EOF flag
  48.          REINDEX on a database file with no index
  49.          REPLACE ALL
  50.  
  51.    7     REPLACE and deleted records
  52.          REPORT FORM and SET DELETED ON or OFF
  53.          REPORT FORM with SET MARGIN TO
  54.          REPORT FORM, numeric overflow on large reports
  55.          SET FORMAT TO <filename> and EDIT
  56.          SET MARGIN TO
  57.          Sidekick and dBASE II incompatibility
  58.  
  59.    8     SKIP with SET DELETED ON
  60.          SORT changing the record count
  61.          SUM with no records
  62.          TEXT...ENDTEXT
  63.          TOTAL command with FOR expression
  64.          VAL() changes the type of a large numeric string
  65.  
  66. 1
  67.  
  68.  
  69.  The Anomalies section describes the known anomalies (nd possible
  70. work-arounds) reported to the Software Support Center during the
  71. previous month.  This information is gathered from customers who
  72. call or write to the Software Support Center, it is then tested
  73. by our technicians, and, finally, compiled in alphabetical order.
  74.  If you discover what you believe is an anomaly (as defined
  75. below) not presented in this report, please send us a detailed
  76. description of the possible anomaly so we can try to reproduce
  77. it.  If the reported anomaly can be reproduced by our
  78. technicians, it will be added to the next month's report.
  79.  
  80. We use the word "anomaly" to mean any one of the following:
  81.  
  82.      o  INCORRECT COMMAND (or function) IMPLEMENTATION.  A
  83.      command or function does not execute as specified.  An
  84.      example of this would be, if the INSERT command inserts a
  85.      record after the current record pointer, but fails to  move
  86.      the end-of-file marker when the file is rewritten.
  87.  
  88.      o  INCOMPLETE COMMAND (or function) IMPLEMENTATION.  A
  89.      command or function does not execute as specified in
  90.      every use of the command or function.  An example of
  91.      this would be, if the semicolon character does not
  92.      function as a continuation symbol for the DO WHILE
  93.      command, but it does operate properly when executing
  94.      any other command.
  95.  
  96.      o  DATA OR LOGICAL BOUNDARY LIMITATION.  A command or
  97.      function cannot perform an operation at a specified data or
  98.      logical boundary.  For example, if the APPEND FROM
  99.      <textfile> SDF does not append text lines with 998, 999, or
  100.      1000 characters per line.  However, appending text lines
  101.      with less than 998 characters will work.  Another example
  102.      would be, if repeated use of the JOIN command causes it to
  103.      fail.
  104.  
  105. The Software Support Center reserves the right to withhold
  106. further information pertaining to this section that may reveal
  107. proprietary or trade secret details.
  108.  
  109.  
  110. 2
  111.  
  112.  
  113.  >>> @...GET and numeric overflow
  114.  When using @...GET <fieldname> with a numeric field for data
  115. entry and numeric overflow occurs, the field blanks out and does
  116. not display asterisks as it does on version 2.4.  Upon
  117. redisplaying the @...GET <fieldname>, however, the asterisks will
  118. appear with a few numbers. Also, a LIST or DISPLAY of the
  119. fieldname will display zeroes and not asterisks.  If DISPLAY
  120. STRUCTURE is entered prior to using @...GET, the @...GET will
  121. behave as it does on version 2.4.
  122.  Two problems may occur with numeric overflow on input to a
  123. numeric field in an @...GET <fieldname> command:
  124.      1. The field will blank out instead of displaying
  125.      asterisks.
  126.      2. Pressing Return on subsequent numeric fields in the
  127.      same record will zero them out if they hold a value
  128.      greater than zero.
  129.  This can be illustrated in the command sequence below.  All the
  130. fields are numeric with a length of 5 and a decimal width of 2. A
  131. numeric overflow can be created by entering a number such as
  132. 55555 (no decimals).
  133.  
  134.     ERASE
  135.      @ 12,10 GET numfld1
  136.      @ 13,10 GET numfld2
  137.      @ 14,10 GET numfld3
  138.      @ 15,10 GET numfld4
  139.      READ
  140.      CLEAR GETS
  141.      LIST
  142.  
  143. Enter DISPLAY STRUCTURE prior to using the @...GET command and
  144. the above problems will not occur.
  145.  
  146. >>> @...GET...PICTURE with 9 or #
  147.  If an @...GET memvar PICTURE statement is used to get a
  148. character string of numbers with embedded periods and the PICTURE
  149. clause uses 9's or #'s, the periods are changed to spaces.  For
  150. example:
  151.  
  152.     STORE "11.22.33.44" TO mtest
  153.      @ 5,0 GET mtest PICTURE "99999999999"
  154.      READ
  155.      ? mtest
  156.  
  157. The GET statement will display "11 22 33 44".  After a <RETURN>
  158. at the READ statement, "? mtest" will also display the numbers
  159. without the periods.
  160.  
  161.  >>> @...SAY and relative addressing
  162.  The relative addressing feature that is used in conjunction with
  163. the @...SAY command does not keep track of the current screen
  164. position.  It simply remembers the coordinates immediately to the
  165. right of the last @...SAY and substitutes those coordinates for
  166. the "$" symbol.  That is, you do not get true relative screen
  167. addressing as can be seen in the following example:
  168.  
  169.      ERASE
  170.      @ 1,0 SAY "line1"
  171.      * The screen coordinates are (1,5).
  172.      ? "line2"
  173.      * The screen coordinates are (2,5).
  174.      ? "line3"
  175.      * The screen coordinates are (3,5).
  176.      ? "line4"
  177.      * The screen coordinates are (4,5), but the $ will be
  178.      * replaced by 1, the row coordinate of the last @
  179.      * command.
  180.      @ $,6 SAY "line5"
  181.  
  182. >>> @...SAY past 128 lines
  183.  When using @ row,col SAY, and row is a memory variable that is
  184. incremented past 128, formatting is thrown off.  Displays and
  185. printing no longer appear where they should.  This can be tested
  186. with the following program segment:
  187.  
  188.           SET FORMAT TO PRINT
  189.           STORE 1 TO row
  190.           DO WHILE row < 150
  191.              @ row, 1 SAY "ROW NUMBER " + STR( row, 3 )
  192.              STORE row + 1 TO row
  193.           ENDDO
  194.  
  195. >>> @...SAY with the substring ($) function
  196.  
  197.  Using the @...SAY command with the substring ($) function will
  198. not work properly if a numeric memory variable is used as the
  199. length argument to the function.  Specifically, only the first
  200. character of the string will be displayed  For example, the
  201. following set of commands will only display one "X" instead of
  202. five:
  203.  
  204.      STORE 5 TO length
  205.      @ 10,0 SAY $("XXXXXXXXXX",1,length)
  206.  
  207. There are several ways to work around this problem.  One is to
  208. use macro substitution.  For example:
  209.  
  210.      STORE "5" TO length
  211.      @ 10,0 SAY $("XXXXXXXXXX",1,&length)
  212.  
  213. A second is to STORE the result of the substring function to a
  214. memory variable, and SAY the memory variable.  For example:
  215.  
  216.      STORE 5 TO length
  217.      STORE $("XXXXXXXXXX",1,length) TO character
  218.      @ 10,0 SAY character
  219.  
  220.  
  221. >>> @...SAY with uninitialized variable
  222.  Attempting to @...SAY an uninitialized memory variable whose
  223. name begins with any of the letters T, F, Y, or N, will display a
  224. logical value at the specified coordinates rather than the error
  225. message "VARIABLE NOT FOUND." The logical value displayed will be
  226. T if the variable name begins with T or Y, and F if it begins
  227. with F or N.  For example:
  228.  
  229.    @ 10,0 SAY F
  230.  
  231. is equivalent to
  232.  
  233.     @ 10,0 SAY fixit
  234.  
  235. if 'fixit' does not exist as a field name or memory variable.
  236.  
  237. >>> Sending @...SAYs to the Printer
  238.  On the Osborne format of 2.43*, when sending @...SAYs to the
  239. printer, dBASE II will insert two blank spaces between each
  240. @...SAY printing to the same line. However, this does not occur
  241. when the @...SAYs are output to the screen.
  242.  
  243. For example:
  244.  
  245.      SET FORMAT TO PRINT
  246.      @ 3,1 SAY "Hello"
  247.      @ 3,7 SAY "there"
  248.  
  249.      Hello     there
  250.            ^----the second word should print here.
  251.  
  252. >>> APPEND SDF large records
  253.  One cannot APPEND a text file with 998, 999, or 1000 characters
  254. per record into a corresponding dBASE II file.  Any attempt to do
  255. this will append a blank record between each good record in the
  256. file.  Records of 997 characters will correctly append into a
  257. like structured file.
  258.  
  259. >>> APPEND with large numeric fields
  260.  In version 2.41, a numeric database field can be created with a
  261. length of up to 254 positions.  However, APPENDing or EDITing a
  262. numeric field of 60 or more digits in length may cause several
  263. errors.  When data is entered into this field, (1) the file
  264. structure may be overwritten with records from the database file,
  265. (2) the screen may fill up with garbage characters, (3) control
  266. may drop back to the operating system, or (4) the system may
  267. hang, requiring a warm boot or reset.
  268.  The largest number dBASE II can handle is one to the 63rd power.
  269. This means you may have a number as large as a one with 63 zeros
  270. after it. If all these were digits other than zero, only the
  271. first 10 digits would show the actual value.  The rest of the
  272. trailing digits would default to zero.
  273.  While dBASE II will allow you to create a numeric field that is
  274. apparently larger than the limitations given above, the field
  275. will not be usable.
  276.  
  277. 3
  278.  
  279.  >>> CHANGE and the Esc key
  280.  The Esc key is used to abort the CHANGE command, but if pressed
  281. in response to a numeric field, it will change the field to zero.
  282.  
  283. >>> COPY STRUCTURE
  284.  COPY STRUCTURE will not properly copy the record length, bytes 6
  285. and 7, of the header record to the new database file.  This
  286. anomaly will go unnoticed by most users, but if you happen to be
  287. reading the resultant file structure with another program, you
  288. will find that the header record contains a 20H in each of these
  289. positions.
  290.  To restore the correct record length after a COPY STRUCTURE,
  291. PACK the file.
  292.  
  293. >>> DELETE ALL / PACK and ghost field values
  294.  If a database file is purged with a DELETE ALL and PACK, any
  295. query on the field names will give the field values for what used
  296. to be the last record in the file.  The only way to avoid these
  297. "ghost" field values is to ascertain that there are records in
  298. the file before querying the field names.  For example:
  299.  
  300.      USE <filename>
  301.      IF .NOT. EOF
  302.         ? Field1, Field2
  303.      ELSE
  304.         ? "There are no records in this file."
  305.      ENDIF
  306.  
  307. Note that the EOF function always returns a logical true (.T.)
  308. for an empty database file.
  309.  
  310. >>> DISPLAY RECORD <number> with INDEX
  311.  The command DISPLAY RECORD <number> does not function properly
  312. with an index engaged.  The following sequence:
  313.  
  314.      USE Filename INDEX Indexname
  315.      DISPLAY RECORD 10
  316.  
  317. will display the number 00010 and position the file pointer at
  318. record 10, but will not display the contents of record 10.
  319.  
  320. >>> DO WHILE at byte 257
  321.  If a command file has exactly 256 bytes, or multiple of 256
  322. bytes, preceeding a DO WHILE statement, the DO WHILE will not
  323. execute and the program will drop back to the dot prompt or one
  324. level of program nesting higher.  In other words, if the "D" in
  325. DO is at byte 257, 513, 769, 1025 etc., the file will not execute
  326. properly.  Adding or subtracting one character before the DO
  327. WHILE solves the problem.
  328.  
  329. >>> DO WHILE using Boolean expressions
  330.  In a DO WHILE statement, contiguous Boolean operators will
  331. execute with inconsistent results when a "." is missing.  The
  332. following two cases illustrate this.
  333.  
  334. CASE 1:
  335.  The following command line will not produce a syntax error and,
  336. when executed, will return a Boolean false (.F.) even when the
  337. condition is true.
  338.  
  339.           DO WHILE flag = "Y" .AND.NOT. EOF
  340.                                   ^____missing period
  341.  
  342. CASE 2:
  343.  The following command line has an inserted space and executes
  344. correctly.  The problem remains, however, that dCONVERT (the
  345. dBASE III conversion utility) will not convert this line
  346. correctly.  It leaves out the test for end-of-file.
  347.  
  348.          DO WHILE flag = "Y" .AND .NOT. EOF
  349.                                   ^____missing period
  350.  
  351.  
  352.  >>> EDIT after a NO FIND
  353.  The command EDIT # will not bring up a record to edit if it is
  354. preceeded by a FIND command that did not find a match ("NO
  355. FIND").  An error message will not be displayed.
  356. 4
  357.  
  358.  >>> EOF
  359.  If EOF is logically true (.T.) and a READ is subsequently
  360. executed on a memory variable, the EOF condition becomes
  361. logically false (.F.).
  362.  
  363. >>> File Structure corruption
  364.  On both the 8-bit and 16-bit versions of dBASE II the database
  365. file structure will be corrupted in the case where a command line
  366. uses a FOR clause with several Boolean operators containing a
  367. large character field (100 to 200 characters long).  For example,
  368. the following command line will corrupt the database file header
  369. in memory when it is executed (assuming Fldnam is a character
  370. field of width 200):
  371.  
  372.     LIST FOR "A"$Fldnam .OR. "B"$Fldnam .OR. "C"$Fldnam .OR.;
  373.               "D"$Fldnam .OR. "E"$Fldnam
  374.  
  375. The explanation for this occurrence is as follows. As dBASE II
  376. interprets the FOR expression, it generates an intermediate
  377. string which cannot be longer than 1000 bytes.  If the
  378. intermediate string exceeds the 1000 byte limit, it will begin to
  379. overwrite the next area in memory; this is the area where the
  380. file structure is located.  The above command line substitutes
  381. 200 bytes each time Fldnam is referenced, plus the number of
  382. characters in the command line itself minus 30 bytes for the
  383. words "Fldnam" which are substituted.  During the interpretive
  384. process the above command line will expand to 1053 bytes thus
  385. exceeding the 1000 byte buffer limitation and overflow into the
  386. adjacent area. The file on disk is unaffected unless the file is
  387. closed.
  388.  
  389. >>> FILE() function
  390.  The FILE() function will only check once for a file if a true
  391. (.T.) is returned.  Any further checks will always return a true
  392. even if a disk is changed and that file is no longer available to
  393. dBASE II.
  394.  
  395. >>> Ignored commands after OTHERWISE and ELSE
  396.  Certain commands when typed from the dot prompt will cause dBASE
  397. II to ignore all commands that follow.  Typing OTHERWISE or ELSE
  398. without a preceeding DO CASE or IF will place the interpreter in
  399. a hold pattern until a release command such as ENDCASE or ENDIF
  400. is typed.  If TEXT is entered, you will not get the dot back
  401. until you type ENDTEXT.
  402.  
  403. >>> INDEX
  404.  In version 2.41 of dBASE II, there is a problem with the index
  405. file being rearranged when the key field is not changed.  The
  406. problem will only occur on indexed database files with duplicate
  407. keys.  The following example illustrates this.
  408.  Suppose Customer.dbf has records 3, 4, 17, 22, and 59 that have
  409. a Name field containing "Smith".  When the index file
  410. Custname.ndx is originally created, records with duplicate keys
  411. will be in record number order.  A listing of names equal to
  412. "Smith" will give:
  413.  
  414.      3  Smith
  415.      4  Smith
  416.      17  Smith
  417.      22  Smith
  418.      59  Smith
  419.  
  420. The following command file will reorder the records in
  421. Custname.ndx to 4, 17, 22, 59, and 3.  In other words, the first
  422. record is moved to the end of its duplicate key group.
  423.  
  424.      USE Customer INDEX Custname
  425.      STORE "Y" TO answer
  426.      FIND "Smith"
  427.      DO WHILE Name = "Smith" .AND. answer = "Y"
  428.         DISPLAY
  429.         @ 10,0 "More records? [Y/N] " GET answer PICTURE "!"
  430.         READ
  431.         SKIP
  432.      ENDDO
  433.  
  434. No matter how the user responds, this command file will only
  435. process one record, because as soon as the READ is issued, record
  436. 3 gets moved to the end of its duplicate key group and the SKIP
  437. causes the condition Name = "Smith" to be false.  If the command
  438. file is executed a second time, record 4 will be found; on the
  439. third run record 17 will be found; etc.
  440.  In this example the problem can be remedied by adding the
  441. NOUPDATE phrase to the READ command.  The user, however, will not
  442. be able to successfully use the EDIT command on an indexed file
  443. with duplicate keys.
  444.  
  445.  >>> INDEX balancing
  446.  The balancing algorithm for index (B-tree) files will
  447. occasionally lose references to nodes in the index file.  This
  448. anomaly clearly manifests itself when doing numerous edits to the
  449. key field(s).  It also manifests itself in APPEND BLANKs and
  450. REPLACEs to the key field(s).  The following steps give an
  451. example of how this can occur:
  452.  
  453.      (1) CREATE a data file with a character field of 40
  454.      characters and 100 records.
  455.  
  456.      (2) REPLACE a constant value to the character field for
  457.      the records in the entire file.  The syntax is:
  458.  
  459.                REPLACE ALL Char:field WITH <"Char string">
  460.  
  461.      (3) INDEX ON the character field.
  462.  
  463.      (4) Now, set-up a program loop to FIND the first
  464.      occurrence of the <"Char string"> and REPLACE a
  465.      character string of random values to the key field.
  466.       RESULT: After 30 FINDs and REPLACEs to the first 30
  467.      records in the data file, the index will FIND (jump to)
  468.      the 36th record in the data file.  It was determined
  469.      that dBASE II had lost a reference to the node
  470.      containing records 31-35.  In some rotations of keys
  471.      and pointers, dBASE II is incorrectly updating the
  472.      node pointers.  In particular, nodes on the right side
  473.      of index subtrees are not being referenced.
  474.  
  475. The two error messages that may indicate a lost node in the index
  476. file are:
  477.  
  478.      RECORD NOT IN INDEX.  This is because the node
  479.      containing the key expression and record number is no
  480.      longer referenced.
  481.  
  482.      END OF FILE FOUND UNEXPECTEDLY.  This is the most
  483.      common error message that will result with this
  484.      condition.  It might (we don't know for sure) result
  485.      from dBASE II following a node reference (of a
  486.      misplaced node) that points to a position beyond the
  487.      end-of-file for the index.  Or, in the process of
  488.      traversing the tree, dBASE II is losing its place along
  489.      the way (because of missing nodes) and might eventually
  490.      run into the end-of-file marker.
  491.  
  492.  
  493. The only work-around at this time, is to recreate the index.
  494. However, if the user never EDITs the key field, or never APPENDs
  495. BLANK and REPLACEs (rather, he/she either APPENDs FROM <filename>
  496. or simply APPENDs in full-screen mode), the problem will never
  497. manifest itself.  An example of how to use an APPEND FROM
  498. technique is given below.  Remember, this only applies o those
  499. applications that require the key fields to be modified.
  500.  A batch method of updating records where the key field is
  501. expected to be modified is given below.  The database file will
  502. have to be periodically PACKed when using this method.
  503.  
  504.      * ---Update.prg
  505.      USE Mainfile INDEX Mainname
  506.      COPY STRUCTURE TO Main.$$$
  507.      SELECT SECONDARY
  508.      USE Main.$$$
  509.      STORE T TO is:more
  510.      DO WHILE is:more
  511.         SELECT PRIMARY
  512.         ACCEPT "Enter name" TO mname
  513.         IF mname = " "
  514.            STORE F TO is:more
  515.            LOOP
  516.         ENDIF
  517.         FIND &mname
  518.         IF # = 0
  519.            ? "NO FIND"
  520.            LOOP
  521.         ENDIF
  522.         DELETE
  523.         SELECT SECONDARY
  524.         APPEND BLANK
  525.         REPLACE Name WITH P.Name, Address WITH P.Address
  526.         @ 5,0 SAY "Name...." GET Name
  527.         @ 6,0 SAY "Address." GET Address
  528.         READ
  529.         CLEAR GETS
  530.      ENDDO
  531.      SELECT SECONDARY
  532.      USE
  533.      SELECT PRIMARY
  534.      APPEND FROM Main.$$$
  535.      USE
  536.      * EOF: Update.cmd
  537.  
  538. To perform the periodic packing procedure, you may use either the
  539. PACK or COPY commands:
  540.  
  541. Using the PACK command:
  542.  
  543.      USE <file>
  544.      PACK
  545.      INDEX ON <exp> TO <indexfile>
  546.  
  547. Using the COPY command to pack:
  548.  
  549.      USE <origfile>
  550.      COPY TO <tempfile>
  551.      USE
  552.      DELETE FILE <origfile>
  553.      RENAME <tempfile> TO <origfile>
  554.      USE <origfile>
  555.      INDEX ON <exp> TO <indexfile>
  556.  
  557. >>> INDEX ON
  558.  It is possible to INDEX on a field which is not in the currently
  559. selected work area when two databases are in use.  It makes no
  560. sense to do this and the index file which is created will be
  561. useless, but versions 2.4, 2.41 and 2.43 do not trap this as an
  562. error.  In the following example, Parts contains Partnum and
  563. Orders contains Ordernum.
  564.  
  565.      SELECT PRIMARY
  566.      USE Parts
  567.      SELECT SECONDARY
  568.      USE Orders
  569.      INDEX ON Partnum to Ndx1
  570.  
  571. After the INDEX ON command has been executed, dBASE II will
  572. return the message that all records have been indexed.  The index
  573. can be opened with SET INDEX TO, but it has no value.  No error
  574. message appears when this last command is executed.  dBASE II
  575. will also allow indexing on a memory variable if that variable is
  576. active. No error message will be given in this instance either.
  577.  
  578. 5
  579.  
  580.  >>> INDEXing with $ (substring) function
  581.  If you use the $ (substring) function with no length parameter
  582. as part of an INDEX expression, dBASE II will drop off the last
  583. character or characters in the INDEX expression.  Therefore, you
  584. will not be able to FIND records INDEXed in this manner.  For
  585. example,
  586.  
  587.      INDEX ON $( Field1, 7 ) + Field2 + Field3 TO Test
  588.      STORE $( Field1, 7 ) + Field2 + Field3 TO key
  589.      FIND "&key"
  590.  
  591. will result in a "NO FIND".  The problem can be overcome if you
  592. include the length parameter in the $ (substring) statement, as
  593. follows:
  594.  
  595.      INDEX ON $( Field1, 7, 2 ) + Field2 + Field3 TO Test
  596.                             ^____This parameter is added
  597.  
  598. Additionally, dBASE II will drop off the last character or
  599. characters when you use the $ (substring) function without the
  600. length parameter in an @...SAY command.
  601.  
  602. >>> INSERT BLANK
  603.  Using INSERT BLANK on an indexed database places the operator
  604. into the INSERTed record in full-screen mode.  Use APPEND BLANK
  605. when dealing with an open index.
  606.  
  607. >>> JOIN
  608.  If you wish to JOIN two database files where the sum of the
  609. number of fields in both files exceeds 32, the FIELDS phrase must
  610. be used to specify which of the fields will compose the structure
  611. of the resultant file.  Otherwise, the system will lock up when
  612. attempting to USE that file.
  613.  
  614. >>> JOIN, repeated use of
  615.  Repeated execution of the JOIN command produces inconsistent
  616. results as described below.
  617.  
  618.  (1) The first JOIN will execute properly.
  619.  (2) The second will only copy the fields from the
  620.      primary database file to the new file.
  621.  (3) The third will create a new file with all the fields
  622.      from the primary database file and the first field from
  623.      the secondary database file.
  624.  (4) The fourth gets all but the first field from the
  625.      secondary database file.
  626.  
  627. This occurs even if different files are used for subsequent
  628. JOINs.  Eventually a "cycle" is completed and the JOIN is
  629. executed properly again.  The only consistent work-around is to
  630. QUIT and re-enter dBASE II for each JOIN.
  631.  
  632. >>> Memory variable corruption
  633.  The following segment of code will cause a numeric memory
  634. variable to overflow and give incorrect results:
  635.  
  636.      STORE 123.456 TO first
  637.      STORE 12.3456 TO second
  638.      DO WHILE T
  639.         STORE first * second / 1.000000 TO first
  640.      ENDDO
  641.  
  642. The results after the program displays about two screens of
  643. output are:
  644.  
  645.  (1) Converts the numeric memory variable to a
  646.      character memory variable.
  647.  (2) Loads the character memory variable with data
  648.      from other places in memory.
  649.  (3) Gives the error message:
  650.  
  651.     "TO" PHRASE NOT FOUND
  652.      STORE first * second / 1.000000 TO first
  653.      CALLED FROM A:NUMTRASH.PRG
  654.      CORRECT AND RETRY (Y/N)?
  655.  
  656. >>> Memory variables with long names
  657.  Memory variable names are limited to 10 characters, but creating
  658. a variable whose name exceeds this limitation is not trapped as
  659. an error.  Instead, the variable name is truncated to the first
  660. 10 characters.  Subsequent references the variable may only use
  661. the first 10 characters or an error message will result.  For
  662. example:
  663.  
  664.      . STORE 5 TO variable123
  665.                             ^----- The variable name will be
  666.                                    truncated here.
  667.      . ? variable123
  668.      *** SYNTAX ERROR ***
  669.        ?
  670.      ? variable123    <---- Variable123 does not exist in memory,
  671.  
  672.      . ? variable12   <---- but Variable12 does.
  673.                5
  674.  
  675.  
  676. >>> Memory variables, Changing data types of
  677.  dBASE II does not support changing a memory variable type in the
  678. following example:
  679.  
  680.      STORE 5 TO number
  681.      STORE STR(number,2) TO number
  682.      ? "Number is",number
  683.  
  684. This set of steps will result in:
  685.  
  686.     Number is   0
  687.  
  688. Instead of the expected:
  689.  
  690.     Number is   5
  691.  
  692. The reason for the discrepancy is that the value of 'number' is
  693. being used at the same time it is being changed.  To work around
  694. this problem, use a temporary memory variable in the following
  695. manner:
  696.  
  697.      STORE 5 TO number
  698.      STORE number TO temp
  699.      STORE STR(temp,2) TO number
  700. 6
  701.  
  702.  
  703.  
  704. >>> MODIFY STRUCTURE and header corruption
  705.  On the IBM PC, with a database file of many fields (28 or more)
  706. the following sequence in MODIFY STRUCTURE will not insert a
  707. blank field in the proper place:
  708.  
  709.      . USE <datafile>
  710.      . MODIFY STRUCTURE
  711.  {Press the following control characters:
  712.  
  713.      Ctrl-C
  714.      Ctrl-N
  715.      Ctrl-T
  716.      Ctrl-W
  717.      . MODIFY STRUCTURE
  718.  {Now, press the following:
  719.  
  720.     Ctrl-N
  721.  {This will insert a blank field in some
  722.  other part of the database structure
  723.  
  724.  Successive MODIFY STRUCTURE commands will cause Ctrl-N to
  725. exhibit one or more of the following: insert many blank fields at
  726. one time, paint the screen with graphics characters, lock up the
  727. computer, or reboot the operating system.
  728.  
  729. >>> MODIFY STRUCTURE procedures
  730.  The following is the recommended procedure to MODIFY the
  731. structure of a database file containing records.
  732.  
  733.      RENAME <Yourfile> TO Temp
  734.      USE Temp
  735.      COPY STRUCTURE TO <Yourfile>
  736.      USE <Yourfile>
  737.      MODIFY STRUCTURE
  738.      APPEND FROM Temp
  739.      DELETE FILE Temp
  740.  
  741. >>> Parentheses Limitations
  742.  An expression with eight nested parentheses followed by LIST
  743. STATUS will hang the computer.  For example:
  744.  
  745.      STORE "ABCDEF    " to mem1
  746.      STORE STR(((INT(((LEN(TRIM(mem1)))+1)/2))-1),1) to mem2
  747.      LIST STATUS
  748.  
  749.  This may be due to a nesting limitation or to some limitation in
  750. the LIST STATUS command.
  751.  
  752. >>> QUIT TO on Wang PC
  753.  QUIT TO does not work on the WANG-PC.  A system error,
  754. "Specified command search directory bad," is displayed and the
  755. user is left at a DOS prompt.
  756.  
  757. >>> QUIT TO with an ALTERNATE file open
  758.  On the T.I. PROFESSIONAL with MS-DOS 2.11 or 2.12 , if a QUIT TO
  759. command is issued when an ALTERNATE file is open, the QUIT TO
  760. will work the first time but not subsequently.  Upon returning to
  761. dBASE II and executing a QUIT TO or QUIT, the error message
  762. "UNASSIGNED FILE #" appears and control returns to the dot
  763. prompt.  dBASE II is now locked into an endless loop and cannot
  764. be exited without performing a warm boot.  The way to avoid this
  765. problem is to close the ALTERNATE file prior to issuing the QUIT
  766. TO command.  The preferred method of operation is to close all
  767. files before QUITting TO an external program.
  768.  
  769. >>> READ resetting the EOF flag
  770.  The EOF flag will be set to false whenever any key but the
  771. Return key is pressed in response to a READ command.  The
  772. following command sequence illustrates this.
  773.  
  774.      USE Names INDEX Zipcode
  775.      GO BOTTOM
  776.      SKIP
  777.      * The file pointer is at the end-of-file and
  778.      * the following ? command will return a value of .T.
  779.      ? EOF
  780.      *
  781.      * But, in response to a READ command...
  782.      STORE "1" TO choice
  783.      @ 10,10 GET choice
  784.      READ NOUPDATE
  785.      * If any key but a Return is pressed,
  786.      * the following ? command will return a value of .F.
  787.      ? EOF
  788.  
  789. >>> REINDEX on a database file with no index
  790.  Issuing the REINDEX command on a database file that does not
  791. have an open index will not display an error message.
  792.  
  793. >>> REPLACE ALL
  794.  REPLACE ALL does not replace all records correctly if an index
  795. is in use and the key field is replaced.  Only the first record
  796. and those that logically follow the new value will be replaced.
  797. This occurs because the index is automatically updated (in-place
  798. key updating) when it is edited.  Then the record pointer moves
  799. to the record following the new position, not to the record
  800. following the old position.  This can be illustrated in the
  801. example given below.
  802.  The data file has five records with the field CHARS-C-1, and
  803. indexed on this field.  The following sequence demonstrates what
  804. occurs.
  805.  
  806.      . LIST
  807.      Record#  CHARS
  808.            1  a
  809.            2  b
  810.            3  c
  811.            4  i
  812.            5  j
  813.  
  814.      . REPLACE ALL Chars WITH 'd'
  815.      3 records replaced
  816.      . LIST
  817.            2  b
  818.            3  c
  819.            1  d
  820.            4  d
  821.            5  d
  822.  
  823. The manual warns against block replacements to the key field. The
  824. correct procedure would be to REPLACE with no indexes in use,
  825. open the indexes with SET INDEX TO, and then REINDEX.
  826. 7
  827.  
  828. >>> REPLACE and deleted records
  829.  It is not possible to REPLACE information in a record that has
  830. been marked for deletion.  For example:
  831.  
  832.     REPLACE <field> WITH <exp> FOR *
  833.  
  834. will always result in
  835.  
  836.     00000 REPLACEMENT(S)
  837.  
  838. no matter how many records are marked for deletion.
  839.  
  840. >>> REPORT FORM and SET DELETED ON or OFF
  841.  The REPORT FORM ignores the status of SET DELETED, and never
  842. prints records that are marked for deletion.  There is no known
  843. work-around for this problem short of writing a dBASE command
  844. file to print the report. The dGEN utility provided on the 2.43
  845. Utilities disk contains a FORMGEN program that is designed to do
  846. just this.  Refer to your 2.41 documentation update for complete
  847. instructions.
  848.  
  849. >>> REPORT FORM with SET MARGIN TO
  850.  The 8-bit version of the dBASE II REPORT FORM command will print
  851. the page, subtotal, and total starting in column 0 no matter what
  852. the margin is set to. Setting the margin to 25 will still make
  853. the format look like this:
  854.  
  855.     Page no. 00001
  856.                              06/12/84
  857.                               column 1       column 2
  858.                              * sub1 FIRST
  859.                              FIRST           99.99
  860.     ** Subtotal **
  861.                                              99.99
  862.     ** Total **
  863.  
  864.  
  865.                                              99.99
  866.  
  867. The 16-bit version of dBASE II will correctly line everything up
  868. under the date.
  869.  
  870. >>> REPORT FORM, numeric overflow on large reports
  871.  Large REPORT FORMs of mixed data type can generate a line of
  872. asterisks ("***") when a numeric field is totaled.  The overflow
  873. on the numeric field is usually positioned on a far right column
  874. of the report.  Moving the totaled column further to the left may
  875. clear up the overflow problem.
  876.  
  877.  >>> SET FORMAT TO <filename> and EDIT
  878.  (1) When using the EDIT command with an open format file, Ctrl-U
  879. will not function as the delete toggle.  To work around this
  880. problem, use a logical memory variable to store the status of
  881. each record.  For example:
  882.  
  883.      USE Fileone
  884.      SET FORMAT TO Edit
  885.      STORE F TO is:deleted
  886.      DO WHILE .NOT. EOF
  887.         IF *
  888.            STORE T TO is:deleted
  889.         ELSE
  890.            STORE F TO is:deleted
  891.         ENDIF
  892.         EDIT #
  893.         IF is:deleted
  894.            DELETE
  895.         ENDIF
  896.      ENDDO
  897.  
  898. The format file, Edit.fmt, must contain an @...SAY...GET
  899. statement for each desired field as well as a command similar to
  900. the following:
  901.  
  902.     @ x,y SAY "Delete this record? [Y/N] " GET is:deleted
  903.  
  904. (2) The documentation (Version 2.3 to 2.4 Change Summary) states
  905. that SET FORMAT TO can be used in conjunction with CREATE, but
  906. this is incorrect.  If a format file is open at the time of a
  907. CREATE, the error message "VARIABLE CANNOT BE FOUND" will be
  908. displayed if you answer "Y" to the prompt, "INPUT DATA NOW
  909. (Y/N)?"
  910.  
  911. >>> SET MARGIN
  912.  SET MARGIN TO will not set the margin on line zero (that is, @
  913. 0,<col> SAY) when going to the printer.  However, all other lines
  914. following line zero will be printed at the new margin setting.
  915.  
  916. >>> SET MARGIN
  917.  If a MARGIN is SET and FORMAT is SET TO PRINT, multiple
  918. @...SAY's to the same line will include the margin setting
  919. between them.
  920.  
  921. For example:
  922.  
  923.      SET MARGIN TO 7
  924.      SET FORMAT TO PRINT
  925.      @ 10,1 SAY "Hello "
  926.      @ 10,6 SAY "there"
  927.  
  928.        Hello       there
  929.              ^------ the second word should print here
  930.  
  931. This result occurs as well when using relative column positioning
  932. with $.
  933.  
  934. >>> Sidekick and dBASE II incompatibility
  935.  If the IBM PC software product SideKick is loaded along with
  936. dBASE II and a Ctrl-C is typed in either the full screen mode,
  937. MODIFY COMMAND, or with @...GET...READ statements, it will drop
  938. out of dBASE II and return immediately to the operating system.
  939. Use the PgDn key instead of Ctrl-C.
  940.  
  941.