home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 December / simtel1292_SIMTEL_1292_Walnut_Creek.iso / msdos / turbopas / turbogen.arc / TURBOGEN.MAN < prev   
Text File  |  1988-01-28  |  39KB  |  935 lines

  1.  
  2.  
  3.  
  4.                                      Background
  5.           
  6.           
  7.               After sorting through several Turbo-Pascal libraries (to many
  8.           at that), and adding some custom utilities I came up with several
  9.           standard libraries for myself.  Then  I purchased  Turbo DataBase
  10.           Toolbox  and  was  very  impressed with  its ease  of use.  After
  11.           incorporating my libraries and completing about one third  of the
  12.           first full sized DBMS application I realized that the code  I was
  13.           writing  would  have  to  be  written  over  and  over  for every
  14.           application I would  generate in  the future.    Somewhere  in my
  15.           early computer days I was taught that computers are best used for
  16.           any repetitive tasks.  Sooo, I took that first DBMS and used it's
  17.           format to create the TurboGenerator.
  18.           
  19.               There are many  routines contained  in the  Library  that are
  20.           not  called  from  TurboGen.  You  could  cull  them out  of your
  21.           finished products.  I  have tried  to keep  the original  code as
  22.           intact as possible, but modified to work within the  structure of
  23.           TURBOGEN.  At any rate you should study the libraries  and become
  24.           aware of what is there so you don't end up reinventing the wheel.
  25.           
  26.               Some people have commented about the time required to convert
  27.           function keys into  their common  names as  opposed to  using the
  28.           decimal or other non-string values.  I have  used this  method in
  29.           the interest of finished code readability.  Mainly for the person
  30.           using  TurboGen  and  needing  to  study  his   final  code.  The
  31.           technique used here makes the code read  like a  novel even  to a
  32.           non-pascal programer.
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.                                           0
  58.  
  59.  
  60.  
  61.           
  62.                                     Introduction
  63.           
  64.               Having worked with several 4th  level development  packages I
  65.           stole the best (to me at lest) features of each and included them
  66.           into  this  package.  TurboGenerator  will  create  Turbo  Pascal
  67.           source code to handle - User IO, File IO  and error  checking the
  68.           format of  which is  defined by  way of  a user  designed screen.
  69.           During the screen design phase  the user  paints the  screen with
  70.           background and field descriptors.  The TurboGenerator  takes over
  71.           and   creates  record   structures,  variables,   procedures  and
  72.           functions  for displaying  background, current  data, as  well as
  73.           data entry/updating.  The file IO  handlers create  code designed
  74.           to maintain keys, locate records, add new records etc.
  75.           
  76.               One of the utilities that I developed/modified is designed to
  77.           allow real time processing of function keys.  The concept  is one
  78.           of a data screen format which allows  the user  to wander  to any
  79.           AVAILABLE  field  on  the  screen for  entry/update.  During this
  80.           interaction function keys are used to perform such task as cursor
  81.           movement, calling help,  paging forward  or backward  through the
  82.           file,  etc.  The  data entry  routine handles  some of  the basic
  83.           input/editing  function.  You  can  write  custom  code  to allow
  84.           function  keys  to  trigger  any  type  of procedure  or function
  85.           desired.
  86.           
  87.               The  crossreference  utility  was a  standard lister/crossref
  88.           utility but I was always waiting for the  crossref to  print even
  89.           when  I  didn't  need  a  new  one.  So while  I was  making that
  90.           selectable I worked out a VERY BASIC handler for indenting.  This
  91.           works for the way I indent, and  can be  very useful  in locating
  92.           errors.  This  is  not  a  complete  indenter.  However   if  the
  93.           capabilities are kept in mind while writing  custom code  it will
  94.           work very well.  I know many of you  will turn  a eyebrow  at the
  95.           wide  print  option.  I just  can't stand  trunicated lines  on a
  96.           listing, wasting all that blank paper on the right margin. And it
  97.           makes many sections of INDENTED code easier to read.
  98.           
  99.               When I was forced to do windows (I fought like crazy,  we all
  100.           make mistakes) I turned to  the Public  Domain PibTerm  library I
  101.           got somewhere.  Sorry but I really can't remember where  for sure
  102.           so  I better  not give  somebody false  credit.  At any  rate the
  103.           routines in PibMenus and Pibscreens  are really  not bad  to work
  104.           with.  They execute smoothly and are not hard  to finger-out.  So
  105.           I  used  them  when  designing  my  Menu  generator,  after  some
  106.           modification.
  107.           
  108.               So now lets say you
  109.           have created code for a data file, with a menu, and  help screen.
  110.  
  111.  
  112.  
  113.  
  114.                                           1
  115.  
  116.  
  117.  
  118.           How to put it all together.  Either use include commands or block
  119.           copy/read them into one file.  It really matters little except if
  120.           working with more than one data file.  You will notice  that each
  121.           data  code  file  created  has  the compiler  directives, include
  122.           statements, etc. in it.  Well we cannot  duplicate that  and some
  123.           other work.  Well rather than complicate your life at run time we
  124.           simply create everything  you might  need and  let you  delete or
  125.           selective copy as you wish.
  126.           
  127.               This  selective  copy was  used to  solve the  OUTPUT/ Report
  128.           generator  needs.  Which  you  will notice  are missing  from the
  129.           system.  I have two problems with every  report generator  I ever
  130.           look at:
  131.           
  132.                   1.  They are so basic they don't let you do the job.
  133.           
  134.                   2.  They are so complex you spend to much  time designing
  135.                   your report.
  136.                           a.  When done they run very slow.
  137.           
  138.               After  considerable thought  hairpulling and  other inspiring
  139.           efforts I have concluded that I can do no better than anyone else
  140.           has todate.  Therefore  I will  continue to  write my  reports in
  141.           source code for  speed and  flexibility.  We can  expedite things
  142.           here a bit though.  If you look at  the procedures  generated for
  143.           displaying records on the screen you  can see  that you  can copy
  144.           fields as needed and  change the  output device  as needed.  Well
  145.           that's some help anyway.
  146.           
  147.           
  148.               The  libraries  provided are  the same  code used  to develop
  149.           TurboGenerator.  You could use it to  develop your  own generator
  150.           just in case my idea of good is  not your  idea of  good.  I have
  151.           tried to keep the routines in the libraries intact with regard to
  152.           author and giving credit.   Please look carefully at  these files
  153.           and give credit where credit is due.
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.                                           2
  172.  
  173.  
  174.  
  175.           
  176.                                     Requirements
  177.           
  178.               You will require the following in order to run TurboGen.
  179.                   1.  IBM-PC or Clone.
  180.                   2.  Dos 2.11 or above (MS or PC)
  181.                   3.  RAM .?? depends on how many fields you have defined.
  182.                   4.  Turbo Pascal Version 3.x
  183.                   5.  Turbo Database Toolbox.
  184.           
  185.           
  186.                                      Files used
  187.           
  188.               TurboGen.com   -  Main program
  189.               TurboGen.000   -  Main program overlay
  190.               *.TGS          -  TURBOGEN Screen file (ASCII)
  191.               *.FLD          -  Screen field list.
  192.               *.GEN          -  Output file from TurboGen (Data)
  193.               *.MNU          -  Output file form TurboGen (Menu)
  194.               *.HLP          -  Output file from TurboGen (Help)
  195.               CrossRef.com   - CrossReference Main Program
  196.               CrossRef.000   - CROSSREFERENCE overlay
  197.               
  198.               *.FMT          - Output from crossref formated output.
  199.           
  200.           
  201.                                Starting TurboGenerator
  202.           
  203.               Copy  TurboGen  onto  harddisk  directory  or onto  a working
  204.           diskette.
  205.           
  206.               At harddisk directory or with working floppy in default drive
  207.           enter.
  208.           
  209.               TURBOGEN <cr>
  210.           
  211.               TurboGen will comeup with its signon screen....
  212.           
  213.               You will have to provided a file name  and indicate  the type
  214.           of code you wish to generate.
  215.           
  216.               When the screen is  complete turbo  will do  it's stuff.  You
  217.           will have to  check each chapter for what kind  of stuff  will be
  218.           done.
  219.           
  220.               After completeing a task the program will return to  a system
  221.           prompt.
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.                                           3
  229.  
  230.  
  231.  
  232.                               Data file code generation
  233.           
  234.               After providing a file name and pressing <D> for Data for the
  235.           type of code TurboGen will clear the screen and  wait for  you to
  236.           design your screen.
  237.           
  238.               Do not be alarmed about seeing only a cursor on  this screen.
  239.           We  have  granted  you  the  entire  screen  to   work  on.  This
  240.           eliminates  TurboGen  from  having  anywhere  to  display current
  241.           cursor coordinates, helps, etc.  If you feel the need  for online
  242.           help just press F9 the help key.  You will be presented a list of
  243.           control keys and their purpose.  We will  describe these  keys in
  244.           just a few moments.
  245.           
  246.               BACKGROUND TEXT:
  247.           
  248.                   Simply  move  the  cursor  (with the  arrow keys)  to the
  249.                   starting location for your text.  Then type the  text you
  250.                   wish.  You will see it appear on the screen.
  251.           
  252.               DEFINE FIELD: (F1)
  253.           
  254.                   After moving the  cursor to  the exact  starting location
  255.                   for a field press F1  to define  a field.  A  window will
  256.                   open  into  which  you  will  describe  the  field  being
  257.                   defined.  As such:
  258.           
  259.                           Field Name:
  260.                                   You are given 10  characters to  create a
  261.                                   unique field name (
  262.           unique for this record).  If not using  record structure  then it
  263.           is your job to know about dups from  other code  you may  want to
  264.           use.  If  10  spaces  is  not enough  then make  do and  edit the
  265.           finished code.
  266.           
  267.                           Record Name:
  268.                                   This  is really  for future  expansion of
  269.                                   the  system.  We  hope to  allow building
  270.                                   more  than  one  record construct  on the
  271.                                   screen  and  the  proper  fields  will be
  272.                                   listed   within  the   proper  record(s).
  273.                                   Right now all fields are listed under one
  274.                                   record.  Which is the contents  of record
  275.                                   name in the first field on the screen.
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.                                           4
  286.  
  287.  
  288.  
  289.                           Type:
  290.                                   x,X  are  strings;  X force  uppercase on
  291.                                   entry;
  292.                                   I is integer;
  293.                                   R is real;
  294.                                   B is Boolean;
  295.           
  296.                                   Ok so I don't have  very many  data types
  297.                                   available,  but when  you think  about it
  298.                                   compound structures are made up  of these
  299.                                   simple  ones.  And  what  we  are  really
  300.                                   wanting   out   of   TurboGen    is   the
  301.                                   housekeeping  code  anyway.  Just  make a
  302.                                   dummy  for  any  compounds you  need then
  303.                                   edit code before creating that data file.
  304.                                   We do expect to modify the system  in the
  305.                                   future to allow more flexibility  in this
  306.                                   area.
  307.                           
  308.                           Length:
  309.                                   The  number of  characters allowed.  Must
  310.                                   be greater than 0.  For boolean this will
  311.                                   be  set  to  1  for  you  and  this field
  312.                                   skipped.
  313.           
  314.                           Decimals:
  315.                                   The number of  decimals for  real fields.
  316.                                   Only used if type is R.
  317.           
  318.                           Confirm:
  319.                                   Does user have to press a key to indicate
  320.                                   field  completion  or  does   the  system
  321.                                   advance  to  next  field  after receiving
  322.                                   LENGTH characters?
  323.           
  324.               After completing the last data item on this window the system
  325.               will save your field  somewhere in  it's confines  and remove
  326.               the window showing your original screen with a  new addition.
  327.               You will see a line of underscores representing  your defined
  328.               field.  There are  LENGTH number  of underscores  starting at
  329.               the location you placed the cursor on before pressing F1.
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.                                           5
  343.  
  344.  
  345.  
  346.              EDITING FIELDS:
  347.           
  348.               Field editing is very limited with  this version.  I  hope to
  349.               return to this issue  and greatly  enhance.  But for  now you
  350.               place your cursor on the FIRST underscore of a  defined field
  351.               and press F1.  This will display the  field as  last defined.
  352.               You are able to alter any data  item....but you  cannot alter
  353.               the screen location  for a  field.  (I said  I'd get  back to
  354.               it).
  355.           
  356.               Well your field is now added to the list and you  may proceed
  357.               to another  location on  the screen  for background  or field
  358.               design work.
  359.           
  360.               You  may  have  already  noticed that  the system  checks for
  361.               duplicate names FOR THE CURRENT SCREEN only.  This means that
  362.               if  you  are  incorporating several  other sections  of code,
  363.               TurboGen has no way of knowing variable usage in  the foreign
  364.               code.
  365.           
  366.               REPLICATING FIELDS;
  367.           
  368.                   If you are doing a row(s) or column(S) of fields within a
  369.                   screen.  We have provided a vehicle for  quickly creating
  370.                   all the fields necessary IF THE FIELDS WILL  HAVE EXACTLY
  371.                   THE  SAME  TYPE  (r,i,x,X,b).  You  can  also   use  this
  372.                   technique  to  create  the  fields  then  alter  the type
  373.                   declarations to be arrays, then search&replace  the field
  374.                   names with the array names.  In any  event you  place the
  375.                   cursor on the first underscore of the  field you  wish to
  376.                   replicate.  Pressing  CTRL-F1  will  reward  you  with  a
  377.                   window  asking  which  direction  and count  you require.
  378.                   Then fields appear on the screen.  If  you look  at these
  379.                   fields TurboGen has used the cursor location  appended to
  380.                   the first char of the source field as the field name....
  381.           
  382.               DELETING FIELDS;
  383.           
  384.                   Move  the  cursor  to  the first  underscore of  field to
  385.                   delete and  press F1  as if  you were  going to  edit the
  386.                   field.  Blank out the field name and press <ESC> key.
  387.           
  388.               LISTING FIELDS (F2);
  389.                   
  390.                   Pressing F2 will open a  window into  which is  printed a
  391.                   list  of the  currently defined  fields.  15 fields  at a
  392.                   time are listed.
  393.           
  394.               SAVING SCREEN  (F3);
  395.  
  396.  
  397.  
  398.  
  399.                                           6
  400.  
  401.  
  402.  
  403.           
  404.                   System will write the background text to filename.TGS and
  405.                   any  fields  defined  will  be  written  to filename.FLD.
  406.                   Filename  being  the  filename provided  at startup.  You
  407.                   will  see  the underscores  for defined  fields disappear
  408.                   from  the  screen.  When  they  reappear  the  process is
  409.                   complete and you may proceed.
  410.           
  411.               LOADING SCREEN (F4);
  412.           
  413.                   This function key will  present a  small window  with the
  414.                   current filename in it.  If the
  415.           filename is correct press  return.  If not  correct then  enter A
  416.           EXISTING  *.TGS  file.  You  do  not  enter  the  extension.  The
  417.           filename given becomes the current  default file.  The  TGS files
  418.           are  ASCII  files  but  the  system  only  loads  files  with TGS
  419.           extensions.  After finding (or not finding) the background screen
  420.           file,  TurboGen  looks  for  the filename.FLD  (fields) file.  If
  421.           found that is also loaded and the fields  therein will  appear as
  422.           underscores on the screen.  This IF EXISTING construct allows you
  423.           to create ASCII screen files with any editor.  Then pick  up that
  424.           file with TurboGen and add fields as needed.
  425.           
  426.               PRINTING SCREEN DOCS;
  427.           
  428.                   This will print the background screen text (screen dump).
  429.                   It  then   lists  all   defined  fields   showing  cursor
  430.                   locations, name,  type, length,  decimals and  confirm to
  431.                   the current list device.
  432.           
  433.               INSERT NEW LINE (Ctrl-S);
  434.           
  435.                   Ctrl-S creates  a new  blank line  at the  current cursor
  436.                   location.  All  lines  on  or  below  the  current cursor
  437.                   location are  moved down  one line  with the  bottom line
  438.                   moving  into  that  big lost  line in  the sky  (text and
  439.                   fields).
  440.           
  441.               DELETE LINE (Ctrl-D);
  442.           
  443.                   Ctrl-D moves  the current  cursor line  to that  big lost
  444.                   line  in  the  sky and  raises all  lines below,  up one.
  445.                   Which of course creates a blank line on the bottom of the
  446.                   screen.
  447.           
  448.               ERASE (BLANK) SCREEN (F8);
  449.           
  450.                   Want to start all over, Press  F8.  The current  file and
  451.                   code type remain the same.
  452.  
  453.  
  454.  
  455.  
  456.                                           7
  457.  
  458.  
  459.  
  460.           
  461.               HELP (F9);
  462.           
  463.               BUSINESS GRAPHICS (F10);
  464.           
  465.                   This is a toggle.  The bottom (25th) line will show a new
  466.                   definition for the function keys.  Pressing arrow keys to
  467.                   move  the  cursor  will draw  a line  in the  Double Line
  468.                   Graphics  characters.  Pressing  the proper  function key
  469.                   will provide the corners, junctions etc.
  470.           
  471.               INS / DEL CHARACTERS;
  472.           
  473.                   The INS and DEL keys are to Insert / Delete the character
  474.                   under the  cursor.  These keys  can allow  you to  move a
  475.                   field somewhat on the screen.  When used along with Ctrl-
  476.                   S and Ctrl-D you can do  quite a  bit of  screen editing.
  477.                   But still not the best it can be.
  478.           
  479.           
  480.           DESIGN OF SCREEN COMPLETE:
  481.           
  482.               When you are happy with  your creation  and want  to generate
  483.           some  code,  press  the  End  key.   I hope  you have  saved your
  484.           creation.  Although not a requirement  it will  save time  if you
  485.           have to modify a screen  for some  reason.  If you  find yourself
  486.           modifying a screen don't forget to adjust for any custom code you
  487.           may have provided to the first version.  Or simply block copy the
  488.           new background, display  and get  procs into  the old  code. Your
  489.           code will be found in the file  filename.GEN.
  490.           
  491.           
  492.           ABORTING:
  493.           
  494.              If you find yourself at the  design screen  and wish  to abort
  495.           without writing code to a file.  Just press CTRL-END.
  496.           
  497.  
  498.           
  499.           NOTICE:
  500.           
  501.                 TURBO TOOLBOX CONSTANTS:
  502.           
  503.                   The TOOLBOX  requires several  constants be  declared and
  504.                   before compiling you should extract the record structure,
  505.                   create a short  program to  report the  SIZEOF(record) as
  506.                   described in the TOOLBOX manual.  Then take this  size to
  507.                   the SETCONST.PAS program and create  an include  file for
  508.                   the constants needed.  I  just block  read this  into the
  509.  
  510.  
  511.  
  512.  
  513.                                           8
  514.  
  515.  
  516.  
  517.                   program   file   just   before  the   ACCESS.INC  include
  518.                   statements.  If you are fuzzy about what is going on here
  519.                   you  had  better  read  your TOOLBOX  manual a  bit more.
  520.                   These  constants  are  VERY   IMPORTANT  to   the  proper
  521.                   execution of your program.
  522.           
  523.                   Turbogen creates a file of  *.SIZ which  you can  use for
  524.                   the above sizeof task.  However, this  file has  it's own
  525.                   record  structure  and  if  you  have changed  the record
  526.                   constructs in your main code then those same changes have
  527.                   to be made here.  I use this SIZ file only on  the simple
  528.                   one record  one file  screen I  set up.  Another  note of
  529.                   interest is to run this SIZ file through Turbo  (RUN) for
  530.                   any system you create which will deal with more  than one
  531.                   data file.  In other words check the sizeof on all record
  532.                   constructs and keys for those records.  You'd be surprise
  533.                   the  number  of  times  systems  have  gone out  to lunch
  534.                   because someone added that little extra data file  and it
  535.                   dictated a  change to  the b-tree  constants but  was not
  536.                   actually checked......
  537.           
  538.               MAKING DATA FILES:
  539.           
  540.                   There are different schools of thought on this and
  541.           my mind is made up.  At least  this is  what I  find safest.  You
  542.           see the Toolbox manual and most database environment  provide you
  543.           with a method of opening  files and  if the  file does  not exist
  544.           then one is created.  Well I have had some problems  with clients
  545.           losing large data files because  some off  the wall  error caused
  546.           the application to think the file was  not there  and made  a new
  547.           empty one.  OUCH!  Yeah I know the program is suppose to know the
  548.           difference between no file and drive not ready or some other such
  549.           error, and why not ask the user for permission before making that
  550.           new file.  I have tried them all and still  some fluke  causes an
  551.           accident. From: the programer never expected a FAT table error so
  552.           didn't trap it, to the user  didn't know,  when he  answered your
  553.           prompt, that the file would be erased.
  554.           
  555.                   In  light  of these  hairpulling (I  ain't got  much hair
  556.                   left.) sessions I have adopted the following for  my file
  557.                   creation and opening procedures.
  558.           
  559.                           First  time  a  piece  of  code  is run  the open
  560.                           command is altered to  a make  command.  Then the
  561.                           command is  changed to  an open  command.  If the
  562.                           make is nowhere in the code how  can we  remake a
  563.                           file?  Now  after  initial debugging  and testing
  564.                           the make is again reissued to create  blank empty
  565.                           usable  data  files.  Then a  decision has  to be
  566.  
  567.  
  568.  
  569.  
  570.                                           9
  571.  
  572.  
  573.  
  574.                           made.  Do we give  the user  blank files  to work
  575.                           from or, create a  special utility  program which
  576.                           will make files  as needed  but NOT  BE AVAILABLE
  577.                           during normal running.  There are times  when you
  578.                           may need  one or  the other  and times  when some
  579.                           other course will  be needed  but I  have written
  580.                           hundreds of DBMS applications and have  found the
  581.                           need   to   create   data   files  in   only  one
  582.                           application.  And that creates to a  scratch file
  583.                           for independent processing and later merging into
  584.                           the master file.  Therefore  we still  never make
  585.                           the master file within the runtime code.
  586.               KEYS:
  587.           
  588.                   Another of those  things that  I want  to cleanup  is the
  589.                   methods employed to  handle keys.  I  made a  decision to
  590.                   handle  only  strings  in  this version.  Too  many other
  591.                   functions  to cleanup.  Then  I would  go back  and allow
  592.                   integer  as well  as string  key fields.  Well  I haven't
  593.                   gotten back in yet, but  I will.  So  here are  the rules
  594.                   for now.
  595.           
  596.                           1.  The first field on the  screen is  assumed to
  597.                           be your key.
  598.           
  599.                           2.  The key field should be string type only.
  600.           
  601.               Now that  I have  laid those  limitations on  ya lets  take a
  602.               closer look at them.  Number 1 is not carved in solid rock as
  603.               you are generating source code so if you want multiple fields
  604.               in your key then just move things around in the source a bit.
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.                                          10
  628.  
  629.  
  630.  
  631.               Number  2  says you  should define  it as  string type.  Once
  632.               again you can go into the source and tickle any way you like.
  633.               JUST  KEEP  YOUR  KEYS STRINGS.  If  you take  a look  at the
  634.               source  you  will  see  Turbogen  created  a  global variable
  635.               called <filename>KEY of the length  of field  number 1.  This
  636.               is the real file key and any  changing you  make to  field IO
  637.               should end up here as string data before file IO.
  638.           
  639.           
  640.           COMPILING:
  641.           
  642.              Now with  your source  code generated,  the  toolbox constants
  643.           set (correctly), load turbo  and compile  & run  the code  (hint:
  644.           <filename>.GEN).
  645.           
  646.             Then don't forget to change the make to an  open or  just leave
  647.           it until initial testing is complete in case  you have  to change
  648.           your record structure.  If you do  that then  you didn,t  do your
  649.           homework.
  650.           
  651.           
  652.           MULTIPLE DATA FILES;
  653.           
  654.              Generate each one separately.  Then write or pick one piece of
  655.           code as the main program.  Modify the Generated code so as not to
  656.           duplicate the includes etc, make it an  overlay and  include into
  657.           the  main  program.  Then  use  TurboGen  to  generate a  MENU to
  658.           control access to each datafile overlay. This works if you do not
  659.           need common access to each.
  660.           
  661.               If common access is needed then proceed as above  because you
  662.           still will do data  entry/updating on  a file  by file  basis for
  663.           most files.  Like the customer file.  You  will add/update/delete
  664.           customers from this  overlay.  But during  Invoice entry  you may
  665.           need access to the customer record by customer number to properly
  666.           address invoice and  check customer  balance or  status.  In this
  667.           case you
  668.           can  do  basic  file  maintenance  from the  overlay.  Except you
  669.           should pull out  the CUSTOMER_FIND  procedures, and  the customer
  670.           record declarations and place them in the global area of the main
  671.           program.  Now when  you need  to locate  a customer  simply input
  672.           customer number pass it to  the customer  find proc  which either
  673.           loads the record or clears out  the customer  record buffer  on a
  674.           not OK condition.  This way you have file  records global  to all
  675.           your code and still allow individual file updating  to be  off on
  676.           overlays.
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.                                          11
  685.  
  686.  
  687.  
  688.           TYPICAL PROGRAM STRUCTURE;
  689.           
  690.               Toolbox Constants;
  691.           
  692.               Toolbox includes;
  693.           
  694.               TYPES;
  695.                  File1type record =
  696.                    field1 : string[??];
  697.                       .
  698.                       .
  699.                   fieldN :
  700.                  end;
  701.           
  702.                  File2type record =
  703.                    field1 : string[??];
  704.                        .
  705.                        .
  706.                    fieldN :
  707.                    end;
  708.           
  709.               Var;
  710.                  file1 : file1type;
  711.                  file1key : string[??];
  712.                  file1file : datafile;
  713.                  file1index: indexfile;
  714.           
  715.                  file2 : file2type;
  716.                  file2key : string[??];
  717.                  file2file : datafile;
  718.                  file2index: indexfile;
  719.           
  720.               (*$I Globtype.GEN *)
  721.               (*$I LIBRARY1.GEN *)
  722.               (*$I PIBSCREN.INC *)
  723.               (*$I LIBRARY2.GEN *)
  724.               (*$I PIBMENUS.GEN *)
  725.           
  726.             Any specialized record location and retrival  for files  1  & 2
  727.           that might be needed by all.
  728.           
  729.           Overlay file1.gen
  730.           
  731.           overlay file2.gen
  732.           
  733.           begin
  734.            (* main menu driver here *)
  735.           end.
  736.  
  737.  
  738.  
  739.  
  740.  
  741.                                          12
  742.  
  743.  
  744.  
  745.                                     Error Handler
  746.           
  747.           
  748.               The error handler is located in the Library2.GEN file.  It is
  749.           broken  into  two different  procedures.  Ioerror and  Data entry
  750.           error  sections.  There  is  an interrupt  24 error  handler that
  751.           pibscreen uses but I have not had time to make  full use  of this
  752.           great vehicle.
  753.           
  754.               Now the two error handlers are  broken up  so you  can tickle
  755.           the data entry errors as you see fit.  You should not have  to do
  756.           much to the file IO handler.  But for each application you should
  757.           change the application dependent  error messages  as you  see fit
  758.           then  call  showerror  pointing to  the proper  numbered message.
  759.           Take a quick look at the code and this should be clear.
  760.           
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.                                          13
  799.  
  800.  
  801.  
  802.                                    Menu Generation
  803.           
  804.           
  805.           This is about as straight forward as we can get.
  806.           
  807.           Enter your filename at  the signon  screen and  press M  for menu
  808.           type code.
  809.           
  810.           Then simply fill in the menu data screen.
  811.           
  812.                   MENU TITLE
  813.           
  814.                           This is the menu title text string  which appears
  815.                           within  the box  frame surrounding  the menu.  If
  816.                           you do not wish a title just leave blank.
  817.           
  818.                   HOW MANY MENU ITEMS:
  819.  
  820.                           This sets up lots of different loops  both during
  821.                           code generation and  during menu  runtime.  It is
  822.                           simply the number of items  on the  menu.  DO NOT
  823.                           COUNT QUIT.  The quit is handled  for you  by the
  824.                           system.
  825.           
  826.                   MENU ROW/COL:
  827.           
  828.                           Just the upper  left corner  of the  menu window.
  829.                           The width and height are automatically handled by
  830.                           Pibmenus.  BUT  you  do   have  the   ability  to
  831.                           override  this  by  altering  the HEIGHT  & WIDTH
  832.                           variables within the finished menu  code.  If you
  833.                           make these variables non zero then  Pibmenus will
  834.                           use your values and not it's own.
  835.           
  836.                   DEFAULT MENU ITEM:
  837.           
  838.                           Which menu item to highlight  when menu  is first
  839.                           called.  You may notice that the code resets this
  840.                           default value within it's own loop.  Well this is
  841.                           because of a problem with a not so close clone in
  842.                           my domain.  That machine does  not allow  my full
  843.                           use of the screen  saving options  in Pibscreens.
  844.                           Since I can't stack screens, and need  windows, I
  845.                           just  reactivate windows  already on  the screen.
  846.                           This only makes sense if the menu  picks-up where
  847.                           the user left off.
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.                                          14
  856.  
  857.  
  858.  
  859.                           This brings up a point  the library  provided can
  860.                           be modified to do some real  impressive windowing
  861.                           and  screen  saving work.  But  this is  real RAM
  862.                           expensive so you may  want to  try it  before you
  863.                           commit  yourself.  This  system  assumes   a  RAM
  864.                           shortage and does not stack screens.  This  is in
  865.                           keeping  with a  DBMS which  needs data  area not
  866.                           stacked screen RAM.  But since  RAM is  cheap why
  867.                           not.  Check  the  help  screen  chapter  for more
  868.                           information on saved screens.
  869.           
  870.           After completing the Menu Data Screen press  <END> and  you input
  871.           the menu text for each menu item followed by the actual call made
  872.           for that menu item.  You do this for each menu item up
  873.           to your number of menu items.
  874.           
  875.           YOU DO NOT HAVE TO INCLUDE OR ALLOW FOR <QUIT>.
  876.           
  877.           The quit option on menus is automatically handled for you  as the
  878.           Menu count +1 item on the menu.
  879.           
  880.           When you have  entered the  last menu  item and  associated call,
  881.           TurboGen will write your menu to Filename.MNU.  Which you include
  882.           as necessary.
  883.           
  884.           You should take a short look at the menu code before including or
  885.           using.  You  should  note  that  TurboGen  has  created  a  DUMMY
  886.           procedure for every menu call you provided.  A dummy procedure is
  887.           simply the procedure name with a begin/end.
  888.  
  889.           This is  to allow  the proper  compliation of  the menu  code and
  890.           apparent oper    DATA but no real  work is  done until  the dummy
  891.           procs are replaced or completed.
  892.           
  893.           CALLING A MENU:
  894.           
  895.              The menu you created will be  in the  file filename.MNU.  With
  896.           filename being the file name you  entered at  startup.  That same
  897.           file name is used in creating the menu procedure.
  898.           
  899.              Example:
  900.                 Assume you entered MAIN as a filename at TurboGen startup.
  901.                 Your menu code would be located in the file MAIN.MNU.
  902.                 The main procedure within that file is called MAIN_MENU.
  903.                 So to use you simply include into your application with:
  904.  
  905.                   (* $I MAIN.MNU  *)
  906.  
  907.                 Then when needed, you access your menu by:
  908.  
  909.                        MAIN_MENU;
  910.  
  911.  
  912.                                Help Screen Generating;
  913.  
  914.               I am one of those programers who feels strongly that a
  915.           software package should carry it own help ONLINE.  Well there are
  916.           several was to do this and most of the time you can give one hell
  917.           of a lot of help with an entire screen of data.  This help screen
  918.           generator is just that ONE SCREEN.  If you want pages or
  919.           scrolling then use some of the text file access methods mentioned
  920.           in many of the books and articles on Turbo.  Or use TurboGen to
  921.           make a datafile of help records.  Which are displayed in a
  922.           window....
  923.  
  924.              This is a add-on that helps with that one page help screen.
  925.           Just start TurboGen and after giving a file name press H for help
  926.           code generation.  You will be presented a blank screen.  You may
  927.           not define any fields here.  Just enter background text as in
  928.           data file generation.  When screen is complete you press <END>
  929.           and your code will be written to filename.HLP.
  930.  
  931.              The procedure is called HELP_filename.  This procedure will
  932.           handle the display of and processing of - Press any key to
  933.           continue.  Which is used to allow the user time to digest the
  934.           help screen.
  935.