{The following routine is an addition to the original FLDINPUT.PAS file
 submitted earlier.  Once again, this a data-entry type function de-
 signed to help in the creation of data-entry routines. This procedure
 will do range checking on numeric entries.

 New variables to be declared here are:
     LowEnd  :  Real;    (Lower limit in a range - for range checking)
     HighEnd :  Real;    (Upper limit in a range)
     Value   :  Real;    (Converted value of 'FIELD' entered)
     RangeOK : Boolean;  (Passed Range Check? (True or False))

 Prior to calling this routines, you will need to set values for LowEnd
 and HighEnd, to establish the valid range for checking.

 A complete sample using functions from FLDINPUT.PAS and RANGECHK.PAS
 is included in the file ENTSAMPL.PAS.

  Ken McClure
  75156,2641
}

procedure RangeCheck;

begin
  Result := 0;                     {initialize error code}
  StripBlanks;                     {from FLDINPUT.PAS - pull out blanks}
  Val(Field,Value,Result);         {convert Field to a Number}
  If Result <> 0 then begin        {look for non-numeric characters}
    Result := 0;                   {reset result code}
    RangeOK := False;
    Write(Chr(7);
    GoToXY(1,23); ClrEol;
    WriteLn('Input must be numeric.              ');
    Write('Press any key to continue...        ');
    Read(Kbd,Ch);
    GoToXY(1,23); ClrEol;
    GoToXY(1,24); ClrEol;
  end
  else begin
    If (Value < LowEnd) or (Value > HighEnd) then begin
      Write(Chr(7);                 {see if value entered is within range}
      RangeOK := False;
      GoToXY(1,23); ClrEol;
      WriteLn('Value not in allowable range.       ');
      Write('Press any key to continue...        ');
      Read(Kbd,Ch);
      GoToXY(1,23); ClrEol;
      GoToXY(1,24); ClrEol;
    end
    else begin
      RangeOK := True;
    end;             {checking range}
  end;               {checking result code}
end;                 {of RangeCheck}

