Distributed Name Service (DNS) Management Programming Manual

DNS Programming Example, TAL
G–4 46958 Tandem Computers Incorporated
!
! Token code for ZSPI^TKN^CONTEXT
!
INT(32) context^tkn := zspi^tkn^context;
!
! Status returned from the SPI procedures.
!
INT status := 0;
!
! Procedure body; move the context token, if requested.
!
IF move^context = true THEN
IF (status := ssmove(context^tkn
, response
, 1
, request
, 1))
THEN
!
! Couldn't move it
!
RETURN dns^spierr(status);
!
! Move the request to the response buffer for WRITEREADX.
!
response ':=' request FOR dns^wordlen(request);
!
! Send to the name manager.
!
CALL writereadx(fno, response, dns^usedlen(response), zdns^val^buflen);
IF <> THEN
BEGIN
!
! Error; get file management error number.
!
CALL fileinfo(fno, status);
!
! Return I/O error.
!
RETURN dns^ioerr(status);
END;
!
! Reposition to head of response.
!
IF status := ssputtkn(response, zspi^tkn^initial^position, status) THEN
RETURN dns^spierr(status);