Записи для работы с комбинациями разных типов в Pascal, страница 8

   { ****************************************************

     Procedure saves current DataBase into specified File

     **************************************************** }

      Var Destination:String;

          DataBaseFile:File of tFriend;

          a:Integer;

   Begin

      Write ('Enter the DataBase File Name: ');

      ReadLn (Destination);

      {$I-}

      Assign (DataBaseFile,Destination);

      Rewrite (DataBaseFile);

      {$I+}

      If IOResult=0 Then

         Begin

         For a:=1 To RecordCount Do Write (DataBaseFile,Source[a]);

         Close (DataBaseFile);

         WriteLn;

         WriteLn ('   DataBase has been saved Successfully!');

         End

      Else

         WriteLn ('   Achtung! An Exception occured while trying to save DataBase!');

   End;

   Procedure Delete_Record (Var DataBase:tDataBase; Var RecordCount:Integer);

   { *******************************************************************

     Procedure removes Record with the specified Index from the DataBase

     ******************************************************************* }

      Var a,Index:Integer;

   Begin

      Write ('Enter the Number of the Record to delete: ');

      ReadLn (Index);

      If (Index<1) or (Index>RecordCount) Then

         WriteLn ('The specified Record does not exist.');

      Else

         Begin

         For a:=Index To RecordCount Do

            DataBase[a]:=DataBase[a+1];

         RecordCount:=RecordCount-1;

         WriteLn ('  Record has been successfuly removed!');

      End

   End;

   Procedure Search(DataBase:tDataBase;RecordCount:Integer);

   { **********************************************************

     Procedure looks for the Records with the specified Address

     ********************************************************** }

      Var a:Integer;

          Substring:String;

   Begin

      Write ('Enter the Address to search for: ');

      ReadLn (Substring);