program BufClose;
uses WinCrt, PXEngine;

const TableName = 'Table';

var   RecHandle: RecordHandle;
      TblHandle: TableHandle;
      PxErr: Integer;

procedure PX(Code : integer);
begin
  writeln(PXErrMsg(code));
end;

begin
  PX(PXWinInit('BufClose', pxShared));
  PX(PXTblOpen(TableName, TblHandle, 0, False));
  PX(PXRecBufOpen(TblHandle, RecHandle));

  (* Close a record buffer *)
  PxErr := PXRecBufClose(RecHandle);
  if PxErr <> PxSuccess then
   Writeln(PxErrMsg(PxErr));

  PX(PXTblClose(TblHandle));
  PX(PXExit);
end.
