OSI/TS Configuration and Management Manual

Programming Examples
OSI/TS Configuration and Management Manual424831-001
C-3
TAL Example File-Transfer Program, Requester
CALL close(rcv^num);
END;
?page
! ******************************************************
! *
! * Main program for the TSP requester
! *
! ******************************************************
PROC m MAIN;
BEGIN
!
! *** Open $RECEIVE, read in the startup message and close
! *** $RECEIVE
call startup;
!
! *** Reset the MCW to the normal data transfer mode
buffer[0] := 0;
!
! *** Expand the TSP requester SU name
call fnameexpand(ext^dev^send,osi^dev^send,default^subvol);
!
! *** Expand the source file name
call
fnameexpand(srcex^file^name,source^file^name,default^subvol);
!
! *** Open the TSP requester SU
call open (osi^dev^send,osnum);
!
! *** Send a transport connection request to the responder
call control(osnum,17);
!
! *** Open the unstructued source file
call open(source^file^name,snum);
!
! *** Send data to the responder until the EOT is
! *** encountered
count^read := rec^len^send;
buffer.<15> := 1; !assume more data
While count^read = rec^len^send DO
begin
call read (snum,buffer[1],rec^len^send,count^read);
!
! *** Is the EOT encountered ?
if count^read < rec^len^send then buffer.<15> := 0;
call write (osnum,buffer,count^read + 2);
end;
!
! *** Close the source file
call close (snum);
!
! *** Release the TSP connection
call control (osnum,12);
!