Sage-ST ä

Loglib

Documentation

Global Declarations (Constants, Types, Variables)
CloseLogFile CreateLogFile FlushBlockFields
GatherLogFile GetCurrent GetFirst GetLast
GetNext GetPrevious GetRecNum LoadBlockFields
LoadMemoryRecord OpenLogFile PostErrorMessage PresentLog
PrintLogReport ProcessLogFile RepairLogFile SortFilteredLog
TransferLogEntries UpdateDataBase VerifiedLogFile





  type FileLG is private;

  type LogType is (PreReWrite,
                   PostReWrite,
                   PreDelete,
                   PostWrite,
                   BlkPreReWrite,
                   BlkPostReWrite,
                   BlkPreDelete,
                   BlkPostWrite,
                   RelDelete);

  type LogHeadDefinition is record
    Relation : string (1 .. 8) := (others => ASCIIX.nul);   -- name of the relation
    userID   : string (1 .. 3) := (others => ASCIIX.nul);   -- user causing log entry
    IsTagged : boolean := False;                            -- is record tagged
    LogTime  : TimeDate.Time;                               -- time/date of the entry
    LogMode  : LogType;                                     -- the type of the record
  end record;

  for LogHeadDefinition use record
    Relation at 0 range 0 .. 63;
    userID at 8 range 0 .. 23;
    IsTagged at 11 range 0 .. ModSys.Boolean_Size - 1;
    LogTime at 12 range 0 .. TimeDate.Time_size - 1;
    LogMode at 18 range 0 .. LogType'size - 1;
  end record;

  -- |
  -- | Array of Header information about each log entry.
  -- |

  type LogHeadDef_u_array is array (ModSys.S_Natural range <>) of LogHeadDefinition;

  type BlockLogDefinition is record
    fieldName : string (1 .. 8) := (others => ASCIIX.nul);   -- name of the field
    FldRepeat : ModSys.S_Natural16 := 0;                     -- repeat value of the field
    offset    : ModSys.S_Natural := 0;                       -- offset into block record of fld
  end record;

  for BlockLogDefinition use record at mod 1;
    fieldName at 0 range 0 .. 63;
    FldRepeat at 8 range 0 .. ModSys.S_Natural16_Size - 1;
    offset at 10 range 0 .. ModSys.S_Natural_Size - 1;
  end record;

  -- |
  -- | Enumerated type showing the type of log entry.
  -- |

  type UpdateType is (Add,
                      PreModify,
                      PostModify,
                      Delete,
                      RelationDelete);

  type SortMethodType is (date,
                          Relation,
                          userID,
                          UserRelation);

  type LProcType is access
  procedure (LogFile      : in out FileLG;
             RecordsStart : in     ModSys.S_Natural;
             RecordsMax   : in     ModSys.S_Natural);

  pragma Convention
          (WIN32,
           LProcType);

  --*
  --  LProc - This is a user load proc.
  --
  --
  --  When the records from RecordsStart to RecordsMax have been selected
  --  in the PresentLog procedure this procedure will get called.
  --
  --  CALLING SEQUENCE -
  --
  --    LProc (RecordsStart, RecordsMax)
  --
  --  ENTRY -
  --
  --    RecordsStart : Modsys.S_Natural
  --      The number of the first entry selected.
  --
  --    RecordsMax : Modsys.S_Natural
  --      The number of last entry selected.
  --

  type PProcType is access
  procedure (LogFile    : in out FileLG;
             LogHead    : in     LogHeadDefinition;
             ContinueOn : in out boolean);

  pragma Convention
          (WIN32,
           PProcType);

  --*
  --  PProc - This is a user process proc.
  --
  --
  --  When the memory record for the current log entry is loaded
  --  this routine will get called.
  --
  --  CALLING SEQUENCE -
  --
  --    PProc (LogFile, LogHead, ContinueOn)
  --
  --  ENTRY -
  --
  --    LogFile : FileLG
  --      The handle of the log file being used.
  --
  --    LogHead : LogHeadDefinition
  --      The name of the relation whose memory record was loaded.
  --
  --  EXIT -
  --
  --    ContinueOn : Boolean
  --      TRUE - retrieve the next record and call this routine again.
  --
  --      FALSE - stop processing and exit the main procedure.
  --

  type UProcType is access
  procedure (LogFile       : in out FileLG;
             Relation      : in     System.Address;
             Relation_High : in     ModSys.S_Natural;
             Operation     : in     UpdateType;
             ContinueOn    : in out boolean);

  pragma Convention
          (WIN32,
           UProcType);

  --*
  --  UProc - This is a user load proc.
  --
  --
  --  When the current memory record for the relation specified by Relation
  --  is filled this routine will get called.
  --
  --  CALLING SEQUENCE -
  --
  --    UProc (Relation, Operation, RecordLoc, ContinueOn)
  --
  --  ENTRY -
  --
  --    Relation : string
  --      The name of the relation whose memory record was loaded.
  --
  --    Operation : UpdateType
  --      The type of the log entry record.
  --
  --    RecordLoc : Modsys.S_Natural
  --      The current byte location in the log file.
  --
  --  EXIT -
  --
  --    ContinueOn : boolean
  --      TRUE - More records should be processed.
  --      FALSE - Stop processing.




  procedure CloseLogFile
             (LogFile : in out FileLG;
              state   : in out Files.FileState);

  --*
  --  CloseLogFile - Close log file, discontinue processing.
  --
  --
  --  CloseLogFile closes the log file access.
  --
  --  CALLING SEQUENCE -
  --
  --    CloseLogFile (LogFile, state)
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      The handle to the log file.
  --
  --    state : Files.FileState
  --      The state of the file after attempting to close.
  --
  --  EXAMPLE -
  --
  --    CloseLogFile (LogFile, State);
  --




  procedure CreateLogFile
             (LogFile  : in out FileLG;
              FileName : in     string;
              state    : in out Files.FileState);

  --*
  --  CreateLogFile - Create a new log file.
  --
  --
  --  CreateLogFile creates a new log file and/or overwrites an existing one.
  --  This makes this file available to be used by the transfer routine to
  --  copy log entries from one file to another.
  --
  --  CALLING SEQUENCE -
  --
  --    CreateLogFile (LogFile, FileName, State)
  --
  --  ENTRY -
  --
  --    FileName : string
  --      The name of the log file to create.  Please see the note at the
  --      beginning of the LogLib documentation about legal log names.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      The handle to the log file.
  --
  --    State : Files.FileState
  --      The state of the file after attempting to create.
  --
  --  EXAMPLE -
  --
  --    CreateLogFile (LogFile, "TEST.A01", State);
  --




  function GatherLogFile
            (Path       : in     string;
             FileName   : in     string;
             outputPath : in     string;
             outputName : in     string) return boolean;

  --*
  --  GatherLogFile - Gather log files into one log file.
  --
  --
  --  GatherLogFile gathers the requested log files into one log file.
  --  All logs files may be gathered by sending in an '*' for the name.
  --
  --  CALLING SEQUENCE -
  --
  --    GatherLogFile (path, FileName, outputPath, outputName)
  --
  --  ENTRY -
  --
  --    path : string
  --      Path to the log files to be gathered.
  --
  --    FileName : string
  --      Name of the log files to gather.  This name may include the
  --      '?' and '*' wildcard characters.
  --
  --    outputPath : string
  --      This is the path to the output file for the log entries.
  --
  --    outputName : string
  --      This is the name of the output file for the log entries.  This name
  --      must NOT include an extension.  When this routine completes the
  --      outputName fill have an extension of ".A01".
  --
  --  EXAMPLE -
  --
  --    GatherLogFile ("C:\TEST\", "MYAPP*.L*", "C:\TEST2\", "MYAPP");
  --




  procedure GetCurrent
             (LogFile : in out FileLG;
              Raw     : in     boolean;
              Header  : in out LogHeadDefinition);

  --*
  --  GetCurrent - Gets the header information for current log entry.
  --
  --
  --  GetCurrent reads the current log entry information from the log file.
  --  Whether the entry is to come from the raw or filtered file must be
  --  specified with the Raw flag.
  --
  --  CALLING SEQUENCE -
  --
  --    GetCurrent (LogFile, Raw, Header)
  --
  --  ENTRY -
  --
  --    Raw : Boolean
  --      TRUE - Read the current entry in the raw file.
  --
  --      FALSE - Read the current entry in the filtered file.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      Handle to the log file.
  --
  --    Header : LogHeadDefinition
  --      Record containing current log entry information
  --
  --  EXAMPLE -
  --
  --    GetCurrent (LogFile, False, Head);
  --




  procedure GetFirst
             (LogFile   : in out FileLG;
              Raw       : in     boolean;
              Header    : in out LogHeadDefinition;
              Available : in out boolean);

  --*
  --  GetFirst - Gets the header information for first log entry.
  --
  --
  --  GetFirst reads the first log entry information from the log file.
  --  Whether the entry is to come from the raw or filtered file must be
  --  specified with the Raw flag.
  --
  --  CALLING SEQUENCE -
  --
  --    GetFirst (LogFile, Raw, Header, Available)
  --
  --  ENTRY -
  --
  --    Raw : Boolean
  --      TRUE - Read the first entry in the raw file.
  --
  --      FALSE - Read the first entry in the filtered file.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      Handle to the log file.
  --
  --    Header : LogHeadDefinition
  --      Record containing first log entry information
  --
  --    Available : Boolean
  --      TRUE - The requested record is available
  --
  --      FALSE - The requested record is NOT available
  --
  --  EXAMPLE -
  --
  --    GetFirst (LogFile, False, Head, Available);
  --




  procedure GetLast
             (LogFile   : in out FileLG;
              Raw       : in     boolean;
              Header    : in out LogHeadDefinition;
              Available : in out boolean);

  --*
  --  GetLast - Gets the header information for last log entry.
  --
  --
  --  GetLast reads the last log entry information from the log file.
  --  Whether the entry is to come from the raw or filtered file must be
  --  specified with the Raw flag.
  --
  --  CALLING SEQUENCE -
  --
  --    GetLast (LogFile, Raw, Header, Available)
  --
  --  ENTRY -
  --
  --    Raw : Boolean
  --      TRUE - Read the last entry in the raw file.
  --
  --      FALSE - Read the last entry in the filtered file.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      Handle to the log file.
  --
  --    Header : LogHeadDefinition
  --      Record containing last log entry information
  --
  --    Available : Boolean
  --      TRUE - The requested record is available
  --
  --      FALSE - The requested record is NOT available
  --
  --  EXAMPLE -
  --
  --    GetLast (LogFile, False, Head, Available);
  --




  procedure GetNext
             (LogFile   : in out FileLG;
              Raw       : in     boolean;
              Header    : in out LogHeadDefinition;
              Available : in out boolean);

  --*
  --  GetNext - Gets the header information for next log entry.
  --
  --
  --  GetNext reads the next log entry information from the log file.
  --  Whether the entry is to come from the raw or filtered file must be
  --  specified with the Raw flag.
  --
  --  CALLING SEQUENCE -
  --
  --    GetNext (LogFile, Raw, Header, Available)
  --
  --  ENTRY -
  --
  --    Raw : Boolean
  --      TRUE - Read the next entry in the raw file.
  --
  --      FALSE - Read the next entry in the filtered file.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      Handle to the log file.
  --
  --    Header : LogHeadDefinition
  --      Record containing next log entry information
  --
  --    Available : Boolean
  --      TRUE - The requested record is available
  --
  --      FALSE - The requested record is NOT available
  --
  --  EXAMPLE -
  --
  --    GetNext (LogFile, False, Head, Available);
  --




  procedure GetPrevious
             (LogFile   : in out FileLG;
              Raw       : in     boolean;
              Header    : in out LogHeadDefinition;
              Available : in out boolean);

  --*
  --  GetPrevious - Gets the header information for previous log entry.
  --
  --
  --  GetPrevious reads the previous log entry information from the log file.
  --  Whether the entry is to come from the raw or filtered file must be
  --  specified with the Raw flag.
  --
  --  CALLING SEQUENCE -
  --
  --    GetPrevious (LogFile, Raw, Header, Available)
  --
  --  ENTRY -
  --
  --    Raw : Boolean
  --      TRUE - Read the previous entry in the raw file.
  --
  --      FALSE - Read the previous entry in the filtered file.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      Handle to the log file.
  --
  --    Header : LogHeadDefinition
  --      Record containing previous log entry information
  --
  --    Available : Boolean
  --      TRUE - The requested record is available
  --
  --      FALSE - The requested record is NOT available
  --
  --  EXAMPLE -
  --
  --    GetPrevious (LogFile, False, Head, Available);
  --




  procedure GetRecNum
             (LogFile      : in out FileLG;
              Raw          : in     boolean;
              RequestedRec : in     ModSys.S_Natural;
              Header       : in out LogHeadDefinition;
              Available    : in out boolean);

  --*
  --  GetRecNum - Gets the header information for specified log entry.
  --
  --
  --  GetRecNum reads the specified log entry information from the log file.
  --  Whether the entry is to come from the raw or filtered file must be
  --  specified with the Raw flag.
  --
  --  CALLING SEQUENCE -
  --
  --    GetRecNum (LogFile, Raw, RequestedRec, Header, Available)
  --
  --  ENTRY -
  --
  --    Raw : Boolean
  --      TRUE - Read the previous entry in the raw file.
  --
  --      FALSE - Read the previous entry in the filtered file.
  --
  --    RequestedRec : Modsys.S_Natural
  --      The number of the record to read.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      Handle to the log file.
  --
  --    Header : LogHeadDefinition
  --      Record containing previous log entry information
  --
  --    Available : Boolean
  --      TRUE - The requested record is available
  --
  --      FALSE - The requested record is NOT available
  --
  --  EXAMPLE -
  --
  --    GetRecNum (LogFile, False, 24, Head, Available);
  --




  procedure LoadBlockFields
             (LogFile : in out FileLG;
              Raw     : in     boolean;
              Method  : in     UpdateType);

  --*
  --  LoadBlockFields - Load block data from log to block fields.
  --
  --
  --  LoadBlockFields reads the block data from the log file and puts it into
  --  the block data field of the record.
  --
  --  CALLING SEQUENCE -
  --
  --    LoadBlockFields (LogFile, Raw, Method)
  --
  --  ENTRY -
  --
  --    Raw : Boolean
  --      TRUE - Read the data from the raw file.
  --
  --      FALSE - Read the data from the filtered file.
  --
  --    Method : LogLib.UpdateType
  --      The method to be used to write the data.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      The handle to the log file.
  --
  --  EXAMPLE -
  --
  --    LoadBlockFields (LogFile, True, LogLib.ADD);
  --




  procedure FlushBlockFields
             (LogFile : in out FileLG;
              Raw     : in     boolean);

  --*
  --  FlushBlockFields - Flush (get rid of) any saved block field data.
  --
  --
  --  FlushBlockFields flushes (gets rid of) any of the block data that
  --  was being accumulated to use with a record.  If the record is not
  --  going to be used then this routine flushes the block data also.
  --
  --  CALLING SEQUENCE -
  --
  --    FlushBlockFields (LogFile, Raw, Method)
  --
  --  ENTRY -
  --
  --    Raw : boolean
  --      True - Read the data from the raw file.
  --
  --      False - Read the data from the filtered file.
  --
  --    Method : LogLib.UpdateType
  --      The method to be used to write the data.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      The handle to the log file.
  --
  --  EXAMPLE -
  --
  --    FlushBlockFields (LogFile, True, LogLib.ADD);
  --




  procedure LoadMemoryRecord
             (LogFile : in out FileLG;
              Raw     : in     boolean;
              Success : in out boolean);

  --*
  --  LoadMemoryRecord - Load memory record for requested log entry.
  --
  --
  --  LoadRecord loads the memory record with the data from the log file for
  --  the requested record.
  --
  --  CALLING SEQUENCE -
  --
  --    LoadMemoryRecord (LogFile, Raw, Success)
  --
  --  ENTRY -
  --
  --    Raw : Boolean
  --      TRUE - Read the data from the raw file.
  --
  --      FALSE - Read the data from the filtered file.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      The handle to the log file.
  --
  --    Success : Boolean
  --      Was the operation successful?
  --
  --  EXAMPLE -
  --
  --    LoadMemoryRecord (LogFile, True, Success);
  --




  procedure OpenLogFile
             (LogFile   : in out FileLG;
              FileName  : in     string;
              Modify    : in     boolean;
              TotalRecs : in out ModSys.S_Natural;
              state     : in out Files.FileState);

  --*
  --  OpenLogFile - Opens the specified log file.
  --
  --
  --  OpenLogFile opens the requested log file for processing.  The file may
  --  be opened for modification or as a read only file.
  --
  --  CALLING SEQUENCE -
  --
  --    OpenLogFile (LogFile, FileName, Modify, State)
  --
  --  ENTRY -
  --
  --    FileName : String
  --      Name of the log file to open.  Please see the note about legal log
  --      file names at the beginning of the LogLib documentation.
  --
  --    Modify : Boolean
  --      Boolean value as to whether the file may be modified while open.
  --
  --  EXIT -
  --
  --    LogFile : FileLG
  --      Handle to the log file.
  --
  --    TotalRecs : ModSys.S_Natural
  --      Total number of RAW records in this log.
  --
  --    State : Files.FileState
  --      The state of the file upon returning.
  --
  --  EXAMPLE -
  --
  --    OpenLogFile (LogFile, "MYAPP.A01", True, TotalRecs, State);
  --




  procedure PostErrorMessage
             (Message : in     string);

  --*
  --  PostErrorMessage - Allows a user error message while updating.
  --
  --
  --  PostErrorMessage allows a user error message to be posted to the
  --  error file during the time that the UpdateDataBase procedure is
  --  running.  This is NOT a valid call at any other time.
  --
  --  CALLING SEQUENCE -
  --
  --    PostErrorMessage (Message)
  --
  --  ENTRY -
  --
  --    Message : String
  --      The message to post to the error file.
  --
  --  EXAMPLE -
  --
  --    PostErrorMessage ("Unknown Error Occurred");
  --




  procedure PresentLog
             (LogFile : in out FileLG;
              LProc   : in     LProcType);

  --*
  --  PresentLog - Scroll log file entries on screen.
  --
  --
  --  PresentLog opens a window on screen and scrolls the information about
  --  the entries in the log file.  Only the filtered log will be presented.
  --
  --  CALLING SEQUENCE -
  --
  --    PresentLog (LogFile, LProc)
  --
  --  ENTRY -
  --
  --    LogFile : FileLG
  --      The handle to a valid opened log file to display.
  --
  --  EXAMPLE -
  --
  --    procedure LoadRoutine
  --               (RecordsStart : in     Modsys.S_Natural;
  --                RecordsMax   : in     Modsys.S_Natural);
  --
  --
  --    begin
  --      -- |
  --      -- | The records from RecordsStart to RecordsMax have been selected.
  --      -- | At this point you can load them, print them, etc.
  --      -- |
  --    end LoadRoutine;
  --
  --    procedure PresentMyLog is new Loglib.PresentLog
  --               (LoadRoutine);
  --
  --    begin
  --      PresentMyLog (LogHandle, state);
  --




  procedure PrintLogReport
             (LogFile  : in out FileLG;
              DestFile : in     string;
              DflName  : in     string;
              Raw      : in     boolean;
              StartRec : in     ModSys.S_Natural;
              EndRec   : in     ModSys.S_Natural);

  --*
  --  PrintLogReport - Print report of log file to output file.
  --
  --
  --  PrintLogReport prints a report of the contents of the log file to the
  --  requested output.
  --
  --  CALLING SEQUENCE -
  --
  --    PrintLogReport (LogFile, DestFile, DFLName, Raw, StartRec, EndRec)
  --
  --  ENTRY -
  --
  --    LogFile : FileLG
  --      The handle to a valid opened log file.
  --
  --    DestFile : string
  --      The name of destination for the report.
  --
  --    DFLName : string
  --      The name of the DFL file that this log file belongs to.
  --
  --    Raw : Boolean
  --      TRUE - Read the data from the raw file.
  --
  --      FALSE - Read the data from the filtered file.
  --
  --    StartRec : Modsys.S_Natural
  --      The number of the starting log entry to use.
  --
  --    EndRec : Modsys.S_Natural
  --      The number of the ending log entry to use.  If this number is greater
  --      than the number of entries in the log then the report will stop at the
  --      end of the log file.
  --
  --  EXAMPLE -
  --
  --    PrintLogReport (LogHandle, "MYAPP.RPT", "MYAPP.DFL", False, 1, 100);
  --




  procedure ProcessLogFile
             (LogFile : in out FileLG;
              Raw     : in     boolean;
              PProc   : in     PProcType);

  --*
  --  ProcessLogFile - Read the log file entries into memory sequentially.
  --
  --
  --  ProcessLogFile reads the log entries starting at the first and continuing
  --  sequentially through the file.  The entry is read, the memory record is
  --  loaded and then the PProc is called.  If the block data is to be loaded
  --  then the proper routine will need to be called from inside the PProc.
  --
  --  CALLING SEQUENCE -
  --
  --    ProcessLogFile (LogFile, Raw)
  --
  --  ENTRY -
  --
  --    LogFile : FileLG
  --      The handle to a valid opened log file to process.
  --
  --  EXIT -
  --
  --    Raw : Boolean
  --      TRUE - Read the data from the raw file.
  --
  --      FALSE - Read the data from the filtered file.
  --
  --  EXAMPLE -
  --
  --    procedure ProcessProc
  --                (LogFile    : in out FileLG;
  --                 LogHead    : in     LogHeadDefinition;
  --                 ContinueOn : in out Boolean) is
  --
  --    begin
  --      -- |
  --      -- | The memory record for the current entry is loaded.  Validate
  --      -- | it, transfer it, print it, etc.
  --      -- |
  --    end ProcessProc;
  --
  --    procedure ProcessMyLog is new Loglib.ProcessLog
  --               (ProcessProc);
  --
  --    begin
  --      ProcessMyLog (LogHandle, state);
  --




  procedure SortFilteredLog
             (LogFile    : in out FileLG;
              SortMethod : in     SortMethodType;
              Force      : in     boolean);

  --*
  --  SortFilteredLog - Sort the filtered log in a different order.
  --
  --
  --  SortFilteredLog allows the filtered log to be sorted in one of four
  --  different methods to allow efficiency of processing.  The four methods
  --  are 1) Date - date + time 2) Relation - Relation + Date + Time
  --  3) UserID - UserID + Date + Time 4) UserRelation - UserID + Relation
  --  + Date + Time.
  --
  --  CALLING SEQUENCE -
  --
  --    SortFilteredLog (LogFile, SortMethod, Force)
  --
  --  ENTRY -
  --
  --    LogFile : FileLG
  --      The handle to a valid opened log file.
  --
  --    SortMethod : SortMethodType
  --      The method of sorting to be used.
  --
  --    Force : Boolean
  --      TRUE - Sort the file even if it is current sorted in this method.
  --
  --      FALSE - Don't sort if current sorted in the defined SortMethod.
  --
  --  EXAMPLE -
  --
  --    SortFilteredLog (LogHandle, LogLib.Date, True);
  --




  procedure TransferLogEntries
             (LogFile  : in out FileLG;
              DestLog  : in out FileLG;
              Raw      : in     boolean;
              StartRec : in     ModSys.S_Natural;
              EndRec   : in     ModSys.S_Natural);

  --*
  --  TransferLogEntries - Transfer current entry in LogFile to DestLog.
  --
  --
  --  TransferLogEntries allows the user to transfer the current log entry
  --  (Raw or Filtered as defined by Raw) to a second opened log file.  If
  --  it is a filtered entry then the corresponding log entry will be
  --  transferred along with the requested log entry.
  --
  --  CALLING SEQUENCE -
  --
  --    TransferLogEntry (LogFile, DestLog, Raw, StartRec, EndRec)
  --
  --  ENTRY -
  --
  --    LogFile : FileLG
  --      The handle to a valid opened log file.
  --
  --    Raw : Boolean
  --      TRUE - Read the data from the raw file.
  --
  --      FALSE - Read the data from the filtered file.
  --
  --    StartRec : Modsys.S_Natural
  --      The starting record number to use.
  --
  --    EndRec : Modsys.S_Natural
  --      The ending record number to use.
  --
  --  EXIT -
  --
  --    DestFile : FileLG
  --      The handle to a valid opened destination log file.
  --
  --  EXAMPLE -
  --
  --    TransferLogEntries (LogHandle, LogDest, True, 1, 100);
  --




  procedure UpdateDataBase
             (LogFile    : in out FileLG;
              Raw        : in     boolean;
              StartRec   : in     ModSys.S_Natural;
              EndRec     : in     ModSys.S_Natural;
              IsExternal : in     boolean;
              UProc      : in     UProcType;
              Error      : in out boolean);

  --*
  --  UpdateDataBase - Update database from entries in log file.
  --
  --
  --  UpdateDataBase reads the entries of the log file and updates the database.
  --
  --  CALLING SEQUENCE -
  --
  --    UpdateDataBase (LogFile, Raw, StartRec, EndRec, IsExternal, UProc, Error)
  --
  --  ENTRY -
  --
  --    LogFile : FileLG
  --      Handle to a log file.
  --
  --    Raw : Boolean
  --      TRUE - Read the data from the raw file.
  --
  --      FALSE - Read the data from the filtered file.
  --
  --    StartRec : ModSys.S_Natural
  --      The starting RAW record number to use.
  --
  --    EndRec : ModSys.S_Natural
  --      The highest numbered RAW record to use.
  --
  --    IsExternal : Boolean
  --      TRUE - This file was created externally and is being merged into the
  --             current data base.
  --
  --      FALSE - This file was created directly on the current database.
  --
  --    UProc : UpdateProc
  --      Procedure to call as each record is processed.  In this procedure the
  --      user is responsible to locate the record that is to be updated and
  --      rewrite or write it.
  --
  --    Error : Boolean
  --      TRUE - An error occurred while processing.
  --      FALSE - No errors encountered during processing.
  --
  --  EXAMPLE -
  --
  --    procedure UpdateRoutine
  --              (Relation  : in     String;
  --               Operation : in     UpdateType;
  --               ContinueOn  : in out boolean);
  --
  --    begin
  --      The current memory record for the Relation is loaded with data
  --      as defined by the Operation.  Take any actions necessary and
  --      then return the ContinueOn flag is TRUE to do another record
  --      or FALSE to stop.
  --
  --    end UpdateRoutine;
  --
  --
  --
  --    begin
  --      LogLib.UpdateDataBase (LogFile, True, 1, 150, False, UpdateRoutine,
  --                             Error);
  --




  function VerifiedLogFile
            (LogFileName : in     string) return boolean;

  --*
  --  VerifiedLogFile - Verify if the records seem to be intact in this log file.
  --
  --
  --  This routine reads through the records in the log file and returns a boolean
  --  indicating if at least the structure of all the records seems to be valid.
  --  An invalid return value would indicate that at least one record does not
  --  match the size recorded for it.
  --
  --  CALLING SEQUENCE -
  --
  --    VerifiedLogFile (LogFileName)
  --
  --  ENTRY -
  --
  --    LogFile : string
  --      The name of the log file to check.
  --
  --  EXIT -
  --
  --    boolean
  --      TRUE - All records match the internal size recorded for them.
  --      FALSE - A record was detected which does not matche the size it should be.
  --




  procedure RepairLogFile
             (OriginalLogFile : in     string;
              RepairedLogFile : in     string;
              BadRecordsFound :    out ModSys.S_Natural;
              Success         :    out boolean);

  --*
  --  RepairLogFile - Repair a log file that contains a corrupted record.
  --
  --
  --  This routines reads through a log file and makes a new copy which does
  --  not contain the corrupted record.  By throwing out one record at least
  --  some of the data recorded can be saved.  If you try to update using a
  --  corrupted file most if not all the data might be lost.  This routine
  --  provides a mechanism to at least recover most of it.
  --
  --  CALLING SEQUENCE -
  --
  --    RepairLogFile (OriginalLogFile, RepairedLogFile, BadRecordsFound, Success)
  --
  --  ENTRY -
  --
  --    OriginalLogFile : string
  --      The name of the original log file, the one that is thought to contain a
  --      corrupted record.
  --
  --    RepairedLogFile : string
  --      The name of the file that will receive the good records.  Once this routine
  --      finishes this should be a clean log file that will not contain any
  --      corrupted records.
  --
  --  EXIT -
  --
  --    BadRecordsFound : ModSys.S_Natural
  --      The number of bad records encountered and cleaned out of the file.
  --
  --    Success : boolean
  --      TRUE - The file was successfully processed which indicates that all possible
  --             good records were recovered.
  --      FALSE - The file could not be processed.  The file may be so corrupted as to
  --              be completely unrecoverable.
  --




Send mail to   warren.merrill@inl.gov with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance