/*MAIN
 Overview
 
 UPDATE_MNFFPT is executed to update the Minor Frame File Pointer Table by assigning
   a new long pointer to this session it it had never been processed before, and if
   it had been processed before output a message to this effect and record the state
   of the rule.
MAIN*/

/*ARGUMENTS
  Arguments
 
  UPDATE_MNFFPT takes the following arguments, all of  which have an IN
  parameter mode:
   - BFST (VARCHAR2).  This variable represents the name of the Bad Frames
     Statistics Table that was posted by Labview just prior to the onset of
     reconstruction.  

   - AMF_FILE1 (VARCHAR2).  This variable represents the name of the annotated minor
     frame file created for this session by the Frame Synchronizer software.
ARGUMENTS*/

/*DEPENDENCIES
 Dependencies
 
 The following are the procedures called by UPDATE_MNFFPT (listed in their
 order of call):
   - SWITCH.  This is the package that manipulates the switches for all
     the reconstruction rules.

   - OPEN_AND_PARSE.  This function combines what would otherwise have
     been separate calls to the native Oracle DBMS_SQL.OPEN_CURSOR and
     DBMS_SQL.PARSE procedures, into a single function.

   - DBMS_UTILITY.GET_TIME.  The GET_TIME function of the native oracle package
     DBMS_UTILITY returns the elapsed time since an arbitrary time in 100ths of 
     seconds

   - EXECUTE_AND_CLOSE.  This function combines what would otherwise have
     been separate calls to the native Oracle DBMS_SQL.EXECUTE and
     DBMS_SQL.CLOSE procedures, into a single function.

   - DBMS_SQL.  This the native Oracle dynamic SQL package.

   - LOG_FILE.  This is a package of procedures which handle the tasks of
     creating the file in which reconstruction output messages will be written
     to, writing to the latter file, and closing it at the end of
     reconstruction.
DEPENDENCIES*/

/*VARIABLES
 Variables

 The following are variables used in the procedure:
   - C and D (INTEGER). Cursor handles.

   - EXECUTE1 (INTEGER).  The number of rows processed by the SQL statement
     if that statement is an UPDATE, INSERT, or DELETE.  If the SQL statement is
     not an UPDATE, INSERT, or DELETE, this value should be ignored.

   - SPOINTER (MNFFPT.SPOINTER%TYPE).  The small pointer that will be assigned to 
     the current session.

   - AMF_FILE (MNFFPT.AMF_FILE%TYPE).  The name of the annotated minor frames
     file.

   - SPOINTER_cur.  Static cursor.

   - SPOINTER_rec.  Record of the static cursor SPOINTER_cur.
VARIABLES*/

/*EXAMPLES
  Examples
 
  Here is a call to UPDATE_MNFFPT: 
 
   BEGIN
       UPDATE_MNFFPT ('GEOTAIL1997281181217481BAD','GEOTAIL_DG_1997_237_00204_case8');
   END;
   /

EXAMPLES*/

/*EXCEPTIONS
 Exceptions

 There are no named exceptions for this procedure, except for the generic one
   WHEN OTHERS.  When the latter is triggered, the error message is outputted
   along with the name of the module that erred, and any cursors that may still
   be opened are closed.  
EXCEPTIONS*/

/*ERRORS
 Errors

 There are no errors that this procedure is known to generate.  Should an
   error occur, take action based on the description of the error. 
ERRORS*/

/*TABLES
 Tables
 
 The following tables are referenced in this procedure:
   - LOGT.  This is the log table in which the states of all rules are dynamically
     posted and computed before being written to the system_state table.

   - MNFFPT.  This is the minor frame file pointer table used to keep statistic
     information on at most one thousand sessions.  Among other data, this table
     stores the short and long pointers for each session.

   - SESSIONS_PARAMETERS.  This table stores information on parameters of all
     reconstruction sessions.

 For more information on these and other tables, see the documentation on tables.
TABLES*/

/*OTHERS
 Others
 
 Note that short pointers range from 0 to 999 and will never get any larger.  Short
   pointers are cyclical in nature, i.e. that when 999 is assigned, the next spointer
   to be assigned will be 0 and the row of spointer = 0 will be overwritten with new
   information.  On the other hand, the long pointer is not cyclical and increments
   by one for every session to a maximum of 9,999,999,999.  The purpose of the long 
   pointer is to keep track of sessions that are no longer online and have been 
   archived to tape, whereas short pointer help keep track of sessions still online.

 Also note that in this procedure table LOGT is updated through INSERT and UPDATE
   statements whereas in other procedures (except INITIALIZE and UNLOAD,  
   RECONSTRUCTION1, RECONSTRUCTION2, and RECONSTRUCTION3), table LOGT is updated 
   through the RULES_STATES package.  The reason for the latter is because the
   session's pointer has not been assigned through procedure UPDATE_MNFFPT, and 
   the events count has not been initialized through procedure POST_STATE.INIT_EVENT.

 For more details on this procedure or the system of pointers used see the
 reconstruction documentation.
OTHERS*/
