
  -------------------------------------------------------------------------
  RECYCLE.PRG   -   Sample #1 in a Series

  The SuccessWare Index (SIx) Driver 2.0
  -------------------------------------------------------------------------

  The RECYCLE.PRG file contains sample code that demonstrates how to add
  automatic record recycling to your application.  Record recycling
  eliminates the need to perform PACKs by reusing previously deleted
  records before any new records are appended to the database.

  This technique is made possible through the use of the SIx Driver's
  Database Event Trigger System.  By hooking into the trigger's APPEND
  event, our program can first look for any records that have been
  previously marked as deleted.  This lookup is done in an index tag
  (called _DEL_) the trigger code creates in a structural index file.  The
  index is a conditional index created FOR DELETED(), so it only contains
  keys for records which are available to be recycled.  If a  structural
  index is not already in use, a new one is created to hold this new _DEL_
  tag.

  Whenever the application code attempts to append a new record, as in this
  example when the browse scrolls past the bottom of the file, the APPEND
  event is triggered.  The code in the EVENT_APPEND case saves the
  currently active index order, selects the _DEL_ tag, and checks to see if
  there are any keys in it, using the SIx Driver's Sx_KeyCount() function.
  If a deleted record is available, it's fields are blanked out, using the
  BlankRec() UDF included in RECYCLE.PRG, and the record is RECALLed,
  automatically removing it's key from the _DEL_ tag.  Finally the
  previously active index order is restored and the trigger returns false
  (.F.), indicating NOT to execute the requested event, in this case, to
  append a new record.  No new record is required!

  That's it!

  -------------------------------------------------------------------------

  This sample code requires SIx 2.0 to compile and link.  If you do not
  already own SIx 2.0, but would like to this sample code in action,
  contact SuccessWare International to receive a FREE, 30-Day+ Evaluation
  copy of SIx 2.0.

    SuccessWare International
    27349 Jefferson Ave., Suite 101
    Temecula, CA 92590

    Voice: 1-800-683-1657 (or 909-699-9657)
    Fax  : 909-695-5679
    BBS  : 909-694-6891
    CIS  : Team SuccessWare [74774,2240]

  -------------------------------------------------------------------------

