Expand Management Programming Manual
COMMANDS AND RESPONSES
Examples of Commands and Responses
! ***************************************************************
! * call^scp *
! ***************************************************************
INT PROC call^scp;
BEGIN
! This procedure sends a command to SCP and retrieves the
! response. The value returned by call^scp is the value of
! the return token in the response.
INT error, ! error code for WRITEREAD error
spi^err, ! returned by call to SPI procedure
return^token, ! value of return token
init^buffer,
write^count,
read^count,
count^read;
spi^err := SSGETTKN(exp^buf, zspi^tkn^usedlen, write^count);
IF spi^err THEN
CALL handle^spi^error(spi^err); ! error on the call
read^count := zexp^val^maxbuflen;
CALL WRITEREAD(scp^file^num, exp^buf, write^count, read^count,
count^read);
IF <> THEN
BEGIN ! an error occurred during WRITEREAD
CALL FILEINFO(scp^file^num, error); ! get error code
CALL DEBUG;
END;
! reset buffer length, initial position and last error
init^buffer := zexp^val^maxbuflen;
spi^err := SSPUTTKN(exp^buf, zspi^tkn^reset^buffer,
init^buffer);
IF spi^err THEN
CALL handle^spi^error(spi^err); ! error on the call
! get the value of the return token
spi^err := SSGETTKN(exp^buf, zspi^tkn^retcode, return^token);
IF spi^err THEN
CALL handle^spi^error(spi^err); ! error on the call
RETURN return^token;
END; ! of call^scp
7-127