home *** CD-ROM | disk | FTP | other *** search
- FRM2PRG -- another nifty little Synergy Utility for dBASE III Plus
-
- FRM2PRG attempts to convert a dBASE FRM file to a PRG (procedure) file. As
- this is my first decent-sized C program, so it is fairly crude--if it
- generates some revenue I will definitely enhance it, but first I thought I'd
- get some suggestions for enhancements other than those I want myself (and
- bug-fixes, of course <grin>).
-
- **
- What are the foreseen uses for this thing?
-
- I often prototype reports using MODI REPO, then when the thing gets
- OK'd I write a custom PRG to do the report, adding some enhancements. This
- will enable me (and you) to generate a PRG file easily using this method, and
- just make (hopefully) minor modifications.
-
- FRM2PRG should make life easier when converting someone else's app.
-
- ...and, of course, those of you who actually *use* FRM files with compiled
- apps can now compile them right into the EXE files as PRGs.
-
- **
- Version 0.6a BETA usage:
-
- At the DOS prompt: FRM2PRG {switches} infilename{.frm} { > outfilename.ext }
-
- Expressions in curly braces are optional. The "infilename" can have a drive and
- path if you like (and, of course, so can the "outfilename").
-
- Output is written to the console, but can be redirected to a PRG file or
- whatever ("outfilename". The file which is created will have several
- procedures, one of which is called "[prefix]_main" ([prefix] defaults to "any",
- but can be specified--see "switches" below). As the FRM file does not contain
- any reference to the name of the database file(s) used, there are some places to
- fill it (them) in. So, you can setup your DBF's and relationships, etc., then:
- SET PROC TO <whatever you redirected to>
- DO any_MAIN
- CLOS PROC
- ... or you can fill in the SELECTs and USEs within file generated by FRM2PRG.
- You can also, of course, insert SET RELATION commands.
-
- **
- Switches:
-
- Switches must be preceded by "/" or "-". They can be either upper or lower
- case. Most switches require a parameter to follow immediately. The switches
- supported by version 0.6a are:
-
- T (t) -- Tab width -- number of spaces for indents (default: 4);
- P (p) -- Three letter prefix for procedure names (default: "any");
- L (l) -- *Loop condition (default: ".NOT. EOF()");
- I (i) -- *Initial command after opening databases (default: "GO TOP");
- E (e) -- *Ending command (default: "CLOSE DATA").
-
-
- The latter three switches may often encompass more than one "word", if so, it
- gets a little trickier--you have to enclose the switch, the preceding "-" or
- "/", and the parameter in double quotes, i.e., "/iGO thisrec". By the way,
- in the case of the "Initial command" and "Ending command", you can override
- them entirely by using /i or /c with no parameter.
-
- Examples:
-
- FRM2PRG /T5 /pCUS "-iSET FILTER TO x=y" "/L&scope" myreport
-
- FRM2PRG will attempt to read myreport.frm and send output to the screen.
- Indentation will be in multiples of 5, procedure names will start with "CUS_",
- the initial command after opening databases will be "SET FILTER TO x=y", and
- the terminating condition will be "&scope" (main loop will say
- "DO WHILE &scope"). Note that "DO WHILE &<anything>" is not a bright move, by
- the way [grin].
-
- FRM2PRG "-iON ESCA DO prntrupt" "/EDO endrep" monthend >monthend
-
- FRM2PRG will read MONTHEND.FRM and create MONTHEND (no extension, not a good
- idea generally). No check will be made to see if MONTHEND. exists, since
- the "outfilename" is not actually a parameter to the program, but to DOS.
- Procedures with have the default prefix "_any", indents will be in multiples of
- 4, intitial and ending commands will be, respectively, "ON ESCA DO prntupt"
- and "DO endrep".
-
- **
- Capabilities & limitations:
-
- FRM2PRG should convert most dBASE III Plus FRM files. Multiple-row headings
- should work fine. Multiple-row fields or expressions should also work, up to
- 4 deep. FRM2PRG will have a problem, however, if you stack fields and put a
- space between "'" and "+":
- EXPRESSION+";"+EXPRESSION && OK
- EXPRESSION+';'+EXPRESSION && OK
- EXPRESSION+ ";" +EXPRESSION && NOT OK
- EXPRESSION+ ';' +EXPRESSION && NOT OK
-
- The biggest limitation of this version is that it attempts to emulate REPORT
- FORM exactly. As there are a lot of options such as "plain page",
- "summary only", etc. that can produce varied output, FRM2PRG needs some Beta
- testing to see if it does, indeed, emulate REPORT FORM properly.
-
- **
- Differences in output between the PRG and the FRM:
-
- Subtotals are printed on the same page. I just can't stand to do it otherwise
- <grin>. You may have to adjust the variable "max_lines" downward to avoid
- page overflow.
-
- Since FRMs do not currently store the type of each expression, the only way I
- can figure out to right-justify numeric data is to check the field which
- specifies "number of decimals", and create a PICTURE clause if that number is
- greater than 0. This means that numeric fields with 0 decimals will display
- left-justified unless you add the PICTURE clause yourself.
-
- **
- Planned enhancements include:
-
- o support for command-line options of REPORT FORM (???);
- o ability to depart from the <ugh> format for subtotals, etc. used by REPORT
- FORM (thought I'd get the emulation right before changing it);
- o optional breakup into separate PRGs (or one PRG) instead of a procedure file,
- output file specification with warning/verification for overwrite.
- o script file and/or text file/template file input
-
- **
- History:
-
- First Beta release (0.2): 8/5/87
- Second Beta release (0.4): 8/7/87
- Third Beta release (0.6): 8/15/87
- Fourth Beta release (0.6a): 8/26/87
-
-
- 0.4 fixes and changes:
-
- o USEs and SELECTs now moved to *before* control-break "holds" initialized.
- o A misunderstanding of how C "break" works caused @...SAYs in PROC PRINLOOP to
- only show fields up to the first totalled field. Fixed (I hope).
- o added PICTURE clauses to right-justify numerics (with limitations, see above).
- o changed initializations of headers to use [] instead of "" so embedded quotes
- would not screw things up.
- o put in an IIF() for indentation of "** Subtotal **" and the like, the better
- to emulate FRM stuff.
-
- 0.6 fixes and changes:
-
- o fixed subscript problem (?) that was causing garbage in output (sometimes)
- o optimized output code slightly, eliminated major_tots logical field, etc.
- o added options for procedure prefixes, tabs, loop condition, initial command,
- ending command.
- o sent help and error messages to stderr, and beefed 'em up.
-
- 0.6a fixes and changes:
-
- o changed names of subtots & tots to numerics instead of using the whole field
- expression, which was pretty stupid [grin]--alias names and complex
- expressions came out pretty weird.
- o fixed totals and subtotals so they print on the same line.
- o fixed so grand totals would not print on a separate page.
- o fixed margin in minor total routine.
- o changed the date format so it now prints to the right with the time under it.
- This is the first real departure from deBASE's FRM output, I could make it
- optional but this is the way I like it.
-
-
-
-
- **
- Commercial time:
-
- FRM2PRG was developed using information and techniques from the book:
- dBASE POWER: Creating and Using Programming Tools, which will be published
- by Ashton-Tate in the fall of 1987 (I'm a co-author). Turbo C source code for
- FRM2PRG will not be released until at least the publication date of the book.
-
- FRM2PRG will probably not be released as shareware except for Beta
- versions. (On the other hand, if reaction is negligible, it'll probably become
- PD <grin>.) To get upgrades, etc., subscribe to the Synergy
- Utilities. The Synergy Utilities are a collection of tools for dBASE III
- Plus, Quicksilver, Clipper, and FoxBASE+. Most of these are BIN/OBJ format
- utilities, in fact, FRM2PRG is not only my first real C program, it's the
- first COM file in the utilities. Some of the other Synergy Utilities are:
-
- CD get current drive/directory
- ENCRYPT encrypt/decrypt strings
- SRCHPATH search DOS path for file
- FINDFL find all files matching a wildcard, return all directory info
- NETINFO get net name (more to come)
- MEMCHECK check memory on the system, also how much when dBASE was loaded
- DIREXIST check existence of drive/directory
- FSIZE get size of file(s)
- CHATTR change attributes of (files)
- SAT SuperAt(), find every occurrence of a substring in one CALL
- HANDLES Get *true* amount of available file handles
- RAND Random number generator
- IN/OUT Port access
- LBMRD Litebars using UI's MRD.
- SOUNDEX get SOUNDEX codes
- DELAY delay specified number (and fraction) of seconds
- VALDRIVE find out all valid drives on system
- EQUIP find out what equipment you're running on
- GETCOLOR find out what the color is on the screen now (at cursor position)
- LITEBAR very fast, versatile, portable lightbar menus--also incorporates some
- screen stunts such as save/restore screen, hilite/color/fill/fade
- windows on screen, scroll windows left/right/up/down, etc.
- SINE/COSINE/TANGENT etc.
-
- Most of the utilities are available in OBJ form for Clipper CALL and QS CCALL.
- Custom modules are a possibility. If they are considered to be useful for
- enough people, no charge! Eventually I hope to add all the functions in
- Rettig's library, C Tools, etc. (and more). Source code (in assembly
- language, C, and Pascal) is available to registered users--also example PRGs
- to demonstrate their usage. At this time documentation is in short supply
- <grin>, but I'm working on it.
-
- Once you subscribe, you are a member of the Synergy BBS, and can download
- newer versions, get support, etc. through the BBS.
-
- To subscribe to the Synergy Utilities, send $75 to:
-
- R. Russell Freeland
- Synergy Corp.
- 1780 SW 43 Ave.
- Ft. Lauderdale, FL 33317
-
- ...enclose $5 extra for shipping and handling if you want a disk mailed to
- you. (Most of the utils are very small, as they are mostly written in
- assembly language, so download time is minimal.)
-
- Good luck with FRM2PRG, I hope you enjoy it.
-
- R. Russell Freeland
- 8/26/1987
- CIS 76146,371