SQABasic "Cache" Library

 MODULE DESCRIPTION:

      Description.


      Cache TABLES FORMAT:


      NOTE:
               ****       ****        ****        ****        ****
      SQARobot must be configured to "Continue Execution" upon Script Command
      Failures in order for this to work properly.  Where appropriate we set
      flags and status to recognize, report, and work with these failures.
               ****       ****        ****        ****        ****

 To actually make use of the library in another module the developer needs
 to $Include this header file and these additional files:

      LogUtilities_X.SBH              (Constants, Globals, Types etc.)
      ApplicationUtilities_X.SBH      (Constants, Globals, Types etc.)
      Cache_X.SBH                     (Constants, Globals, Types etc.)

Declarations Constants Global Variables User-Defined Types Routine Details

User Dependencies:

(stuff the developer's library/script $INCLUDES at compile time.)
(Note: The order of items may matter and may be different for your code.)

Internal Dependencies:

(stuff this library needs at compile time.)

Exported Declarations

Function CacheGetLineInput       BasicLib Cache                         
Function CacheInit               BasicLib Cache                         
Function LoadCache               BasicLib Cache                         

Constants



    (none)

Globals

Global  DataAvailable   As  Integer             'flag to control loops

Global  currentCM       As  Long                'which table index is being use - usually the last unless working
Global  CMinitialize    As  Integer             'in each driver, set this flag to initialize CM tables
Global  CMindex()       As  Long                'for this execution of the table, this is CI table index to use
Global  CMoffset()      As  Long                'for this execution of the table, where are we in it.
Global  CMsize          As  Long                'size of the Cache MAP tables - used in resize
Global  CMmaxUsed       AS  Long                'maximum number of entries used
Global  CIfilename()    As  String
Global  CIstart()       As  Long
Global  CIend()         As  Long
Global  CIseparator()   As  String              ' keep a copy of the separator for triming files.
Global  CIsize          As  Long                'size of the Cache Info tables - used in resize
Global  CIlast          As  Long                'final entry in the Cache Info tables may be less than total table size
Global  cache()         As  String
Global  CacheSize       As  Long               'size of the Cache tables - used in resize
Global  CacheEnd        As  Long               'final entry in the cache, may be less than total table size

User-Defined Types



    (none)

Routine Details



  Function CacheGetLineInput(fileref As Integer, info As AUStatusInfo, byref linein as string) As String

 DESCRIPTION:

      Routine returns the next line from the fileref provided
      and increments the AUStatusInfo.linecount counter.
      The routine returns the line--which is a result of a Line Input #fileref
      statement--unmodified.

      All Driver routines which input records from a cached data table will
      call this routine. Users would not normally call this routine directly.


 PARAMETERS:

      fileref     Integer from file's OPEN statement.
      info        AUStatusInfo structure

 RESULTS:

      String  returned from Line Input statement unmodified.

 ERRORS:

      none

 Orig Author: Robert Ducharme
 Orig   Date: APR 01, 2005
 History:

      APR 01, 2005    Original Release





  Function CacheInit(cdfac As LogFacility, stfac As LogFacility, sdfac As LogFacility) As Integer

 DESCRIPTION:

      Routine to initialize the cache information.


 PARAMETERS:

      cdfac As Cycle Driver LogFacility
      stfac As Suite DriverLogFacility
      sdfac As Step DriverLogFacility

 RESULTS:

      none

 ERRORS:

      none

 Orig Author: Robert Ducharme
 Orig   Date: APR 01, 2005
 History:

      APR 01, 2005    Original Release





  Function LoadCache(fileref As Integer, info As AUStatusInfo) As Integer

 DESCRIPTION:

      Routine to read data from the table and fill in the cache information.


 PARAMETERS:

      fileref     open file reference to file that needs to be cached.

 RESULTS:

      Indication whether or not loading the cache was successful. If good,
      CurrentCM is set to point to the CM table entries that point to the
      correct cache entry.

 ERRORS:

      none

 Orig Author: Robert Ducharme
 Orig   Date: APR 01, 2005
 History:

      APR 01, 2005    Original Release



Copyright (C) SAS Institute
GNU General Public License: http://www.opensource.org/licenses/gpl-license.php 
==============================================================================