home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / a / dbtips.lbr / DBFREQ.QZT / DBFREQ.QST
Encoding:
Text File  |  1993-10-26  |  12.6 KB  |  326 lines

  1. dBASE II FREQUENT QUESTIONS
  2.  
  3.  1 Programming
  4.  2 Printing
  5.  3 Data transfer
  6.  4 REPORT form
  7.  5 INDEXing and SORTing
  8.  6 Lost records
  9.  7 Memory allocation
  10.  8 Data File Size limitation
  11.  
  12.  
  13.  1 Programming
  14.  
  15.  What else do I need to know about using other text editors to
  16. create command (.CMD or .PRG) files?
  17.  
  18.  The editor or word processing program must be used in a
  19.  mode that does not insert control characters in the
  20.  text for page breaks, line feeds, etc.  In WORDSTAR,
  21.  for example, use the "N" (Non-document) option rather
  22.  than the "D" (Document) option.  A useful side note is
  23.  that you can run  dBASE II  from the "R" (Run a program)
  24.  option in WORDSTAR for testing your program.
  25.  
  26.  
  27.  How can you FIND on more than one key?  I have indexed my
  28. database on Last:name + First:name to <indexfile>, but I can
  29. still only find the Last:name.
  30.  
  31.  If your Last:name field is 12 characters wide and you
  32.  have the name, Smith, in it, it would have the five
  33.  characters of the name plus seven spaces.  The index
  34.  key would therefore have seven spaces between the end
  35.  of the last name and the start of the first name.
  36.  The index key would look like this:
  37.  
  38. SMITH       JOHN
  39.  
  40.  In order to FIND this record, you would have to state
  41.  the command in a way that included the exact number of
  42.  spaces:
  43.  
  44. FIND "SMITH       JOHN"
  45.  
  46.  Although that works, it is hardly practical in the real
  47.  world.  Usually, you would enter the name you want to
  48.  FIND into memory variables and you would find on the
  49.  macro of the variables.  Also, you would not want to be
  50.  concerned with counting the required number of spaces.
  51.  If you use @...GETs to prompt for the names, just
  52.  initializing the variables to the appropriate length
  53.  will provide you with the correct number of trailing
  54.  spaces.  For Example:
  55.  *Initialize variables
  56.   STORE "            " TO mlast, mfirst
  57.   *Get string to search for
  58.   @ 1,1  SAY "First name " GET mfirst
  59.   @ 1,40 SAY "Last name " GET mlast
  60.   READ
  61.   *Concatenate the variables and find key
  62.   STORE mlast + mfirst TO mkey
  63.   FIND &mkey
  64.  
  65. When I have written a command file and it doesn't run the way it
  66. should, is there any way to find out exactly what the trouble is?
  67.  
  68.  SET ECHO ON and SET TALK ON, and run the program.  If
  69.  the screen gets too cluttered for you to follow, SET
  70.  DEBUG ON will send the output of ECHO and TALK to the
  71.  printer.  This is  dBASE II 's primary debugging tool and
  72.  it is the only way you can really see how your command
  73.  file is being executed and what the results of each
  74.  command are.  SET STEP ON allows you to proceed one
  75.  command at a time and even enter commands from the
  76.  keyboard during the program's execution.
  77.  
  78.  
  79. I just updated to version 2.43 and am getting the error message,
  80. FILE IS CURRENTLY OPEN.  These very same program files ran
  81. perfectly under version 2.3. Why don't they run in 2.43?
  82.  
  83.   This is a new feature in 2.4 that prevents you from
  84.  getting into bigger trouble further down the line.  It
  85.  prevents recursion which is the calling of the same
  86.  command file from within itself or calling another
  87.  command file which then calls the first one.  DOing
  88.  another command file does not close the one you are in;
  89.  only a RETURN will close command files.  It's good
  90.  housekeeping to place a RETURN command at the point
  91.  where you want to exit from your command file even when
  92.  there is no other file to which to return.  You will
  93.  also run into this new feature if you try to APPEND
  94.  FROM or COPY TO a file that is open in SECONDARY when
  95.  you are in PRIMARY, and vice versa.
  96.  
  97. I made an entry screen using @..SAY..GETs and READ in a DO WHILE
  98. loop.  It works fine for nine times through the loop and then the
  99. cursor goes way over to the right of the screen and hangs the
  100. machine.  What causes this?
  101.  
  102.  You must either ERASE or CLEAR GETS every 64 GETs or
  103.  you will experience this or other difficulties.  It's a
  104.  good practice to place a CLEAR GETS within any loop
  105.  which contains even one GET, and anywhere in the file
  106.  where 64 GETs could possibly occur.  You may also use
  107.  the CLEAR GETS after any READ where you don't want the
  108.  operator to be able to move the cursor backwards into
  109.  previous GET fields.
  110.  
  111.  
  112.  2 Printing
  113.  
  114.  To use my printer's special functions, I have to send special
  115. characters like the ESCape.  Can I do that from within dBASE II?
  116.  
  117.  You can send the decimal equivalent with the CHR
  118.  function.  An ASCII conversion chart will assist you in
  119.  this.  The decimal equivalent for ESC is 27.  To send
  120.  it, you SET PRINT ON and type: ?? CHR(27).  If you want
  121.  to send a sequence, use the plus sign to concatenate
  122.  the CHR statements, ie: ?? CHR(27)+CHR(62)+CHR(34).
  123.  You programmers who are used to BASIC please note that
  124.  there is no dollar-sign in the dBASE II function.  We
  125.  use CHR(27), not CHR$(27).  CHRs may also be sent with
  126.  the @...SAY function if you SET FORMAT TO PRINT.
  127.  
  128. When I'm printing from a data file, the last line of the last
  129. record doesn't print until I QUIT out of  dBASE II.  What causes
  130. this and what can I do to get the last line to print?
  131.  
  132.  Many printers have a buffer in which they store each
  133.  line until they receive a carriage-return.   dBASE II
  134.  sends it's carriage-return/line-feed pair at the
  135.  beginning of a line rather than at the end.  So when
  136.  you get to the last line of the last record, the
  137.  printer is waiting for a carriage-return before it
  138.  prints that line.  It's a simple matter to send the
  139.  printer a carriage return in the form of a CHR(13) at
  140.  the end of any printing job in which this occurs.  For
  141.  operations where you have SET PRINT ON, use "??
  142.  CHR(13)", and for operations where you have SET FORMAT
  143.  TO PRINT, use "@ <coordinates> SAY CHR(13)".
  144.  
  145.  
  146.  3 Data transfer
  147.  
  148.  What data formats will dBASE II accept so that I can use data
  149. from other programs without retyping it?
  150.  
  151.  dBASE II can read data files that have been created by
  152.  other processors and systems like BASIC, PASCAL,
  153.  FORTRAN, PL/I, etc. if the files are stored in ASCII
  154.  code (American Standard Code for Information
  155.  Interchange).  The APPEND command with the SDF or
  156.  DELIMITED options is the way to do this.  Check your
  157.  dBASE II User Manual on pages A-47, B-19, and B-41 for
  158.  the proper syntax.
  159.  
  160.  
  161. Can I use the information in my dBASE II .DBF file with a mailing
  162. list or word processing program?
  163.  
  164.  Yes.  One command will convert the .DBF file to System
  165.  Data Format (ASCII) or a Delimited format.  Use the
  166.  COPY command with the SDF or DELIMITED options to do
  167.  this.  Look up the COPY command on pages A-47, B-19,
  168.  and B-53 in your  dBASE II  User Manual for the proper
  169.  syntax in making this conversion.
  170.  
  171.  
  172.  4 REPORT form
  173.  
  174. What are the limits of the REPORT FORM command?
  175.  
  176.  REPORT FORM will process a maximum of 24 fields.  All
  177.  column headings combined are 720 bytes maximum.  Page
  178.  heading is 254 bytes maximum.  When you include logical
  179.  fields in a report form, they will always take up eight
  180.  characters of space at output, even though you may
  181.  define the report field's width as one.  If the REPORT
  182.  FORM command cannot generate a printout for a specific
  183.  application, create a command file and use the @...SAY
  184.  commands with SET FORMAT TO PRINT.
  185.  You may change the file with any text editor.  To change
  186.  it with MODIFY COMMAND, just use the .FRM extension with
  187.  the file name (ie: At the dot prompt, type:
  188.       MODIFY COMMAND <FILENAME>.FRM).
  189.   Since the questions that prompted you through the
  190.  original creation of the file are not contained in the
  191.  file, you will find it helpful to have your printer on
  192.  when you originally create the file.  That way, you
  193.  will have a hard copy of the questions to guide you
  194.  through the changes.  A word of caution though, if you
  195.  make any errors in editing the .FRM file by this
  196.  method, the REPORT FORM command will bomb since there
  197.  is no trapping of errors as when the file is first
  198.  created in  dBASE II .  If you escape a REPORT FORM
  199.  either by hitting the ESC key or by getting a syntax
  200.  error, you must close it before you can edit it with
  201.  MODIFY COMMAND.  REPORT FORM files are closed only when
  202.  the data file (.DBF) they USE are closed.
  203.  
  204.  
  205.  
  206.  5 INDEXing and SORTing
  207.  
  208.  On very large files, the SORT command seems to take a long time.
  209. What can I do to make it faster and easier?
  210.  
  211.  Use the INDEX and COPY commands to accomplish the same
  212.  result as a SORT in less time and with more
  213.  versatility.  For example:
  214.  
  215.      USE <original file>
  216.       INDEX ON <some key> TO <index file>
  217.       COPY TO <sorted file>
  218.  
  219.  Is there any way to estimate the size of an index (.NDX) file
  220. before actually creating it?
  221.  
  222.  The  approximate  size in bytes can be determined with
  223.  the following formula:
  224.  Let x = key size; let y = number of records.
  225.  1.4*(INT(y/INT(512/(x+4)))*512)
  226.  
  227.  
  228.  
  229.  6 Lost records
  230.  
  231.  I have a .DBF file that says it has 100 records in it when I
  232. LIST FILES or LIST STRUCTURE.  But when I try to simply LIST the
  233. contents of that file, it only shows me 32 records.  I know there
  234. are 100 records because I entered them.  Is this a bug in dBASE
  235. II?
  236.  
  237.  No, it is an embedded EOF (End Of File) marker.  There
  238.  is only one cause of an embedded EOF marker in version
  239.  2.4 and that is when you exit from  dBASE II  without
  240.  issuing a QUIT command, and therefore are not closing
  241.  the files that are open.  The EOF marker is not removed
  242.  from its prior position, and any recently entered data
  243.  may be either lost or irretrievable.  This happens most
  244.  often when there is an inadvertent system reset during
  245.  a working session, or when you change the disk without
  246.  properly closing the files.  You should never
  247.  intentionally exit  dBASE II  without issuing the QUIT
  248.  command to close the files.
  249.   You may think that you have closed the files when, in
  250.  fact, they remain open.  This usually happens when you
  251.  are working in PRIMARY and SECONDARY and you issue a
  252.  USE <blank> command to close the files.  If you are in
  253.  PRIMARY, a USE command will only close the PRIMARY
  254.  file.  And similarly, if you are in SECONDARY, a USE
  255.  command will only close the SECONDARY file.  A CLEAR
  256.  command will close all files (it also releases your
  257.  memory variables and selects primary), or you can
  258.  SELECT PRIMARY and USE <blank> and then SELECT
  259.  SECONDARY and USE <blank>.
  260.   To recover data in a file with a misplaced EOF marker,
  261.  you have to reconstruct the file using the COPY and
  262.  APPEND commands.    Reminder: always have a backup copy
  263.  of any file on which you are working.
  264.  
  265.       USE <Sickfile>
  266.       COPY TO <Goodfile>
  267.       GO # + 2
  268.       COPY NEXT 65535 TO <Tempfile> (copies last portion)
  269.       USE <Goodfile>
  270.       APPEND FROM <Tempfile>
  271.       DELETE FILE <Tempfile>
  272.       DELETE FILE <Sickfile>
  273.       CLEAR
  274.  
  275.   You can now RENAME your good file.  If there is more
  276.  than one embedded EOF, you may modify this routine to
  277.  copy out the data between EOFs, or change line three
  278.  to read: GO # + <n> -- where n is a number large enough
  279.  to get you past all the embedded EOFs.
  280.  
  281. Why do I get the error message RECORD OUT OF RANGE when the
  282. record is within the range of the beginning and ending record
  283. numbers?
  284.  
  285.  This will happen in an INDEXed file if the INDEX has
  286.  become corrupted or if you have a misplaced EOF marker.
  287.  REINDEX your file, and if that does not clear up the
  288.  problem, follow the procedure outlined above.  You could
  289.  also have a corrupted file header which is usually easily
  290.  cleared up by COPYing STRUCTURE TO <newfile>, USE <newfile>,
  291.  and APPEND FROM <oldfile>.  This condition can also
  292.  occur when you APPEND records and SORT without closing
  293.  your file between those operations (See #35 below).
  294.  
  295.  
  296.  
  297.  7 Memory allocation
  298.  
  299.  If I have more RAM memory than the minimum required, will dBASE
  300. II use it?
  301.  
  302.  No.  dBASE II uses a fixed amount of memory regardless
  303.  of how much may be present.  dBASE II uses to B000H (45056D)
  304.  on 8-bit systems, and to EB00H (60160D) on 16-bit systems
  305.  for everything except the SORT command.  SORTs use a fixed
  306.  amount of the area above that and below the start of BDOS in
  307.  8-bit systems, or below 92K in 16-bit systems.
  308.  
  309. What  dBASE II  files must remain on the disk?  Can I remove any
  310. to make more room?
  311.  
  312.  In version 2.4 or greater of dBASE II, there are only two
  313.  files that must remain on the disk, DBASE.COM and
  314.  DBASEOVR.COM.  The third file, DBASEMSG.TXT, may be
  315.  removed if you will not be using the on-line HELP
  316.  feature.  Of course, INSTALL.COM may be removed once
  317.  you have installed  dBASE II  for your terminal.
  318.  
  319.  8 Data File Size limitation
  320.  
  321.  
  322.  Current file size limit of dBASE II for all versions is 8
  323. megabytes.  This limit applies to both the 8- and 16-bit formats.
  324. MS-DOS allows for files to be as large as 32 megabytes, but dBASE
  325. II cannot handle a file this large.
  326.