OSI/MHS Management Programming Manual

Examples
OSI/MHS Management Programming Manual424824-001
C-18
SPI Example in TAL
Objname[0] );
END; -- for Objname^Index
-- Get return token.
SSErr := SSGetTkn( Spi^Buffer,
zSpi^Tkn^RetCode,
RetCode );
IF (SSErr <> zSpi^Err^OK) THEN
BEGIN
Write^Term^With^Num ( "SSGetTkn failed", SSErr );
CALL Abend;
END;
-- Get end-list token to close response record.
SSErr := SSGetTkn( Spi^Buffer,
zSpi^Tkn^EndList );
IF (SSErr <> zSpi^Err^OK) THEN
BEGIN
Write^Term^With^Num ( "SSGetTkn failed", SSErr );
CALL Abend;
END;
END; -- for DataList^Index
--
-- Replace the context token in the saved request
-- buffer, if any, with the context token from the
-- response.
--
SSErr := SSMoveTkn( zSpi^Tkn^Context,
Spi^Buffer, 1,
Spi^Buffer^Copy, 1 );
IF ( SSErr = zSpi^Err^OK ) THEN
--
-- There is a context token. Its presence
-- means there is more information to come.
-- We must resend the message to the subsystem
-- with the context token.
--
Spi^Buffer ':=' Spi^Buffer^Copy FOR
zMHS^Val^BufLen BYTES
ELSE IF ( SSErr = zSpi^Err^MisTkn ) THEN
--
-- There is no context token. We are done.
--
complete := zSpi^Val^True
ELSE
BEGIN
-- An unexpected error occurred
Write^Term^With^Num ( "Error getting context token", SSErr );
CALL Abend;
END;
END; -- while complete = zSpi^Val^False
RETURN (RetCode);
END; -- PROC GetResponse^Loop;
? PAGE "add mta #MTAX object"
-------------------------------------------------------------
--
-- ADD^MTA - Add MTA #MTAX , ..... to the
-- OSI/MHS subsystem.
--
-- GLOBALS. Spi^Buffer . Buffer used to construct
-- command to be sent
-- SSErr . Set to SPI error value