Sage-ST ä

Infolib

Documentation

CharacterIsValid CurrentFieldInfo CurrentFormInfo DefineKeyExitRange
FieldBlank FieldEmpty GetDFLVersion GetDes
GetFieldDes GetJoins GetMasterView GetRecordDes
GetViewFields GetViewNames GetViewRelations LastCursorField
LastExitChar RelationViewInfo ShowConcatInfo ShowField
ShowFieldEnumeration ShowFieldInfo ShowFileInfo ShowFormFieldColor
ShowFormFieldInfo ShowFormInfo ShowRecordInfo SystemModNumber
TotalJoins TotalRelations TotalViewFields TotalViewRelations
TotalViews ValidateField




  PROCEDURE DefineKeyExitRange
             (CONST startOfRange : CHAR;
              CONST endOfRange   : CHAR);




  PROCEDURE LastExitChar
             () : CHAR;




  PROCEDURE LastCursorField
             (CONST FormName  : ARRAY OF CHAR;
              VAR   relName   : ARRAY OF CHAR;
              VAR   fieldName : ARRAY OF CHAR;
              VAR   FldRepeat : CARDINAL;
              VAR   Error     : CARDINAL);

  (**
      LastCursorField - Return the last field the cursor was in.


      This procedure returns the last field in the requested form
      in which the cursor was located.  This procedure should be
      called immediately following the display and return from the
      form, otherwise, the saved cursor location may be lost as
      subsequent forms are displayed.

      CALLING SEQUENCE -

        LastCursorField (formName, relName, fieldName, FldRepeat, error)

      ENTRY -

        formName : ARRAY OF CHAR
          The name of the form

      EXIT -

        relName : ARRAY OF CHAR
          The relation name of the associated field.

        fieldName : ARRAY OF CHAR
          The field name in which the cursor was located.  This
          will be a nul array if the results could not be found

        FldRepeat : CARDINAL
          The repeat value for the field.

        error : CARDINAL
          Sage error status return (0=ok).

      EXAMPLE -

        MODULE InDemo1;

          -- Assume that you need to know what the last field
          -- you were in on a form so that you could return to
          -- that same place on the form later on.  This demo
          -- will give you the last field the cursor was on.


        IMPORT InfoLib;


        VAR
          returnfieldname : ARRAY [0 .. 7] OF CHAR;
          returnrelation : ARRAY [0 .. 7] OF CHAR;

          fieldrepeat : CARDINAL;
          errorvalue : CARDINAL;


        BEGIN
          -- We assume that OpenSystem has already been called
          -- and that a 'DisplayForm' or similar MODULE call
          -- has been called just before this statement.
          -- We also assume that 'STUDENT' is the form that was
          -- last displayed.

          LastCursorField ("STUDENT",
                           returnrelation,
                           returnfieldname,
                           fieldrepeat,
                           errorvalue);

        END InDemo1.
  *)




  PROCEDURE CurrentFieldInfo
             (VAR   currentRecord : ARRAY OF CHAR;
              VAR   currentField  : ARRAY OF CHAR;
              VAR   currentRepeat : CARDINAL);

  (**
      CurrentFieldInfo - Return the current field status information.


      This procedure returns the information concerning the
      current record and field.  This may be the field in which the
      cursor resides on a form, and, if not in a form, the current
      or last referenced field of a record.  If in 'DefineFieldCheck',
      it is the record and field which is being checked.

      CALLING SEQUENCE -

        CurrentFieldInfo (currentRecord, currentField, currentRepeat)

      EXIT -

        currentRecord : ARRAY OF CHAR
          The name of the current record.

        currentField : ARRAY OF CHAR
          The name of the current record field.

        currentRepeat : CARDINAL
          The repeat value of the current field (1 .. n).
  *)




  PROCEDURE CurrentFormInfo
             (VAR   currentForm   : ARRAY OF CHAR;
              VAR   currentRecord : ARRAY OF CHAR;
              VAR   currentField  : ARRAY OF CHAR;
              VAR   currentRepeat : CARDINAL;
              VAR   tabOrder      : CARDINAL);

  (**
      CurrentFormInfo - Return the current form status information.


      This procedure returns the current information concerning the
      current form.  If not in a form, it returns the information
      concerning the last form called.  This information is useful
      for such functions as the 'DefinedFieldCheck' for checking
      valid field values, and for the 'DisplayFormV' type calls.

      CALLING SEQUENCE -

        CurrentFormInfo (currentForm, currentRecord, currentField,
                         currentRepeat)

      EXIT -

        current : ARRAY OF CHAR
          The current form in which the cursor resides.

        currentRecord : ARRAY OF CHAR
          The name of the record of the field on the form in
          which the cursor currently resides

        currentField : ARRAY OF CHAR
          The name of the record field associated with the field
          on the form in which the cursor currently resides.

        currentRepeat : CARDINAL
          The repeat value of the current field (1 .. n).

        tabOrder : CARDINAL
          The tab order (1 .. n) or the indicated field within the form.

      EXAMPLE -

        MODULE InDemo2;

          -- Assume that we are in Checklib.  This Demo
          -- will return the current form information
          -- so that you can check various fields.
          -- (see Checklib).


        IMPORT InfoLib;


        VAR
          returnfieldname : ARRAY [0 .. 7] OF CHAR;
          returnrelation : ARRAY [0 .. 7] OF CHAR;
          returnform : ARRAY [0 .. 7] OF CHAR;

          fieldrepeat : CARDINAL;
          tabOrder : CARDINAL;
          errorvalue : CARDINAL;

        BEGIN
          -- We assume that OpenSystem has already been called
          -- and that a 'DisplayForm' or similar MODULE call
          -- has been called just before this statement.
          -- We also assume that this code is in Checklib.adb.


          CurrentFormInfo (returnform,
                           returnrelation,
                           returnfieldname,
                           fieldrepea);
                           tabOrder);

          -- Continue on with other Checklib items.
        END InDemo2.
  *)




  PROCEDURE GetDFLVersion
             (VAR   Indicator1 : CARDINAL;
              VAR   Indicator2 : CARDINAL;
              VAR   Indicator3 : CARDINAL);

  (**
      GetDFLVersion - Retreive the version ids for the current DFL.


      This procedure returns the version ids for the current DFL file.

      CALLING SEQUENCE -

        GetDFLVersion (Indicator1, Indicator2, Indicator3);

      ENTRY -

      EXIT -

        Indicator1 : CARDINAL
          First version id.

        Indicator2 : CARDINAL
          Second version id.

        Indicator3 : CARDINAL
          Third version id.
  *)




  PROCEDURE SystemModNumber
             () : CARDINAL;

  (**
      SystemModNumber - Retreive the system modification number.

      This is the number that controls access to DFL versions.
      For instance you can't open a version 2 DFL with the
      current libraries since they have advanced beyond that
      point.


      CALLING SEQUENCE -

        ModNumber := SystemModNumber ();

      EXIT -

        CARDINAL
          The system modification number.
  *)




  PROCEDURE TotalRelations
             () : CARDINAL;

  (**
      TotalRelations - Retreive the number of relations for the current system.


      This procedure returns the number of relations for the
      currently opened system.

      CALLING SEQUENCE -

        NumRels := TotalRelations ();

      EXIT -

        CARDINAL
          Number of relations belonging to the current system.
  *)




  PROCEDURE ShowRecordInfo
             (CONST recordNumber : CARDINAL;
              VAR   recordName   : ARRAY OF CHAR;
              VAR   fileNumber   : CARDINAL;
              VAR   FieldTotal   : CARDINAL;
              VAR   recordSize   : CARDINAL;
              VAR   Version      : TimeDate.Time;
              VAR   Error        : CARDINAL);

  (**
      ShowRecordInfo - Retreive and show record information.


      This procedure retrieves information about the specified
      record and returns it.  Either the record number or the
      record name may be used.

      CALLING SEQUENCE -

        ShowRecordInfo (recordNumber, recordName, fileNumber,
                        fieldTotal, recordSize, Version, error)

      ENTRY -

        recordNumber : CARDINAL
          The number of the record (1 .. n) to be located.  If this
          value is set to 0 (zero), then the 'recordName' is used
          instead to locate the requested record.

        recordName : ARRAY OF CHAR
          The name of the record to be located (if 'recordNumber'
          is set to 0 (zero)).

      EXIT -

        recordName : ARRAY OF CHAR
          The name of the record.

        fileNumber : CARDINAL
          The number of the file associated with the relation or
          0 if a memory record.

        fieldTotal : CARDINAL
          The number of fields in the record.

        recordSize : CARDINAL
          The actual byte size of the record.

        Version : TimeDate.Time
          The version of the relation.  Can be converted to usable format
          with TimeLib.ClockToTime1.

        error : CARDINAL
          Sage error return (0 if ok).

      EXAMPLE -

        MODULE InDemo3;

          -- Suppose that we need to know if any fields are
          -- concatenated within the relation (record)
          -- 'DEMOREL2' and what fields are concatenated.
          -- We will first use ShowRecordInfo to find out
          -- how many fields are in the relation.  Next we
          -- use ShowFieldInfo to get the fields' name and
          -- to see if the fieldType is 0 (concatenated.
          -- With the name of the concatenated field we
          -- call ShowConcatInfo to see which fields are
          -- used for concatenation.

        IMPORT Display;
        IMPORT InfoLib;
                               ShowFieldInfo,
                               ShowConcatInfo,
                               InfoName;


        VAR
          returnRecord : ARRAY [0 .. 7] OF CHAR;
          returnFieldName : ARRAY [0 .. 7] OF CHAR;

          sizeOfRecord : CARDINAL;
          numFields : CARDINAL;
          errorValue : CARDINAL;

          fieldNumb : CARDINAL;
          typeOfField : CARDINAL;
          fieldAlphaLength : CARDINAL;
          fieldDefLength : CARDINAL;
          numDecDigits : CARDINAL;
          subtype : CARDINAL;
          numRepeats : CARDINAL;
          totalConcat : CARDINAL;

          keyValue : CHAR;

          concatFields : ARRAY [0 .. 4] OF InfoName;

        BEGIN
          -- Assume that OpenSystem has been called and that
          -- the record 'DEMOREL2' is in the DFL.

          returnRecord := "DEMOREL2";

          ShowRecordInfo (0,
                          returnRecord,
                          numFields,
                          sizeOfRecord,
                          errorValue);

          fieldNumb := 1;

          WHILE (fieldNumb <> numFields) DO
            ShowFieldInfo (returnRecord,
                           fieldNumb,
                           returnFieldName,
                           typeOfField,
                           fieldAlphaLength,
                           fieldDefLength,
                           numDecDigits,
                           subtype,
                           numRepeats,
                           keyValue,
                           errorValue);

            IF typeOfField = 0 THEN  -- concatenated field
              ShowConcatInfo (returnRecord,
                              0,
                              returnFieldName,
                              concatFields,
                              totalConcat,
                              errorValue);

              DisplayMessage ("Concat Field found.", TRUE );
            END;

            fieldNumb := fieldNumb + 1;
          END;

        END InDemo3.
  *)




  PROCEDURE ShowField
             (CONST systemNumber  : CARDINAL;
              CONST recordNumber  : CARDINAL;
              CONST fieldNumber   : CARDINAL;
              VAR   fieldName     : ARRAY OF CHAR;
              VAR   fieldType     : CARDINAL;
              VAR   alphaLength   : CARDINAL;
              VAR   definedLength : CARDINAL;
              VAR   decimalDigits : CARDINAL;
              VAR   fieldSubType  : CARDINAL;
              VAR   repeatTotal   : CARDINAL;
              VAR   KeyType       : CHAR;
              VAR   Error         : CARDINAL);




  PROCEDURE ShowFieldInfo
             (CONST recordName    : ARRAY OF CHAR;
              CONST fieldNumber   : CARDINAL;
              VAR   fieldName     : ARRAY OF CHAR;
              VAR   fieldType     : CARDINAL;
              VAR   alphaLength   : CARDINAL;
              VAR   definedLength : CARDINAL;
              VAR   decimalDigits : CARDINAL;
              VAR   fieldSubType  : CARDINAL;
              VAR   repeatTotal   : CARDINAL;
              VAR   KeyType       : CHAR;
              VAR   Error         : CARDINAL);

  (**
      ShowFieldInfo - Show information about the requested field.


      This procedure displays information about the requested field
      if it exists.  Either the field number or the field name may
      be used to reference the field.

      CALLING SEQUENCE -

        ShowFieldInfo (recordName, fieldNumber, fieldName, fieldType,
                       definedLength, decimalDigits, fieldSubType,
                       alphaLength, repeatTotal, keyType, error)

      ENTRY -

        recordName : ARRAY OF CHAR
          Name of relation to which the field belongs.

        fieldNumber : CARDINAL
          The number of the field (1 .. n) to be located.  If this
          value is set to 0 (zero), the the 'fieldName' is used
          instead.

        fieldName : ARRAY OF CHAR
          The name of the field to be located (if 'fieldNumber' is
          set to 0 (zero)).

      EXIT -

        fieldName : ARRAY OF CHAR
          The name of the field if it exists.

        fieldType : CARDINAL
          The type of the field.

        alphaLength : CARDINAL
          The length of the field as it is displayed on the form
          or returned as an alpha value.

        definedLength : CARDINAL
          The user defined length of the field.  This is the length
          specified in the Thor editor during schema definition.
          This length may not be the same as the alphaLength since
          fields such as scientific notation fields display longer
          than their defined length.

        decimalDigits : CARDINAL
          The number of digits to the right of the decimal.  This
          is only valid if the field is one of the real number type
          fields (real, sci. notation, money).

        fieldSubType : CARDINAL
          Field subtype.

        repeatTotal : CARDINAL
          The number of repeat values defined for the field.

        keyType : CHAR
          The key type of the field ("P"=primary, "A"=alternate,
          "N"=non-keyed).

        error : CARDINAL
          Sage error return (0 if ok).

      EXAMPLE -

        SEE ShowRecordInfo.
  *)




  PROCEDURE ShowConcatInfo
             (CONST recordName   : ARRAY OF CHAR;
              CONST fieldNumber  : CARDINAL;
              VAR   fieldName    : ARRAY OF CHAR;
              VAR   concatFields : ARRAY OF InfoName;
              VAR   concatTotal  : CARDINAL;
              VAR   Error        : CARDINAL);

  (**
      ShowConcatInfo - Return sub-fields of a concatenated field.


      This procedure returns the subfields of a concatenated field.
      If the field is not a concatenated field or has not subfields,
      the 'concatTotal' is returned with a zero (0).

      ENTRY -

        recordName : ARRAY OF CHAR
          Name of relation to which the field belongs.

        fieldNumber : CARDINAL
          The number of the field (1 .. n) to be located.  If this
          value is set to 0 (zero), the the 'fieldName' is used
          instead.

        fieldName : ARRAY OF CHAR
          The name of the field to be located (if 'fieldNumber' is
          set to 0 (zero)).

      EXIT -

        fieldName : ARRAY OF CHAR
          The name of the field.

        concatFields : ARRAY OF InfoName
          Array of 8 character field names.

        ConcatTotal : CARDINAL
          Number of names returned in 'concatFields'.

        error : CARDINAL
          Sage error return (0 if ok).

      EXAMPLE -

        SEE ShowRecordInfo.
  *)




  PROCEDURE ShowFieldEnumeration
             (CONST recordName  : ARRAY OF CHAR;
              CONST fieldName   : ARRAY OF CHAR;
              CONST valueNumber : CARDINAL;
              VAR   eValue      : ARRAY OF CHAR;
              VAR   totalValues : CARDINAL;
              VAR   Error       : CARDINAL);

  (**
      ShowFieldEnumeration - Return enumeration value for field.


      This procedure returns the specified enumeration values for the
      field if it exists.

      CALLING SEQUENCE -

        ShowFieldEnumeration (recordName, fieldName, valueNumber,
                              eValue, totalValues, error)

      ENTRY -

        recordName : ARRAY OF CHAR
          Name of relation to which the field belongs.

        fieldName : ARRAY OF CHAR
          The name of the field.

        valueNumber : CARDINAL
          The enumeration value number (1 .. n).

      EXIT -

        eValue : ARRAY OF CHAR
          The enumeration value, if it exists

        totalValues : CARDINAL
          The total number of enumeration values for the
          field (0 .. n).

        error : CARDINAL
          Sage error return (0 if ok).  This value will be
          set to zero if the field exists but no enumeration
          values exists.  In this case, the 'totalValues' will
          be set to zero as well.
  *)




  PROCEDURE ShowFileInfo
             (CONST fileNumber : CARDINAL;
              VAR   dataFile   : ARRAY OF CHAR;
              VAR   indexFile  : ARRAY OF CHAR;
              VAR   blockFile  : ARRAY OF CHAR;
              VAR   maxRecords : CARDINAL;
              VAR   Error      : CARDINAL);

  (**
      ShowFileInfo - Show the names associated with the given number.


      This procedure returns the file names associated with the
      given file set number, 'fileNumber'.  These will be the names
      as defined within the data dictionary (.DFL) file.  If any other
      path has been defined from the CONFIGUR system or the
      'Sage.ResetRelationPath', it may also be retrieved using
      the 'Sage.GetRelationPath' procedure.

      CALLING SEQUENCE -

        ShowFileInfo (fileNumber, dataFile, indexFile, blockFile,
                      maxRecords, error)

      ENTRY -

        fileNumber : CARDINAL
          The file set number.

      EXIT -

        dataFile : ARRAY OF CHAR
          The name of the data file and path and defined in the
          current data dictionary file (.DFL file).

        indexFile : ARRAY OF CHAR
          The name of the index file and path and defined in the
          current data dictionary file (.DFL file).

        blockFile : ARRAY OF CHAR
          The name of the block file and path and defined in the
          current data dictionary file (.DFL file).

        maxRecords : CARDINAL
          The maximum number of records allowed in the relation.

        error : CARDINAL
          Sage error return (0 if ok).
  *)




  PROCEDURE ShowFormFieldColor
             (CONST FormName       : ARRAY OF CHAR;
              CONST fieldNumber    : CARDINAL;
              VAR   normalColor    : CARDINAL;
              VAR   highlightColor : CARDINAL;
              VAR   Error          : CARDINAL);




  PROCEDURE ShowFormInfo
             (CONST FormNumber  : CARDINAL;
              VAR   FormName    : ARRAY OF CHAR;
              VAR   FieldTotal  : CARDINAL;
              VAR   HelpForm    : ARRAY OF CHAR;
              VAR   topRow      : CARDINAL;
              VAR   bottomRow   : CARDINAL;
              VAR   leftColumn  : CARDINAL;
              VAR   rightColumn : CARDINAL;
              VAR   Error       : CARDINAL);

  (**
      ShowFormInfo - Show information about the requeste form.


      This procedure returns information about the requested form.
      The form may be designated by sequential number (sorted
      alphabetically) or name.

      CALLING SEQUENCE -

        ShowFormInfo (formNumber, formName, fieldTot, helpForm, topRow,
                      bottomRow, leftColumn, rightColumn, error)

      ENTRY -

        formNumber : CARDINAL
          Sequential number of form (1 .. n) or 0 if the form
          name is to be used instead.

        formName : ARRAY OF CHAR
          The name of the requested form if the 'formNumber' has been
          set to 0 (zero).

      EXIT -

        formName : ARRAY OF CHAR
          The name of the form.

        fieldTotal : CARDINAL
          The number of fields found on the form.

        helpForm : ARRAY OF CHAR
          The name of the general help form associated with the
          requested form (or nul string if none defined).
          ("EXIT" is a reserved name for help processing termination.)

        topRow : CARDINAL
          The top row of the form on the screen (1 .. 24).

        bottomRow : CARDINAL
          The bottom row of the form on the screen (topRow .. 24).

        leftColumn : CARDINAL
          The left column of the form on the screen (1 .. 80).

        rightColumn : CARDINAL
          The right column of the form on the screen (leftColumn .. 80).

        error : CARDINAL
          Sage error (0=ok).

      EXAMPLE -

        MODULE InDemo7;

          -- Assume that for a particular form we want to see if
          -- a field is named 'PSSN'.  We use ShowFormInfo to
          -- get how many fields are in the form and then we use
          -- ShowFormFieldInfo to get each fields' name.

        IMPORT Display;
        IMPORT InfoLib;
        IMPORT StringsX;


        VAR
          returnHelpForm : ARRAY [0 .. 7] OF CHAR;
          returnFormName : ARRAY [0 .. 7] OF CHAR;
          returnFieldName : ARRAY [0 .. 7] OF CHAR;
          returnRelName : ARRAY [0 .. 7] OF CHAR;

          repeatValue : CARDINAL;
          typeOfDisplay : CARDINAL;
          row : CARDINAL;
          column : CARDINAL;
          errorValue : CARDINAL;

          numOfFields : CARDINAL;
          topRow : CARDINAL;
          bottomRow : CARDINAL;
          leftColumn : CARDINAL;
          rightColumn : CARDINAL;
          tabOrder : CARDINAL;
          fieldNum : CARDINAL;


        BEGIN
          -- assume that OpenSystem has been called and that
          -- the form 'STUDENT' is in the DFL.

          StringsX.NulFill ('STUDENT',
                            returnFormName);

          ShowFormInfo (0,
                        returnFormName,
                        numOfFields,
                        returnHelpForm,
                        topRow,
                        bottomRow,
                        leftColumn,
                        rightColumn,
                        errorValue);

          fieldNum := 1;

          WHILE (fieldNum <= numOfFields) DO
            ShowFormFieldInfo ("STUDENT",
                               fieldNum,
                               returnRelName,
                               returnFieldName,
                               repeatValue,
                               returnHelpForm,
                               typeOfDisplay,
                               row,
                               column,
                               tabOrder,
                               errorValue);

            IF (Compare (returnFieldName[0 .. 3], 'PSSN') = equal) THEN
              DisplayMessage ("PSSN found.", TRUE);
            END;

            fieldNum := fieldNum + 1;
          END;

        END InDemo7.
  *)




  PROCEDURE ShowFormFieldInfo
             (CONST FormName    : ARRAY OF CHAR;
              CONST fieldNumber : CARDINAL;
              VAR   relName     : ARRAY OF CHAR;
              VAR   fieldName   : ARRAY OF CHAR;
              VAR   FldRepeat   : CARDINAL;
              VAR   HelpForm    : ARRAY OF CHAR;
              VAR   displayType : CARDINAL;
              VAR   row         : CARDINAL;
              VAR   column      : CARDINAL;
              VAR   tabOrder    : CARDINAL;
              VAR   Error       : CARDINAL);

  (**
      ShowFormFieldInfo - Show information about a form's field.


      This procedure displays the information about a field of
      a requested form.

      CALLING SEQUENCE -

        ShowFormFieldInfo (formName, fieldNumber, relName, fieldName,
                           FldRepeat, helpForm, displayType, row, column, error)

      ENTRY -

        formName : ARRAY OF CHAR
          Name of the requested form.

        fieldNumber : CARDINAL
          Number of the requested field on the form.  All fields are
          numbered sequentially starting from the top left corner of
          the form going from the left column to the right column,
          top row to the bottom row. (1 .. n)

      EXIT -

        relName : ARRAY OF CHAR
          Name of the relation associated with the requested form
          field.

        fieldName : ARRAY OF CHAR
          Name of the relation's field associated with the requested
          form field.

        FldRepeat : CARDINAL
          Repeat number of the relation's field used for the requested
          field (1 .. n).

        helpForm : ARRAY OF CHAR
          Name of the help form associated with requested form field.
          ("EXIT" is a reserved name for help processing termination.)

        displayType : CARDINAL
          0-Display only, 1-Display/Entry, 2-Highlighted.

        row : CARDINAL
          The row on the screen where the form field begins (1 .. 24).

        column : CARDINAL
          The column on the screen where the form field begins (1 .. 80).

        tabOrder : CARDINAL
          The tab order of the requested field.

        error : CARDINAL
          Sage error (0=ok)

      EXAMPLE -

        SEE ShowFormInfo.
  *)




  PROCEDURE GetRecordDes
             (CONST relName : ARRAY OF CHAR;
              VAR   Des     : ARRAY OF CHAR;
              VAR   Error   : CARDINAL);

  (**
      GetRecordDes - Get a record's description.


      This procedure retrieves the description (available if the
      .DFL was produced with THOR 3.1 or higher) for the specified
      record.

      CALLING SEQUENCE -

        GetRecordDes (relName, des, error)

      ENTRY -

        relName : ARRAY OF CHAR
          Relation name.

      EXIT -

        des : ARRAY OF CHAR     [0 .. 29]
          Record's (relation's) description.

        error : CARDINAL
          Sage error (0=ok)

      EXAMPLE -

        MODULE InDemo8;

          -- Suppose we wanted to show the user the
          -- description of the relation 'DEMOREL2'.
          -- This Demo will get the description of
          -- 'DEMOREL2' as it was described in THOR.

        IMPORT InfoLib;


        VAR
          description : ARRAY [0 .. 29] OF CHAR;

          errorValue : CARDINAL;

        BEGIN
          -- Assume that 'OpenSystem' has been called
          -- and the relation 'DEMOREL2' is contained in
          -- the DFL.

          GetRecordDes ("DEMOREL2", description, errorValue);

        END InDemo8.
  *)




  PROCEDURE GetFieldDes
             (CONST relName   : ARRAY OF CHAR;
              CONST fieldName : ARRAY OF CHAR;
              VAR   Des       : ARRAY OF CHAR;
              VAR   Error     : CARDINAL);

  (**
      GetFieldDes - Get a field's description.


      This procedure retrieves a field's description (available if the
      .DFL was produced with THOR 3.1 or higher) for the specified
      record.

      CALLING SEQUENCE -

        GetFieldDes (relName, fieldName, des, error)

      ENTRY -

        relName : ARRAY OF CHAR
          Relation name.

        fieldName : ARRAY OF CHAR
          Name of the relation's field.

      EXIT -

        des : ARRAY OF CHAR     [0 .. 29]
          Record's (relation's) description.

        error : CARDINAL
          Sage error (0=ok)

      EXAMPLE -

        MODULE InDemo9;

          -- Suppose we wanted to show the user the
          -- description of the field 'PSSN' in the
          -- relation 'DEMOREL2'.
          -- This Demo will get the description of
          -- 'PSSN' as it was described in THOR.


        IMPORT InfoLib;


        VAR
          description : ARRAY [0 .. 29] OF CHAR;

          errorValue : CARDINAL;

        BEGIN
          -- Assume that 'OpenSystem' has been called
          -- and the relation 'DEMOREL2' with the field
          -- 'PSSN' is contained in the DFL.

          GetFieldDes ("DEMOREL2",
                       "PSSN",
                       description,
                       errorValue);

        END InDemo9.
  *)




  PROCEDURE GetDes
             (CONST relName  : ARRAY OF CHAR;
              CONST desMax   : CARDINAL;
              VAR   Des      : ARRAY OF DesInfo;
              VAR   desTotal : CARDINAL;
              VAR   Error    : CARDINAL);

  (**
      GetDes - Get the description for a relation and its fields.


      This procedure retrieves the descriptions for the specified
      relation and as many of its fields as can be contained
      within the supplied array.

      CALLING SEQUENCE -

        GetDes (relName, desMax, des, desTotal, error)

      ENTRY -

        relName : ARRAY OF CHAR
          Relation name.

        desMax : CARDINAL
          The maximum number of name/description (DesInfo) pairs
          which may be retrieved.

      EXIT -

        des : ARRAY OF DesInfo
          The name/description pairs requested.  The first pair
          will be for the relation and the following pairs will
          be the field names and descriptions up to 'desMax' or
          the total number of fields in the relation (whichever
          comes first).

        desTotal : CARDINAL
          The total number of name/description pairs returned
          in the 'des' array.

        error : CARDINAL
          Sage error (0=ok)

      EXAMPLE -

        MODULE InDemo10;

          -- Suppose we wanted to show the user all
          -- of the names and descriptions of the
          -- relation 'DEMOREL2' including the
          -- relation description.  Also the maximum
          -- descriptions (including the relation
          -- description) to be shown is 5.


        IMPORT Display;
        IMPORT InfoLib;
                                DesInfo;
        IMPORT ThorPort;
        IMPORT StringsX;
                                Concat;


        VAR
          descArray : ARRAY [0 .. 4] OF DesInfo;

          tempString : ARRAY [0 .. 49] OF CHAR;

          descTotal : CARDINAL;
          errorValue : CARDINAL;
          numDesc : CARDINAL;

          done : BOOLEAN;


        BEGIN
          -- Assume that 'OpenSystem' has been called
          -- and 'DEMOREL2' is in the DFL.

          GetDes ("DEMOREL2",
                  5,
                  descArray,
                  descTotal,
                  errorValue);

          FOR numDesc := 0 TO descTotal - 1 DO
            NulFill (tempString, tempString);

            Concat (descArray[numDesc].name,
                    "   ",
                    tempString,
                    done  );

            Concat (tempString,
                    descArray[numDesc].des,
                    tempString,
                    done  );

            DisplayMessage (tempString, FALSE);

            ThorPort.Pause (2000);
          END;

        END InDemo10.
  *)




  PROCEDURE GetMasterView
             (VAR   viewName : ARRAY OF CHAR;
              VAR   viewDes  : ARRAY OF CHAR;
              VAR   viewNum  : CARDINAL);

  (**
      GetMasterView - Return master view information.


      This procedure returns the master view information.  If no
      master view is available, then the 'viewNum' variable
      is returned with a 0 (zero).

      CALLING SEQUENCE -

        GetMasterView (viewName, viewDes, viewNum)

      EXIT -

        viewName : ARRAY OF CHAR
          The name of the master view (up to 8 char).

        viewDes : ARRAY OF CHAR
          The description accompanying the master view (up to 30 char).

        viewNum : CARDINAL
          The view number (0 .. n) where 0 (zero) indicates that no
          master view is present.  Note - IF THERE IS NO MASTER VIEW,
          THEN NO VIEWS AT ALL ARE AVAILABLE

      EXAMPLE -

        MODULE InDemo11;

          -- Suppose we wanted to know if views exits
          -- and if so what the name of the master view
          -- is.  This demo will find out what the
          -- master view is.


        IMPORT Display;
        IMPORT InfoLib;
        IMPORT StringsX;

        VAR
          viewName : ARRAY [0 .. 7] OF CHAR;
          description : ARRAY [0 .. 29] OF CHAR;
          tempString : ARRAY [0 .. 39] OF CHAR;

          numOfView : CARDINAL;

          done : BOOLEAN;


        BEGIN
          -- Assume that 'OpenSystem' has been called.

          GetMasterView (viewName,
                         description,
                         numOfView);

          IF numOfView > 0 THEN  -- master view available
            NulFill (tempString, tempString);

            Concat ("Master View is ",
                    viewName,
                    tempString,
                    done );

            DisplayMessage (tempString, FALSE);
          ELSE
            DisplayMessage ("No views available.", TRUE);
          END;

        END InDemo11.
  *)




  PROCEDURE TotalViews
             () : CARDINAL;

  (**
      TotalViews - Return the total number of views available.


      This procedure returns the total number of views available in
      the current data base dictionary file.

      CALLING SEQUENCE -

        c := TotalViews ();

      EXIT -

        c : CARDINAL
          The total number of views available.

      EXAMPLE -

        MODULE InDemo12;

          -- This Demo shows how many views there are in
          -- the DFL and goes through each View, displaying
          -- the Veiw name and the associated Joins also
          -- showing how many Joins there are for the
          -- View name.


        IMPORT Convert;
        IMPORT Display;
        IMPORT InfoLib;
        IMPORT StringsX;
        IMPORT ThorPort;


        VAR
          viewNames : ARRAY [0 .. 4] OF DesInfo;
          joinPairs : ARRAY [0 .. 4] OF JoinInfo;

          tempString1 : ARRAY [0 .. 4] OF CHAR;
          tempString2 : ARRAY [0 .. 39] OF CHAR;

          numOfViews : CARDINAL;
          totalNumJoins : CARDINAL;
          viewNum : CARDINAL;
          joinNum : CARDINAL;

          done : BOOLEAN;

        BEGIN
          -- Assume that 'OpenSystem' has been called.

          numOfViews := TotalViews ();

          NulFill (tempString1, tempString1);
          NulFill (tempString2, tempString2);

          IntToStr (numOfViews,
         tempString1,
         5,
         done );

          Concat ("Total Number of Views = ",
                  tempString2,
                  tempString2,
                  done );

          Concat (tempString2,
                  tempString1,
                  tempString2,
                  done );

          DisplayMessage (tempString2, FALSE);


          ThorPort.Pause (2000);

          GetViewNames (1, numOfViews, viewNames);

          FOR viewNum := 1 TO numOfViews DO

            NulFill (tempString1, tempString1);
            NulFill (tempString2, tempString2);

            Concat ("Views name = ",
                    viewNames[viewNum].name,
         tempString2,
         done );

            DisplayMessage (tempString2, FALSE);

            Concat (tempString2,
                    tempString1,
                    tempString2,
                    done );

            ThorPort.Pause (2000);


            totalNumJoins := TotalJoins (viewNames[viewNum].name);

            NulFill (tempString2, tempString2);

            IntToStr (totalNumJoins,
                      tempString1,
                      5,
                      done );

            Concat ("Total Number of Joins = ",
                    tempString1,
                    tempString2,
                    done );

            DisplayMessage (tempString2, FALSE);

            ThorPort.Pause (2000);

            GetJoins ("SSNS", 1, totalNumJoins, joinPairs);

            FOR joinNum := 1 TO totalNumJoins DO
              NulFill (tempString2, tempString2);

              Concat ("Relation 1 name = ",
                      joinPairs[joinNum].rel1,
           tempString2,
           done );

              DisplayMessage (tempString2, FALSE);

              ThorPort.Pause (2000);

              NulFill (tempString2, tempString2);

              Concat ("Relation 2 name = ",
                      joinPairs[joinNum].rel2,
                      tempString2,
                      done );

              DisplayMessage (tempString2, FALSE);

              ThorPort.Pause (2000);
            END;
          END;

        END InDemo12.
  *)




  PROCEDURE GetViewNames
             (CONST startView  : CARDINAL;
              VAR   TotalViews : CARDINAL;
              VAR   viewNames  : ARRAY OF DesInfo);

  (**
      GetViewNames - Return a list of view names and descriptions.


      This procedure returns a list of the requested view names
      along with their accompanying descriptions.

      CALLING SEQUENCE -

        GetViewNames (startView, totalViews, viewNames)

      ENTRY -

        startView : CARDINAL
          The starting view number to return in the name list
          (1 .. n wher n=total views).

        totalViews : CARDINAL
          The total number of views to return in the list beginning
          at the 'startView'.  If more views are requested than
          available, the number available will be returned.

      EXIT -

        totalView : CARDINAL
          The number of view names/descriptions returned.

        viewName : ARRAY OF DesInfo
          A list of view names and descriptions.

      EXAMPLE -

        SEE TotalViews.
  *)




  PROCEDURE TotalJoins
             (CONST viewName : ARRAY OF CHAR) : CARDINAL;

  (**
      TotalJoins - Return the total join pairs in a view.


      This procedure returns the total number of join pairs in
      a selected view.

      CALLING SEQUENCE -

        c := TotalJoins ();

      ENTRY -

        viewName : ARRAY OF CHAR
          The name of the view to look for join pairs
          (up to 8 char).

      EXIT -

        c : CARDINAL
          The total number of join pairs in a view.

      EXAMPLE -

        SEE TotalViews.
  *)




  PROCEDURE GetJoins
             (CONST viewName   : ARRAY OF CHAR;
              CONST startJoin  : CARDINAL;
              VAR   TotalJoins : CARDINAL;
              VAR   joinPairs  : ARRAY OF JoinInfo);

  (**
      GetJoins - Return join pairs.


      This procedure returns requested join pairs.

      CALLING SEQUENCE -

        GetJoins (viewName, startJoin, totalJoins, joinPairs)

      ENTRY -

        viewName : ARRAY OF CHAR
          The name of the view.

        startJoin : CARDINAL
          The number of the first join pair to return.

        totalJoins : CARDINAL
          The max number of join pairs to return in the 'joinPairs'
          array. (1 .. n)

      EXIT -

        totalJoins : CARDINAL
          The number of join pairs returned in 'joinPairs'.

        joinPairs : ARRAY OF JoinInfo
          The join pairs.

      EXAMPLE -

        SEE TotalViews.
  *)




  PROCEDURE TotalViewRelations
             (CONST viewName : ARRAY OF CHAR) : CARDINAL;

  (**
      TotalViewRelations - The total number of relations accessed by a view.


      This procedure returns the total number of relations which are
      viewable from the selected view.

      CALLING SEQUENCE -

        c := TotalViewrelations (viewName);

      ENTRY -

        viewName : ARRAY OF CHAR
          The name of the view to look for relations
          (up to 8 char).

      EXIT -

        c : CARDINAL
          The total number of relations accessed by a view.

      EXAMPLE -

        MODULE InDemo16;

          -- This demo will show how many relations
          -- are viewable from a View and then
          -- show some of the relations.

        IMPORT Convert;
        IMPORT Display;
        IMPORT InfoLib;
        IMPORT StringsX;
        IMPORT ThorPort;


        VAR
          totalRelations : CARDINAL;
          relationNum : CARDINAL;

          relations : ARRAY [0 .. 9] OF InfoName;

          tempString1 : ARRAY [0 .. 4] OF CHAR;
          tempString2 : ARRAY [0 .. 39] OF CHAR;

          done : BOOLEAN;

        BEGIN
          -- Assume that 'OpenSystem' has been called
          -- and that the View name 'SSNS' is in the DFL.

          totalRelations := TotalViewRelations ("SSNS");

          NulFill (tempString1, tempString1);
          NulFill (tempString2, tempString2);

          IntToStr (totalRelations,
                    tempString1,
                    5,
                    done );

          Concat ("Total relations viewable is ",
                  tempString2,
                  tempString2,
                  done );

          Concat (tempString2,
                  tempString1,
                  tempString2,
                  done );

          DisplayMessage (tempString2, FALSE);

          ThorPort.Pause (2000);

          IF totalRelations > 10 THEN
            totalRelations := 10;
          END;

          GetViewRelations ("SSNS",
                            1,
                            totalRelations,
                            relations);

          FOR relationNum := 0 TO totalRelations - 1 DO
            DisplayMessage (relations[relationNum], FALSE);

            ThorPort.Pause (2000);

          END;

        END InDemo16.
  *)




  PROCEDURE RelationViewInfo
             (CONST viewName    : ARRAY OF CHAR;
              CONST relNumber   : CARDINAL;
              CONST relName     : ARRAY OF CHAR;
              VAR   firstField  : CARDINAL;
              VAR   totalFields : CARDINAL);

  (**
      RelationViewInfo - Return info about a relation in a view.


      This procedure returns field info about a relation from a
      selected view.  A view is composed of fields from one or
      more relations.  This procedure returns the field number of
      the first field within all of the viewable fields which belongs
      to the given relation number.

      CALLING SEQUENCE -

        RelationViewInfo (viewName, relNumber, firstField, totalFields)

      ENTRY -

        viewName : ARRAY OF CHAR
          The name of the view.

        relNumber : CARDINAL
          The number of the relation within the view for which field
          information is requested (set to 0 if the 'relName' is to
          be supplied instead).

        relName : ARRAY OF CHAR
          The name of the relation for which information is required.
          This is only used if 'relNumber' is set to 0 (zero).

      EXIT -

        firstField : CARDINAL
          The first field within all of the fields of the view which
          comes from the requested relation.

        totalFields : CARDINAL
          The total number of fields (numbered from the 'firstField'
          which are contained within the view and come from the
          selected relation.  (For example, if the 'firstField' were
          3 and 'totalFields' were 5, then the fields for the relation
          in the view would be field numbers 3 .. 7).

      EXAMPLE -

        MODULE InDemo17;

          -- This demo will get how many fields of a
          -- relation that are associated with a view.


        IMPORT InfoLib;


        VAR
          firstField : CARDINAL;
          totalFields : CARDINAL;


        BEGIN
          -- Assume that 'OpenSystem' has been called
          -- and that there is a View name 'SSNS' and
          -- relation name 'DEMOREL2' in the DFL.

          RelationViewInfo ("SSNS",
                            0,
                            "DEMOREL2",
                            firstField,
                            totalFields);
        END InDemo17.
  *)




  PROCEDURE GetViewRelations
             (CONST viewName  : ARRAY OF CHAR;
              CONST startRel  : CARDINAL;
              VAR   totalRels : CARDINAL;
              VAR   Rels      : ARRAY OF InfoName);

  (**
      GetViewRelations - Get relation info from a view.


      This procedure returns requested relation info from the
      selected view.

      CALLING SEQUENCE -

        GetViewRelations (viewName, startRel, totalRels, rels)

      ENTRY -

        viewName : ARRAY OF CHAR
          The name of the view.

        startRel : CARDINAL
          The number of the first relation to return;

        totalRels : CARDINAL
          The max number of relations to return in the 'rels'
          array. (1 .. n)

      EXIT -

        totalRels : CARDINAL
          The number of relations returned.

        rels : ARRAY OF InfoName
          The requested relation names from the view.

      EXAMPLE -

        SEE TotalViewRelations.
  *)




  PROCEDURE TotalViewFields
             (CONST viewName : ARRAY OF CHAR) : CARDINAL;

  (**
      TotalViewFields - The total number of fields in a view.


      This procedure returns the total number of viewable fields in
      the selected view.

      CALLING SEQUENCE -

        c := TotalViewFields (viewName);

      ENTRY -

        viewName : ARRAY OF CHAR
          The name of the view to look for fields
          (up to 8 char).

      EXIT -

        c : CARDINAL
          The total number of fields in a view.

      EXAMPLE -

        MODULE InDemo19;

          -- This demo will show how many fields
          -- are viewable from a View and then
          -- show some of the relation/field pairs.


        IMPORT Convert;
        IMPORT Display;
        IMPORT InfoLib;
        IMPORT StringsX;
        IMPORT ThorPort;


        VAR
          fields : ARRAY [0 .. 9] OF FieldID;

          tempString1 : ARRAY [0 .. 4] OF CHAR;
          tempString2 : ARRAY [0 .. 39] OF CHAR;

          totalViewFields : CARDINAL;
          fieldNum : CARDINAL;

          done : BOOLEAN;


        BEGIN
          -- Assume that 'OpenSystem' has been called
          -- and that the View name 'SSNS' is in the DFL.

          totalViewFields := TotalViewFields ("SSNS");

          NulFill (tempString1, tempString1);
          NulFill (tempString2, tempString2);

          IntToStr (totalViewFields, tempString1, 5, done);

          Concat ("Total fields viewable is ",
                  tempString1,
                  tempString2,
                  done );

          DisplayMessage (tempString2, FALSE);

          ThorPort.Pause (2000);

          IF totalViewFields > 10 THEN
            totalViewFields := 10;
          END;


          GetViewFields ("SSNS",
                         1,
                         totalViewFields,
                         fields);


          FOR fieldNum := 0 TO totalViewFields - 1 DO

            NulFill (tempString2, tempString2);

            Concat (fields[fieldNum].relName,
                    "   ",
                    tempString2,
                    done );

            Concat (tempString2,
                    fields[fieldNum].fieldName,
                    tempString2,
                    done );

            DisplayMessage (tempString2, FALSE);

            ThorPort.Pause (2000);

          END;

        END InDemo19.
  *)




  PROCEDURE GetViewFields
             (CONST viewName    : ARRAY OF CHAR;
              CONST startField  : CARDINAL;
              VAR   totalFields : CARDINAL;
              VAR   fields      : ARRAY OF FieldID);

  (**
      GetViewFields - Return the requested field identifier.


      This procedure returns the requested field identifiers
      (relation name and field name pairs) from the selected
      view.

      CALLING SEQUENCE -

        GetViewFields (viewName, startField, totalFields, fields)

      ENTRY -

        viewName : ARRAY OF CHAR
          The name of the view.

        startField : CARDINAL
          The number of the first field ID to return.

        totalFields : CARDINAL
          The max number of field ID values to return in the 'fields'
          array. (1 .. n)

      EXIT -

        totalFields : CARDINAL
          The number of field ID values returned.

        fields : ARRAY OF FieldID
          An array of the requested field data.  This data is in
          the form of paired names of 8 characters each (see
          the 'FieldID' type description at the first of this
          library) which contain the relation name/field name.

      EXAMPLE -

        SEE TotalViewFields.
  *)




  PROCEDURE FieldEmpty
             (CONST relName   : ARRAY OF CHAR;
              CONST fieldName : ARRAY OF CHAR;
              VAR   Empty     : BOOLEAN;
              VAR   Error     : CARDINAL);

  (**
      FieldEmpty - Check for an empty field.


      This routine returns TRUE if the requested field in memory is
      empty (null filled).

      CALLING SEQUENCE -

        FieldEmpty (relName, fieldName, empty, error)

      ENTRY -

        relName : ARRAY OF CHAR
          The name of the relation to get the information from.

        fieldName : ARRAY OF CHAR
          The name of the field to be used.

      EXIT -

        empty : BOOLEAN
          The field is empty (TRUE) or not.

        error : CARDINAL
          An error flag indicating the result of the operation.

      EXAMPLE -

        MODULE InDemo21;

         -- Suppose in Checklib we wanted to see if a field
         -- was blank or null filled, this demo will detect
         -- a blank field.


          IMPORT Display;
          IMPORT InfoLib;


          VAR
          empty : BOOLEAN;

          errorValue : CARDINAL;


         BEGIN
           -- Assume that 'OpenSystem' has been called and
           -- there is a relation 'DEMOREL2' with a field
           -- 'PSSN' in the DFL.  Also assume that we are in
           -- Checklib after a form has been displayed and the
           -- field 'PSSN' was defined as the current field.

           FieldEmpty ("DEMOREL2",
                       "PSSN",
                       empty,
                       errorValue);

           IF empty THEN
             DisplayMessage ("Fill out information.", TRUE);
           END;

           -- continue on with other Checklib items.
         END InDemo21.
  *)




  PROCEDURE FieldBlank
             (CONST relName   : ARRAY OF CHAR;
              CONST fieldName : ARRAY OF CHAR;
              VAR   Blank     : BOOLEAN;
              VAR   Error     : CARDINAL);

  (**
      FieldBlank - Check for an empty or blank field.


      This routine returns TRUE if the requested field in memory is
      blank signified by all nulls and/or blanks.

      CALLING SEQUENCE -

        FieldBlank (relName, fieldName, blank, error)

      ENTRY -

        relName : ARRAY OF CHAR
          The name of the relation to get the information from.

        fieldName : ARRAY OF CHAR
          The name of the field to be used.

      EXIT -

        blank : BOOLEAN
          The field is blank (TRUE) or not.

        error : CARDINAL
          An error flag indicating the result of the operation.

      EXAMPLE -

        MODULE InDemo22;

          -- Suppose in Checklib we wanted to see if a field
          -- was blank or not, this demo will detect a blank
          -- field.


        IMPORT Display;
        IMPORT InfoLib;


        VAR
          blank : BOOLEAN;

          errorValue : CARDINAL;

        BEGIN
          -- Assume that 'OpenSystem' has been called and
          -- there is a relation 'DEMOREL2' with a field
          -- 'PSSN' in the DFL.  Also assume that we are in
          -- Checklib after a form has been displayed and the
          -- field 'PSSN' was defined as the current field.

         FieldBlank ("DEMOREL2",
                       "PSSN",
                       blank,
                       errorValue);

          IF blank THEN
            DisplayMessage ("Fill out information.", TRUE);
          END;

          -- continue on with other Checklib items.
        END InDemo22.
  *)




  PROCEDURE CharacterIsValid
             (CONST RelationName : ARRAY OF CHAR;
              CONST fieldName    : ARRAY OF CHAR;
              VAR   TheChar      : CHAR;
              CONST charOffset   : CARDINAL;
              VAR   valid        : BOOLEAN);

  (**
      CharacterIsValid - Check validity of character in field.


      This procedure checks the validity of a given character against
      a field at a specified position.

      CALLING SEQUENCE -

        CharacterIsValid (relationName, fieldName,
                          c, charOffset, Valid)

      ENTRY -

        relationName : ARRAY OF CHAR
          Name of relation.

        fieldName : ARRAY OF CHAR
          Name of field within 'relationName'.

        c : CHAR
          Character to check.

        charOffset : CARDINAL
          Positon of character within the field (0 .. n).

      EXIT -

        Valid : BOOLEAN
          TRUE = valid.
  *)




  PROCEDURE ValidateField
             (CONST RelationName : ARRAY OF CHAR;
              CONST fieldName    : ARRAY OF CHAR;
              CONST Value        : ARRAY OF CHAR;
              VAR   Error        : CARDINAL);

  (**
      ValidateField - Check validity of Field in record.


      This procedure checks the validity of a given Field in the record.
      This procedure is NOT TO BE USED FOR CONCATENATED FIELDS, and such
      fields.

      CALLING SEQUENCE -

        ValidateField (relationName, fieldName, value, error)

      ENTRY -

        relationName : ARRAY OF CHAR
          Name of relation.

        fieldName : ARRAY OF CHAR
          Name of field within 'relationName'.

        value : ARRAY OF CHAR
          Field value to check.

      EXIT -

        error : CARDINAL
          Error status return (0=ok).
  *)




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