home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 080.lha / MFFimport.doc < prev    next >
Text File  |  1986-11-20  |  8KB  |  192 lines

  1.  
  2.         The Microfiche Filer Text Import Utility
  3.  
  4. This utility is (c) Copyright 1987 by Software Visions, Inc. but is freely
  5. distributable.  Please feel free to pass it on to your friends who have
  6. bought the Microfiche Filer.
  7.  
  8. This utility was written because the number one wish of Microfiche Filer
  9. owners was to be able to import text from other databases into the
  10. Microfiche Filer.  The Microfiche Filer already has the capability of
  11. exporting text through the "Print To File" option.  In fact, using "Print
  12. To File" then using the Text Import Utility you may now even export and
  13. import data between several Microfiche Filer databases!
  14.  
  15. This program currently does not have a pile of fancy features, it just
  16. does it's job simply and efficiently.  It is intended for importing
  17. simple, fixed record size ASCII files of the type that essentially all
  18. databases can create and, in fact, can even be easily created by hand
  19. using a simple text editor.  It does NOT read other database's internal
  20. formats but uses absolutely standard ASCII text files.  It DOES, however,
  21. know intrinsically about the Microfiche Filer internal file format and,
  22. using this knowledge, allows you to reference fields that you have created
  23. directly, without a bizare command language.  If you are comfortable using
  24. the Microfiche Filer, you will have absolutely no problem using the MFF
  25. Text Import Utility (hereafter referred to as the TIU).
  26.  
  27.  
  28.  
  29. What you need to perform a text import:
  30.  
  31. You may only import into a previously existing database which has been
  32. created using the Microfiche Filer.  You will need a COPY of this database.
  33. DO NOT USE YOUR ORIGINAL!  The TIU will append data to this database, and,
  34. if you realize that for some reason the data was not formatted correctly,
  35. you don't want to sift through your MFF file with an editor, chopping it
  36. up by hand, do you?  You can simply start again by copying your original.
  37. In fact, if you have enough memory, you should probably put the COPY that
  38. you are going to work with in the RAM: disk.  This will save a lot of time.
  39.  
  40. The second thing that you need is a text file to import.  It must be set
  41. up with a fixed number of lines per record, and, if it has many fields per
  42. line, they must be in a fixed format.  In other words, the file may contain
  43. one field per line with a fixed number of lines per record such as:
  44.  
  45. Rec 1 Field 1
  46. Rec 1 Field 2 here
  47. Rec 1 Field 3
  48. Rec 2 Field 1 is on this line
  49. Rec 2 Field 2 (notice that the lines may vary in length)
  50. Rec 2 Field 3 (but the number of lines per record must be the same)
  51. Rec 3 Field 1
  52. etc.
  53.  
  54. Or, the file may contain several fields per line in a fixed format (but
  55. the number of lines per record must still be fixed) such as:
  56.  
  57. Rec1 Field4            Rec1 Field2  Rec1 Field3
  58. Rec1 Field1 is on this variable line
  59. Rec2 Field4 still ok   Rec2 F2      Rec2 F3 and the last one may go on and on
  60. Rec2 Field1
  61. Rec3 F4                Rec3 F2      Rec3 F3
  62. Rec3 Field1 again, (remember this line is variable!)
  63. etc.
  64.  
  65. Notice that the last field on a line may be variable length, if you like.
  66. When these records are read, the trailing spaces are eliminated; therefore,
  67. the line:
  68.  
  69. Rec2 Field4 still ok   Rec2 F2      Rec2 F3 and the last one may go on and on
  70.  
  71. would be translated into:
  72.  
  73.  "Rec2 Field4 still ok"
  74.  "Rec2 F2"
  75.  "Rec2 F3 and the last one may go on and on"
  76.  
  77. when stored in fields in the database.
  78.  
  79. Also, note that double quotes ("), and back quotes (`) are translated into
  80. single quotes (') because double and back quotes are special characters to
  81. the Microfiche Filer.  In addition, single lines are limited to about 2000
  82. characters.  Lines longer than this are partially discarded.
  83.  
  84. The third thing that you need to perform a text import is a description
  85. of what fields are where in the text file.  You may wish to print out a
  86. bit of your text file so that you can determine what columns the fields
  87. begin and end in, or you may simply wish to 'type' them in a cli window
  88. or read them into your favorite editor to determine these starting and
  89. ending character positions.  This is only necessary if your text file has
  90. multiple fields per line.  If each field is on it's own line, you must
  91. simply know the corresponding line numbers.
  92.  
  93.  
  94.  
  95. Performing a text import:
  96.  
  97.   Start the TIU by double-clicking the icon in the Utilities drawer or by
  98.   typing ":mff_files/utilities/mffimport" from the CLI.
  99.  
  100. You are prompted for a database to use.
  101.  
  102.   Give it the name of your COPY!
  103.  
  104. The TIU then opens a large window, similar to the familiar "Selection Editor"
  105. in the Microfiche Filer.  This window is organized somewhat differently,
  106. however.  On the left are the names of the input and output files.  Since
  107. you have only given it an output file so far, the input filename is blank.
  108. Next, on the left, is a place for you to specify blank lines at the end
  109. of a record in your text file, if any (for instance, if you have 6 lines
  110. of text for each record in your text file but only wish to import the
  111. first and fourth lines, you would put a 2 in this field so that the last
  112. two lines are skipped).  And finally, on the right is a scrollable area
  113. listing all of the fields in your database with spaces for you to fill in.
  114.  
  115.   Select "Open Input File" from the FILE menu and enter the name of your
  116.   text file.
  117.  
  118. If the file is found, the name is displayed under "Input file:" in the
  119. window.
  120.  
  121.   Now fill in the "From line", "From char", and "To char" spaces in the
  122.   field list corresponding to the positions of these fields in your text
  123.   file.
  124.  
  125. Only those fields in which you enter the "From line" (the line number) will
  126. be used during the import.  The other fields will be left blank.  This is
  127. all that you need to do if your file consists of records with one field
  128. per line.  If you have several fields on a line, you must also fill in the
  129. "From char" and "To char" spaces.  Counting starts at 1.  The first
  130. character on a line is number 1, etc.
  131.  
  132. If you leave the "From char" field blank, it will automatically be set to
  133. 1.  If you leave the "To char" blank, it will automatically be set to 32767.
  134.  
  135. For instance, the definition for importing the following file:
  136.  
  137. Rec1 Field4            Rec1 Field2  Rec1 Field3
  138. Rec1 Field1 is on this variable line
  139. Rec2 Field4 still ok   Rec2 F2      Rec2 F3 and the last one may go on and on
  140. Rec2 Field1
  141. Rec3 F4                Rec3 F2      Rec3 F3
  142. Rec3 Field1 again, (remember this line is variable!)
  143. etc.
  144.  
  145. is:
  146.  
  147.     From From To
  148. Field    Line Char Char
  149. ----------------------
  150. Field1    2
  151. Field2    1    24   36
  152. Field3    1    37
  153. Field4    1         23
  154.  
  155. In other words:
  156.  Field1 is on line 2 from char 1  to 32767;
  157.  Field2 is on line 1 from char 24 to 36;
  158.  Field3 is on line 1 from char 37 to 32767;
  159.  Field4 is on line 1 from char 1  to 23.
  160.  
  161. Whew.  This is much harder to explain than to do!
  162.  
  163. Don't worry about lines that are too short; the TIU simply blanks the field.
  164. The TIU is also pretty smart about problems with your definition.  It will
  165. notify you if you have declared overlapping fields, negative numbers, etc.
  166.  
  167.   Once all of this is done, simply choose "Perform the Text Import" from
  168.   the FILE menu and away it goes.
  169.  
  170. When it is done, your original output file (your database) will have the
  171. fields from your text file appended to it.  None of the other data in the
  172. database has been touched.
  173.  
  174.  
  175.  
  176.  
  177. Importing more complex record formats:
  178.  
  179. Included in this directory is a program called convert.c.  This was just
  180. a quick hack that we whipped up to translate an ASCII file into MFF file
  181. format.  You may wish to use part of this code to write your own import
  182. programs to import more complex formats with variable field sizes, comma
  183. separated lists, and so on that the MFF Text Import Utility cannot handle.
  184. Feel free to call our Telephone Support Line for help writing your own
  185. import utilities.
  186.  
  187.  
  188.  
  189.     Enjoy!
  190.  
  191.       Software Visions
  192.