PAM Programming Manual
Link-Level Programming Examples
PAM Programming Manual—142482
B-11
Testing the L2S Interface
 [”SetMode failed - Error: “];
 CALL NumOut ( report^buf^ptr[21], file^error, 10, 4 );
 CALL Write^Report^Buf^and^AbEnd;
 END;
END;
--/---------------- End of Open_ procedure -----------------------/
--/---------------------------------------------------------------/
-- PROC: Close^
--/---------------------------------------------------------------/
PROC Close^;
BEGIN
 INT file^error;
 CALL Close ( L2SAP^file^num );
 IF <> THEN
 BEGIN
 CALL FileInfo ( L2SAP^file^num, file^error );
 CALL Clear^Report^Buffer; report^buf^ptr ’:=’
 [”Close failed - Error: “];
 CALL NumOut ( report^buf^ptr[21], file^error, 10, 4 );
 CALL Write^Report^Buf^and^AbEnd;
 END;
END;
--/---------------- End of Close_ procedure ----------------------/
Testing the L2S Interface
The following program tests all of the preceding code. The application program 
establishes a working connection between itself and the L2S interface by opening the 
PORT that connects the host system to the target LAN through PAM.
--/---------------------------------------------------------------/
-- PROC: Test ( Main )
--/---------------------------------------------------------------/
PROC Test MAIN;
BEGIN
 INT pending^req^cnt := 0;
 INT Aggr^SDUs^left;
 INT(32) buffer^lst^ndx;
 INT file^error;
 INT SDU^ndx;
 CALL Initialize;
?IF 1
 CALL Delay ( 200D );
?ENDIF 1
 CALL Timestamp ( start^time );
 CALL Open^;
 WHILE loop^cnt
 DO
 BEGIN
 current^user^data^size^b := begin^user^data^size^b;
 Aggr^SDUs^left :=
 ( end^user^data^size^B - begin^user^data^size^B + 1 );
 DO
 BEGIN










