Sage-ST ä

Fixlib

Documentation

ClosedRepairAllRelations ClosedRepairRelation OpenedRepairAllRelations OpenedRepairRelation
ReFormat ReStructure SetVariableBlocking




  PROCEDURE ReFormat
             (CONST relName    : ARRAY OF CHAR;
              CONST oldDFL     : ARRAY OF CHAR;
              CONST ShowStatus : BOOLEAN;
              VAR   Error      : CARDINAL);

  (**
      ReFormat - Restructure the data base relation.


      This procedure restructures the data base relation from the
      old definition to the new one.  A new data file is made, the
      old one deleted and the new one renamed to the old. The new data
      file will then assume the version identifier of the new
      DFL.  The index file associated with the requested relation
      will be deleted and must be rebuilt using the "ReBuildIndex"
      procedure from Sage.  The following sequence of procedures
      is an example of a restructure and rebuild.

        ReFormat  ("MyRel", "SAMPLE.DFL", TRUE, error);
        OpenRelation ("MyRel", TRUE);
        ReBuildIndex ("MyRel", TRUE, DummyDupProc, NumDups);

      Any new fields which appear will be cleared to nul.

      CALLING SEQUENCE -

        ReFormat (relName, oldDFL, ShowStatus, error);

      ENTRY -

        relName : ARRAY OF CHAR
          Name of relation to restructure.

        oldDFL : ARRAY OF CHAR
          Name (including possible drive and directory) of old
          DFL file which has the same version number for the
          relation being restructured.  If a null string is
          used, the name of the currently opened DFL will
          be used.

        ShowStatus : BOOLEAN
          TRUE - Show status messages as the work is performed.
          FALSE - Do NOT show messages as the work is performed.

      EXIT -

        error : CARDINAL
          Error status return.
  *)




  PROCEDURE ReStructure
             (CONST relName    : ARRAY OF CHAR;
              CONST oldDFL     : ARRAY OF CHAR;
              CONST recordProc : FixProcType;
              CONST ShowStatus : BOOLEAN;
              VAR   Error      : CARDINAL);

  (**
      ReStructure - Restructure the data base relation.


      This procedure restructures the data base relation from the
      old definition to the new one.  A new data file is made, the
      old one deleted and the new one renamed to the old. The new data
      file will then assume the version identifier of the new
      DFL.  The index file associated with the requested relation
      will be deleted and must be rebuilt using the "ReBuildIndex"
      procedure from Sage.  The following sequence of procedures
      is an example of a restructure and rebuild.

        ReStructure  ("MyRel", "SAMPLE.DFL", MyProc, TRUE, error);
        OpenRelation ("MyRel", TRUE);
        ReBuildIndex ("MyRel", TRUE, DummyDupProc, NumDups);

      This procedure provides the capability of execution of
      another procedure before each restructured record is written
      out.  This procedure (shown as "recordProc") has access to
      record through the normal Sage get and put routines (GetFieldA,
      PutFieldA, etc.).

      CALLING SEQUENCE -

        ReStructure (relName, oldDFL, recordProc, ShowStatus, error);

      ENTRY -

        relName : ARRAY OF CHAR
          Name of relation to restructure.

        oldDFL : ARRAY OF CHAR
          Name (including possible drive and directory) of old
          DFL file which has the same version number for the
          relation being restructured.  If a null string is
          used, the name of the currently opened DFL will
          be used.

        recordProc : PROC
          This procedure is executed after each old record is
          read and before it is written out to the restructured
          data base.  It may be used to change or load data
          into the data base records using the standard SAGE
          routines for "Get .." and "Put ..".

        ShowStatus : BOOLEAN
          TRUE - Show status messages as the work is performed.
          FALSE - Do NOT show messages as the work is performed.

      EXIT -

        error : CARDINAL
          Error status return.
  *)




  PROCEDURE SetVariableBlocking
             (CONST blocking : CARDINAL);

  (**
      SetVariableBlocking - Set the blocking factor for variable length data.


      This procedure change the blocking factor for the variable length
      data file used by the relation to be rebuilt.  If this is to
      be done, then this procedure must be called prior to each execution
      of ReFormat or ReStructure.  Otherwise, the blocking factor
      will remain the same as it was for the original block data file.

      CALLING SEQUENCE -

        SetVariableBlocking (blocking)

      ENTRY -

        blocking : CARDINAL
          The new blocking factor (30 .. n).  If you wish to reset to
              the original blocking factor, set this variable to zero (0).
              After each ReFormat or ReStructure execution, the blocking
              factor is automatically set to 0 to signal any subsequent
              ReFormat operations to use the original blocking factor.  If
              a relation's variable length file (block data file) was created
              using the standard default, it will have a blocking factor
              of 128.
  *)




  PROCEDURE OpenedRepairRelation
             (CONST RelationName : ARRAY OF CHAR;
              CONST MultiUser    : BOOLEAN;
              CONST OldDflName   : ARRAY OF CHAR;
              CONST ShowStatus   : BOOLEAN;
              VAR   Repaired     : BOOLEAN;
              VAR   TotalDups    : CARDINAL;
              VAR   Success      : BOOLEAN);

  (**
      OpenedRepairRelation - Check and rebuild single relation while Dfl is opened.


      While the DFL is already opened and the requested relation is closed this
      routine checks the relation to see if either a .DAT file restructure or a
      .IDX file reindex is needed.  If it is then the routine will try to perform
      the needed action.  If a restructure is needed the routine will use the name
      of the old dfl file that is passed in.  If that file does not match the version
      the routine will look for all possible matches first using the new method of
      naming old files (i.e. MyDfl.OLD, MyDfl.D02, MyDfl.D03, etc).  If it does not
      find a match during that search it tries the old method of naming just in case
      that file is still around (i.e. MyDfl.Old, MyDfl.OL2, MyDfl.OL3, etc).

      CALLING SEQUENCE -

        OpenedRepairRelation (RelationName, MultiUser, OldDflName, ShowStatus,
                              Repaired, TotalDups, Success)

      ENTRY -

        RelationName : ARRAY OF CHAR
          The name of the relation to check and rebuild if necessary.

        MultiUser : BOOLEAN
          TRUE - Use MultSage calls when working with the relation.
          FALSE - Use Sage calls when working with the relation.

        OldDflName : ARRAY OF CHAR
          The name of the .OLD dfl file.

        ShowStatus : BOOLEAN
          TRUE - Show messages during any rebuilding or reindexing.
          FALSE - Don't show message during any rebuilding or reindexing.

      EXIT -

        Repaired : BOOLEAN
          TRUE - The relation required a rebuild or reindex and was fixed.
          FALSE - No rebuilding or reindexing needed for this relation.

        TotalDups : CARDINAL
          The number of duplicate entries found while rebuilding a primary key
          in this relation.

        Success : BOOLEAN
          TRUE - The routine processed successfully.  If Repaired is also TRUE then
                 this flag indicates if that operation was successful.  If Repaired
                 is FALSE then this flag simply shows tha the routine ran and
                 exited successfully.
          FALSE - An error occured.  This could be that the file needed for a
                  rebuild could not be located or some other error prevented the
                  routine from completing the operation.
  *)




  PROCEDURE OpenedRepairAllRelations
             (CONST MultiUser  : BOOLEAN;
              CONST OldDflName : ARRAY OF CHAR;
              CONST ShowStatus : BOOLEAN;
              VAR   Repaired   : BOOLEAN;
              VAR   Success    : BOOLEAN);

  (**
      OpenedRepairAllRelations - Check and rebuild all relations while Dfl is opened.


      While the DFL is opened this routine checks cycles through all the relations
      and checks to see if either a .DAT file restructure or a .IDX file reindex is
      needed.  If it is then the routine will try to perform the needed action.  If
      a restructure is needed the routine will use the name of the old dfl file that
      is passed in.  If that file does not match the version the routine will look
      for all possible matches first using the new method of naming old files
      (i.e. MyDfl.OLD, MyDfl.D02, MyDfl.D03, etc).  If it does not find a match during
      that search it tries the old method of naming just in case that file is still
      around (i.e. MyDfl.Old, MyDfl.OL2, MyDfl.OL3, etc).

      CALLING SEQUENCE -

        OpenedRepairAllRelations (MultiUser, OldDflName, ShowStatus,
                                  Repaired, Success)

      ENTRY -

        MultiUser : BOOLEAN
          TRUE - Use MultSage calls when working with the relation.
          FALSE - Use Sage calls when working with the relation.

        OldDflName : ARRAY OF CHAR
          The name of the .OLD dfl file.

        ShowStatus : BOOLEAN
          TRUE - Show messages during any rebuilding or reindexing.
          FALSE - Don't show message during any rebuilding or reindexing.

      EXIT -

        Repaired : BOOLEAN
          TRUE - The relation required a rebuild or reindex and was fixed.
          FALSE - No rebuilding or reindexing needed for this relation.

        Success : BOOLEAN
          TRUE - The routine processed successfully.  If Repaired is also TRUE then
                 this flag indicates if that operation was successful.  If Repaired
                 is FALSE then this flag simply shows tha the routine ran and
                 exited successfully.
          FALSE - An error occured.  This could be that the file needed for a
                  rebuild could not be located or some other error prevented the
                  routine from completing the operation.
  *)




  PROCEDURE ClosedRepairRelation
             (CONST DflName      : ARRAY OF CHAR;
              CONST RelationName : ARRAY OF CHAR;
              CONST MultiUser    : BOOLEAN;
              CONST OldDflName   : ARRAY OF CHAR;
              CONST ShowStatus   : BOOLEAN;
              VAR   Repaired     : BOOLEAN;
              VAR   TotalDups    : CARDINAL;
              VAR   Success      : BOOLEAN);

  (**
      ClosedRepairRelation - Check and rebuild single relation while Dfl is closed.


      While the DFL is closed this routine checks a single relation to see if either
      a .DAT file restructure or a .IDX file reindex is needed.  If it is then the
      routine will try to perform the needed action.  If a restructure is needed the
      routine will use the name of the old dfl file that is passed in.  If that file
      does not match the version the routine will look for all possible matches first
      using the new method of naming old files (i.e. MyDfl.OLD, MyDfl.D02, MyDfl.D03,
      etc).  If it does not find a match during that search it tries the old method
      of naming just in case that file is still around (i.e. MyDfl.Old, MyDfl.OL2,
      MyDfl.OL3, etc).

      CALLING SEQUENCE -

        ClosedRepairRelation (DflName, RelationName, MultiUser, OldDflName, ShowStatus,
                              Repaired, TotalDups, Success)

      ENTRY -

        DflName : ARRAY OF CHAR
          The name of the Dfl file whose relations are to be checked.

        RelationName : ARRAY OF CHAR
          The name of the relation to check and rebuild if necessary.

        MultiUser : BOOLEAN
          TRUE - Use MultSage calls when working with the relation.
          FALSE - Use Sage calls when working with the relation.

        OldDflName : ARRAY OF CHAR
          The name of the .OLD dfl file.

        ShowStatus : BOOLEAN
          TRUE - Show messages during any rebuilding or reindexing.
          FALSE - Don't show message during any rebuilding or reindexing.

      EXIT -

        Repaired : BOOLEAN
          TRUE - The relation required a rebuild or reindex and was fixed.
          FALSE - No rebuilding or reindexing needed for this relation.

        TotalDups : CARDINAL
          The number of duplicate entries found while rebuilding a primary key
          in this relation.

        Success : BOOLEAN
          TRUE - The routine processed successfully.  If Repaired is also TRUE then
                 this flag indicates if that operation was successful.  If Repaired
                 is FALSE then this flag simply shows tha the routine ran and
                 exited successfully.
          FALSE - An error occured.  This could be that the file needed for a
                  rebuild could not be located or some other error prevented the
                  routine from completing the operation.
  *)




  PROCEDURE ClosedRepairAllRelations
             (CONST DflName    : ARRAY OF CHAR;
              CONST MultiUser  : BOOLEAN;
              CONST OldDflName : ARRAY OF CHAR;
              CONST ShowStatus : BOOLEAN;
              VAR   Repaired   : BOOLEAN;
              VAR   Success    : BOOLEAN);

  (**
      ClosedRepairAllRelations - Check and rebuild all relations while Dfl is closed.


      While the DFL is closed this routine checks cycles through all the relations
      and checks to see if either a .DAT file restructure or a .IDX file reindex is
      needed.  If it is then the routine will try to perform the needed action.  If
      a restructure is needed the routine will use the name of the old dfl file that
      is passed in.  If that file does not match the version the routine will look
      for all possible matches first using the new method of naming old files
      (i.e. MyDfl.OLD, MyDfl.D02, MyDfl.D03, etc).  If it does not find a match during
      that search it tries the old method of naming just in case that file is still
      around (i.e. MyDfl.Old, MyDfl.OL2, MyDfl.OL3, etc).

      CALLING SEQUENCE -

        ClosedRepairAllRelations (DflName, MultiUser, OldDflName, ShowStatus,
                                  Repaired, Success)

      ENTRY -

        DflName : ARRAY OF CHAR
          The name of the Dfl file whose relations are to be checked.

        MultiUser : BOOLEAN
          TRUE - Use MultSage calls when working with the relation.
          FALSE - Use Sage calls when working with the relation.

        OldDflName : ARRAY OF CHAR
          The name of the .OLD dfl file.

        ShowStatus : BOOLEAN
          TRUE - Show messages during any rebuilding or reindexing.
          FALSE - Don't show message during any rebuilding or reindexing.

      EXIT -

        Repaired : BOOLEAN
          TRUE - The relation required a rebuild or reindex and was fixed.
          FALSE - No rebuilding or reindexing needed for this relation.

        Success : BOOLEAN
          TRUE - The routine processed successfully.  If Repaired is also TRUE then
                 this flag indicates if that operation was successful.  If Repaired
                 is FALSE then this flag simply shows tha the routine ran and
                 exited successfully.
          FALSE - An error occured.  This could be that the file needed for a
                  rebuild could not be located or some other error prevented the
                  routine from completing the operation.
  *)




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