             MEMBERS -- Membership Tracking Package
                       Code Documentation

(The  following code documentation is provided in place the  user 
documentation normally found here.)  

General Comments
----------------

Functionally,  the MEMBERS program is very basic (maintain a mem-
bers list and print reports and labels from it).  It is presented 
as  an  example  of a user-interface design.   I have  used  this 
design  in several more complex applications and am pleased  with 
its performance.   The menu control code, contained in MDMAIN and 
MDPROC, is very easy to recycle and modify, allowing more time to 
concentrate on specifics of the application.   I have also  found 
that  the  design requires less user training than others I  have 
used.  If you find any part if this program useful,  you are wel-
come to use it under one condition, IMPROVE IT FIRST!.


Module Dispatch Structure
-------------------------

          - * -------------------------
         |          |       |         |                     
         |         AM-1  MDKEYSET  MDFIELDS             
         |
         |- Edit ------------------------------------------
         |          |       |         |         |         | 
         |         AM-2   MDMOD    MDRECALL  MDPACK    MDINDEX
         |
MDMAIN --|- Setup -------------------------------
         |          |       |         |         |           
         |         AM-3  MDMODQRY  MDMODFRM  MDMODLBL   
         |
         |- Reports -------------------
         |          |       |         |                     
         |         AM-4  MDREPORT  MDLABEL              
         |
          - Help ----------------------
                    |       |         |                     
                   AM-5  MDSHODOC  MDSHODOC              
                            

PRG File Notes
--------------

MDMAIN    This is the master control program for the application. 
          It   is  responsible  for  environment  initialization, 
          loading in-memory procedures (MDPROC),  file checking & 
          verification  (via MDGEN),  error  trap  initialization 
          (ERRCHK) and menu control. All other modules are called 
          directly or indirectly by MDMAIN.

MDPROC    This  file  holds  the  in-memory  procedures  used  by 
          MEMBERS.  There  are three basic types of procedures in 
          this file:

          - utility procs for color control, message display etc.
          - menu decode and display procedures
          - @ GET/SAY procs (placed here for speed mostly)

MDGEN     This  module is executed once by MDMAIN.  It checks the 
          directory for various MEM,  DBF,  NDX files required by 
          the  package.   Where  possible,   missing  files   are 
          constructed by MDGEN.

ERRCHK    This  is the error trap module (executed via ON ERROR). 
          It attempts recovery from index file errors and printer 
          errors.  All other errors are recorded along with other 
          program status in an ERR file.  Non-recoverable  errors 
          cause program execution to be terminated. 

AM-1      This  module displays a quick-help screen for pull-down 
          menu #1 (* menu).

MDKEYSET  This  module is a facility allowing the user to  assign 
          text  to function keys F2 thru F10.   The function  key 
          text is recorded in MDKEYS.DBF for subsequent sessions.
  
MDKEYINT  This module reads MDKEYS.DBF and sets the function  key 
          text accordingly. It is called by MDMAIN during startup 
          and by MDKEYSET.
 
MDFIELDS  This  module displays the name and description of  each 
          field  in  the MEMBERS database.   The  information  is 
          pulled  from  the  GENMBR.DBF  file  which  also  holds 
          the field information necessary to create MEMBERS.DBF.

AM-2      This  module displays a quick-help screen for pull-down 
          menu #2 (Edit menu).

MDMOD     This  module  houses the Edit facility for the  MEMBERS 
          database.   It initially displays a setup screen  which 
          allows the user to select an index file, and optionally 
          select  a query (.QRY) file from those available on the 
          directory.  When  setup is complete,  it  displays  the 
          Membership  Information Form screen.  At this point the 
          user  is free to edit the displayed record  or  perform 
          any  of the following via keys displayed at the  bottom 
          of the screen:

          PgUp   - go to previous record
          PgDn   - go to next record
          ^Home  - append a new blank record (and display it)
          F1     - mark/un-mark record as deleted
          ^PgUp  - search for a record based on the index file
                   selected.
          ^End   - return to menu


          If  a query file is selected,  it is used to set  up  a 
          filter  which  limits the accessable records  to  those 
          matching the query specifications.

MDRECALL  This  module  will  recall all deleted records  in  the 
          MEMBERS database.

MDPACK    This module packs the MEMBERS database.

MDINDEX   This  module  re-constructs  all  index  files.   (Uses 
          original index commmands, not the reindex command.)

AM-3      This  module displays a quick-help screen for pull-down 
          menu #3 (Setup menu).

MDMODQRY  This  module allows the dBase MODIFY QUERY facility  to 
          be  executed from the menu.   It first displays a query 
          file selection screen showing any existing query  files 
          on  the directory.  When the user has selected a new or 
          existing  file,  it  opens MEMBERS.DBF (so  fields  are 
          accessable) and runs MODIFY QUERY [user's  file].  When 
          the user exits MODIFY QUERY, the database is closed and 
          control is returned to MDMAIN.

MDMODFRM  This  module allows the dBase MODIFY REPORT facility to 
          be executed from the menu.   It first displays a report 
          file selection screen showing any existing report files 
          on the directory.  When the user has selected a new  or 
          existing  file,  it  opens MEMBERS.DBF (so  fields  are 
          accessable) and runs MODIFY REPORT [user's file].  When 
          the user exits MODIFY REPORT the database is closed and 
          control is returned to MDMAIN.

MDMODLBL  This  module allows the dBase MODIFY LABEL facility  to 
          be  executed from the menu.   It first displays a label 
          file selection screen showing any existing label  files 
          on  the directory.  When the user has selected a new or 
          existing  file,  it  opens MEMBERS.DBF (so  fields  are 
          accessable) and runs MODIFY LABEL [user's  file].  When 
          the user exits MODIFY LABEL, the database is closed and 
          control is returned to MDMAIN.

AM-4      This  module displays a quick-help screen for pull-down 
          menu #4 (Reports menu).

MDREPORT  This  module houses the Report facility for the MEMBERS 
          database.   It initially displays a setup screen  which 
          allows  the user to select the output device (Screen or 
          Printer),   report  order  (index),  report  form  file 
          (defaults  to  LIST80) and optionally  select  a  query  
          file. When setup is complete, it sets up a filter (if a 
          query  file  was  selected)  and checks  for  an  empty 
          report.  If records are found, the report is printed on 
          the selected output device.  Before the REPORT  command 
          is  executed,  STOPRPT.PRG  is  set as  the  ON  ESCAPE 
          processor  and  allows the user to abort the report  by 
          pressing ESC.  

MDLABEL   This  module houses the mailing label facility for  the 
          MEMBERS database.  It initially displays a setup screen 
          which  allows  the  user to select  the  output  device 
          (Screen or Printer),  label order (index),  label  form 
          file (defaults to ONE-UP) and optionally select a query  
          file. When setup is complete, it sets up a filter (if a 
          query  file was selected) and checks for an empty list. 
          If  records  are  found,  labels  are  printed  on  the 
          selected  output device.  Before the LABEL  command  is 
          executed, STOPRPT.PRG is set as the ON ESCAPE processor 
          and allows the user to abort label printing by pressing 
          ESC.  

 
STOPRPT   This  is the ON ESCAPE processor which is activated bye 
          MDREPORT  and  MDLABEL.  It intercepts  ESC  keystrokes 
          during  report  or label printing and  cleanly  returns 
          control to MDMAIN.
 
AM-5      This  module displays a quick-help screen for pull-down 
          menu #5 (Help menu).

MDSHODOC  This module searches the directory for MEMBERS.TXT  and 
          either  prints or displays it depending on the  logical 
          call parameter.
 

Other Files
-----------

MEMBERS.BAT  -- Batch file to start the application.
GENMBR.DBF   -- "Template" for creating MEMBERS.DBF. Also holds
                field descriptions.
MEMBERS.DBF  -- Members Information Database.  
MDKEYS.DBF   -- Database which holds function key text.
MDVARS.MEM   -- Holds public mem-vars. Generally used to save
                anything needed from session to session. In
                this application it "remembers" which pull-down
                menu was active when the user exited the program.
EXPIRED.QRY  -- An example query file (selects expired members).
RENEW.QRY    -- Another example query file.
LIST80.FRM   -- Report form for 80-column listing of member info.
ONE-UP.LBL   -- Label format file for one-up labels.

