LU 6.2 API Application Programmer's Reference Guide (30294-90008)

180 AppendixB
Sample Programs
Pascal Program
{************************************************************
EndHousekeeping
This procedure deallocates the conversation and calls
TPEnded to free the resources used by the local TP.
************************************************************}
procedure EndHousekeeping (ResourceID, TPID : shortint);
var
IntrinsicStatus : hpe_status;
begin
MCDeallocate (ResourceID, DeallocateType, IntrinsicStatus);
if IntrinsicStatus.all <<>> 0 then
ErrorHandler (DeallocateErrMsg, IntrinsicStatus.info, Quit_SW)
else
begin
TPEnded (TPID, IntrinsicStatus);
if IntrinsicStatus.all <<>> 0 then
ErrorHandler (EndedErrMsg, IntrinsicStatus.info, Quit_SW)
end;
end;
$PAGE$
{************************************************************
Main Program
************************************************************}
begin
LocalTPName := 'USERTP ';
RemoteTPNameASCII := 'Z027';
Traceon := ON;
SessionType := 'APISESS ';
DeallocateType := CONVSYNCLEVEL;
BeginHousekeeping (LocalTPName, RemoteTPNameASCII, SessionType,
TPID, ResourceID, Traceon, Quit_SW);
While not Quit_SW do
ProcessRecords (ResourceID, Quit_SW);
EndHousekeeping (ResourceID, TPID, DeallocateType);
end.