program DB_Xpl03;
uses
   CRT,
   DOS,
   GS_KeyI,
   GS_dBFld,
   GS_dBase;
var
   Health  : GS_dBFld_Objt;

procedure DisplayRecord;
begin
   Health.FieldDisplay('FOOD','Name of Food: ',1,1);
   Health.FieldDisplay('QUANTITY','Quantity: ',1,2);
   Health.FieldDisplay('UNITTYPE','Type of Unit: ',1,3);
   Health.FieldDisplay('CALS','Calories: ',1,4);
   Health.FieldDisplay('TOT_FAT_G','Total Fat: ',1,5);
   Health.FieldDisplay('SAT_FAT_G','Saturated Fat: ',1,6);
   Health.FieldDisplay('CHOLES_MG','Cholesterol per Mg: ',1,7);
   Health.FieldDisplay('COMMENTS','Comments: ',1,8);
end;

begin
   ClrScr;
   GotoXY(1,10);
   write('Press ESC to stop, any other key to continue');
   Health.Init('HEALTH');
   Health.Open;
   Health.Index('FOODNAME');
   Health.GetRec(Top_Record);
   while not Health.File_EOF do
   begin
      DisplayRecord;
      WaitForKey;
      if GS_KeyI_Chr = Kbd_Esc then halt;
      Health.GetRec(Next_Record);
   end;
   Health.Close;
end.
