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

176 AppendixB
Sample Programs
Pascal Program
{************************************************************
SendData
This procedure translates the data received from the
user's screen into EBCDIC and sends it to the remote TP.
************************************************************}
procedure SendData (ResourceID : shortint;
TransData : TransDataType;
var Quit_SW : boolean);
var
IntrinsicStatus : hpe_status;
ReqToSendRec : shortint;
begin
CTranslate (TRANSLATE_TO_EBCDIC, TransData, TransData, TRANSLENGTH);
if CCode = 1 then
begin
Quit_SW := YES_SW;
writeln (CTranslateErrMsg, 'CCL - TransData not translated.');
end
else
begin
MCSendData (ResourceID, TransData, TRANSLENGTH,
ReqToSendRec, IntrinsicStatus);
if IntrinsicStatus.all <<>> 0 then
ErrorHandler (SendDataErrMsg, IntrinsicStatus.info, Quit_SW);
end;
end;
$PAGE$
{************************************************************
QuitScreen
This procedure asks the user if he or she is ready to
quit. If the user responds 'Y', this procedure changes
Quit_SW to YES_SW.
************************************************************}
procedure QuitScreen (var Quit_SW : boolean);
begin
writeln ('Ready to quit (Y/N)?');
readln (Ready);
if Ready in YES then
Quit_SW := YES_SW;
end;
$PAGE$