home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FRM2PR6A.ZIP / FRM2PRG.DOC < prev   
Encoding:
Text File  |  1987-08-25  |  9.9 KB  |  231 lines

  1. FRM2PRG -- another nifty little Synergy Utility for dBASE III Plus
  2.  
  3. FRM2PRG attempts to convert a dBASE FRM file to a PRG (procedure) file.  As
  4. this is my first decent-sized C program, so it is fairly crude--if it
  5. generates some revenue I will definitely enhance it, but first I thought I'd
  6. get some suggestions for enhancements other than those I want myself (and
  7. bug-fixes, of course <grin>).
  8.  
  9. **
  10. What are the foreseen uses for this thing?
  11.  
  12. I often prototype reports using MODI REPO, then when the thing gets
  13. OK'd I write a custom PRG to do the report, adding some enhancements.  This
  14. will enable me (and you) to generate a PRG file easily using this method, and
  15. just make (hopefully) minor modifications.
  16.  
  17. FRM2PRG should make life easier when converting someone else's app.
  18.  
  19. ...and, of course, those of you who actually *use* FRM files with compiled
  20. apps can now compile them right into the EXE files as PRGs.
  21.  
  22. **
  23. Version 0.6a BETA usage:
  24.  
  25. At the DOS prompt: FRM2PRG {switches} infilename{.frm} { > outfilename.ext }
  26.  
  27. Expressions in curly braces are optional. The "infilename" can have a drive and
  28. path if you like (and, of course, so can the "outfilename").
  29.  
  30. Output is written to the console, but can be redirected to a PRG file or
  31. whatever ("outfilename".  The file which is created will have several 
  32. procedures, one of which is called "[prefix]_main" ([prefix] defaults to "any", 
  33. but can be specified--see "switches" below).  As the FRM file does not contain 
  34. any reference to the name of the database file(s) used, there are some places to
  35. fill it (them) in.  So, you can setup your DBF's and relationships, etc., then:
  36. SET PROC TO <whatever you redirected to>
  37. DO any_MAIN
  38. CLOS PROC
  39. ... or you can fill in the SELECTs and USEs within file generated by FRM2PRG.
  40. You can also, of course, insert SET RELATION commands.
  41.  
  42. **
  43. Switches:
  44.  
  45. Switches must be preceded by "/" or "-".  They can be either upper or lower
  46. case.  Most switches require a parameter to follow immediately.  The switches
  47. supported by version 0.6a are:
  48.  
  49. T (t) -- Tab width -- number of spaces for indents (default: 4);
  50. P (p) -- Three letter prefix for procedure names (default: "any");
  51. L (l) -- *Loop condition (default: ".NOT. EOF()");
  52. I (i) -- *Initial command after opening databases (default: "GO TOP");
  53. E (e) -- *Ending command (default: "CLOSE DATA").
  54.  
  55.  
  56. The latter three switches may often encompass more than one "word", if so, it
  57. gets a little trickier--you have to enclose the switch, the preceding "-" or
  58. "/", and the parameter in double quotes, i.e., "/iGO thisrec".  By the way,
  59. in the case of the "Initial command" and "Ending command", you can override
  60. them entirely by using /i or /c with no parameter.
  61.  
  62. Examples:
  63.  
  64. FRM2PRG /T5 /pCUS "-iSET FILTER TO x=y" "/L&scope" myreport
  65.  
  66. FRM2PRG will attempt to read myreport.frm and send output to the screen.
  67. Indentation will be in multiples of 5, procedure names will start with "CUS_",
  68. the initial command after opening databases will be "SET FILTER TO x=y", and
  69. the terminating condition will be "&scope" (main loop will say 
  70. "DO WHILE &scope"). Note that "DO WHILE &<anything>" is not a bright move, by 
  71. the way [grin].
  72.  
  73. FRM2PRG "-iON ESCA DO prntrupt"  "/EDO endrep" monthend >monthend
  74.  
  75. FRM2PRG will read MONTHEND.FRM and create MONTHEND (no extension, not a good
  76. idea generally).  No check will be made to see if MONTHEND. exists, since
  77. the "outfilename" is not actually a parameter to the program, but to DOS.
  78. Procedures with have the default prefix "_any", indents will be in multiples of
  79. 4, intitial and ending commands will be, respectively, "ON ESCA DO prntupt"
  80. and "DO endrep".
  81.  
  82. **
  83. Capabilities & limitations:
  84.  
  85. FRM2PRG should convert most dBASE III Plus FRM files.  Multiple-row headings
  86. should work fine.  Multiple-row fields or expressions should also work, up to
  87. 4 deep.  FRM2PRG will have a problem, however, if you stack fields and put a
  88. space between "'" and "+":
  89. EXPRESSION+";"+EXPRESSION  && OK
  90. EXPRESSION+';'+EXPRESSION  && OK
  91. EXPRESSION+ ";" +EXPRESSION  && NOT OK
  92. EXPRESSION+ ';' +EXPRESSION  && NOT OK
  93.  
  94. The biggest limitation of this version is that it attempts to emulate REPORT
  95. FORM exactly.  As there are a lot of options such as "plain page",
  96. "summary only", etc. that can produce varied output, FRM2PRG needs some Beta
  97. testing to see if it does, indeed, emulate REPORT FORM properly.
  98.  
  99. **
  100. Differences in output between the PRG and the FRM:
  101.  
  102. Subtotals are printed on the same page.  I just can't stand to do it otherwise
  103. <grin>.  You may have to adjust the variable "max_lines" downward to avoid
  104. page overflow.
  105.  
  106. Since FRMs do not currently store the type of each expression, the only way I
  107. can figure out to right-justify numeric data is to check the field which 
  108. specifies "number of decimals", and create a PICTURE clause if that number is
  109. greater than 0.  This means that numeric fields with 0 decimals will display
  110. left-justified unless you add the PICTURE clause yourself.
  111.  
  112. **
  113. Planned enhancements include:
  114.  
  115. o support for command-line options of REPORT FORM (???);
  116. o ability to depart from the <ugh> format for subtotals, etc. used by REPORT
  117.   FORM (thought I'd get the emulation right before changing it);
  118. o optional breakup into separate PRGs (or one PRG) instead of a procedure file,
  119.   output file specification with warning/verification for overwrite.
  120. o script file and/or text file/template file input
  121.  
  122. **
  123. History:
  124.  
  125. First Beta release   (0.2): 8/5/87
  126. Second Beta release  (0.4): 8/7/87
  127. Third  Beta release  (0.6): 8/15/87
  128. Fourth Beta release (0.6a): 8/26/87
  129.  
  130.  
  131. 0.4 fixes and changes:
  132.  
  133. o USEs and SELECTs now moved to *before* control-break "holds" initialized.
  134. o A misunderstanding of how C "break" works caused @...SAYs in PROC PRINLOOP to
  135.   only show fields up to the first totalled field.  Fixed (I hope).
  136. o added PICTURE clauses to right-justify numerics (with limitations, see above).
  137. o changed initializations of headers to use [] instead of "" so embedded quotes
  138.   would not screw things up.
  139. o put in an IIF() for indentation of "** Subtotal **" and the like, the better
  140.   to emulate FRM stuff.
  141.  
  142. 0.6 fixes and changes:
  143.  
  144. o fixed subscript problem (?) that was causing garbage in output (sometimes)
  145. o optimized output code slightly, eliminated major_tots logical field, etc.
  146. o added options for procedure prefixes, tabs, loop condition, initial command, 
  147.   ending command.
  148. o sent help and error messages to stderr, and beefed 'em up.
  149.  
  150. 0.6a fixes and changes:
  151.  
  152. o changed names of subtots & tots to numerics instead of using the whole field
  153.   expression, which was pretty stupid [grin]--alias names and complex 
  154.   expressions came out pretty weird.
  155. o fixed totals and subtotals so they print on the same line.
  156. o fixed so grand totals would not print on a separate page.
  157. o fixed margin in minor total routine.
  158. o changed the date format so it now prints to the right with the time under it.
  159.   This is the first real departure from deBASE's FRM output, I could make it
  160.   optional but this is the way I like it.
  161.  
  162.  
  163.  
  164.  
  165. **
  166. Commercial time:
  167.  
  168. FRM2PRG was developed using information and techniques from the book:
  169. dBASE POWER: Creating and Using Programming Tools, which will be published
  170. by Ashton-Tate in the fall of 1987 (I'm a co-author).   Turbo C source code for
  171. FRM2PRG will not be released until at least the publication date of the book.
  172.  
  173. FRM2PRG will probably not be released as shareware except for Beta
  174. versions.  (On the other hand, if reaction is negligible, it'll probably become
  175. PD <grin>.)  To get upgrades, etc., subscribe to the Synergy
  176. Utilities.  The Synergy Utilities are a collection of tools for dBASE III
  177. Plus, Quicksilver, Clipper, and FoxBASE+.  Most of these are BIN/OBJ format
  178. utilities, in fact, FRM2PRG is not only my first real C program, it's the
  179. first COM file in the utilities.  Some of the other Synergy Utilities are:
  180.  
  181. CD       get current drive/directory
  182. ENCRYPT  encrypt/decrypt strings
  183. SRCHPATH search DOS path for file
  184. FINDFL   find all files matching a wildcard, return all directory info
  185. NETINFO  get net name (more to come)
  186. MEMCHECK check memory on the system, also how much when dBASE was loaded
  187. DIREXIST check existence of drive/directory
  188. FSIZE    get size of file(s)
  189. CHATTR   change attributes of (files)
  190. SAT      SuperAt(), find every occurrence of a substring in one CALL
  191. HANDLES  Get *true* amount of available file handles
  192. RAND     Random number generator
  193. IN/OUT   Port access
  194. LBMRD    Litebars using UI's MRD.
  195. SOUNDEX  get SOUNDEX codes
  196. DELAY    delay specified number (and fraction) of seconds
  197. VALDRIVE find out all valid drives on system
  198. EQUIP    find out what equipment you're running on
  199. GETCOLOR find out what the color is on the screen now (at cursor position)
  200. LITEBAR  very fast, versatile, portable lightbar menus--also incorporates some
  201.          screen stunts such as save/restore screen, hilite/color/fill/fade
  202.          windows on screen, scroll windows left/right/up/down, etc.
  203. SINE/COSINE/TANGENT etc.
  204.  
  205. Most of the utilities are available in OBJ form for Clipper CALL and QS CCALL.
  206. Custom modules are a possibility.  If they are considered to be useful for
  207. enough people, no charge!  Eventually I hope to add all the functions in
  208. Rettig's library, C Tools, etc. (and more).  Source code (in assembly
  209. language, C, and Pascal) is available to registered users--also example PRGs
  210. to demonstrate their usage.  At this time documentation is in short supply
  211. <grin>, but I'm working on it.
  212.  
  213. Once you subscribe, you are a member of the Synergy BBS, and can download
  214. newer versions, get support, etc. through the BBS.
  215.  
  216. To subscribe to the Synergy Utilities, send $75 to:
  217.  
  218. R. Russell Freeland
  219. Synergy Corp.
  220. 1780 SW 43 Ave.
  221. Ft. Lauderdale, FL 33317
  222.  
  223. ...enclose $5 extra for shipping and handling if you want a disk mailed to
  224. you.  (Most of the utils are very small, as they are mostly written in
  225. assembly language, so download time is minimal.)
  226.  
  227. Good luck with FRM2PRG, I hope you enjoy it.
  228.  
  229. R. Russell Freeland
  230. 8/26/1987
  231. CIS 76146,371