Distributed Systems Network Management (DSNM) Subsystem Interface Development Guide

Sample I Process Program Code
Distributed Systems Network Management (DSNM) Subsystem Interface Development
Guide109759 D-25
Sample User-Written Code for SPIFFY Subsystem
Interface Process
CASE _THREAD^STATE OF BEGIN
st^new^object ->
IF _ISNULL (@inobj := @cx.currentobj := _GET^LM (cx.current^in))THEN
BEGIN
! Out of input objects; restore caller and continue.
! Note: Calling proc has set the state in which it
! desires to return before saving the thread state
! and dispatching this proc.
_RESTORE^THREAD^AND^DISPATCH (_EV^CONTINUE);
! If _restore^thread fails, we fall through to here and ...
RETURN _RC^ABORT (ZDSN^ERR^NOTPUSHED);
END;
! If we already know things about the input object, it's been
! asked about earlier (probably from a * object). If c^cmdobj
! is off, we don't want to know things about it unless it's *.
! Either way, skip issuing a command for it and proceed
! directly to subordinate processing, if any.
IF _ON (inobj.cf, c^things) OR _ALLOFF (inobj.cf, c^cmdobj +
c^starobj)
THEN
BEGIN
IF _ON (inobj.cf, c^cmdobj)
AND (rc := normal^object (inobj.thing)) <> _RC^NULL
THEN RETURN rc;
_DISPATCH^THREAD (, st^exec^done, _EV^CONTINUE);
END;
! Note: Star objects. A star object is replaced on the input
! list for this procedure (cx.current^in) by the things to
! which it expands. This is done without regard for modifiers
! (hmod, smod), which must be applied to the resulting objects
! rather than *. Fortunately, * can only come from the
! _COMMAND^PROC rather than from a later iteration of this one
! (that is to say, this proc never produces a * object in its
! output list). _COMMAND^PROC hands out objects one at a
! time, so * always appears alone on this proc's input.
! Therefore after processing a *, we put the output back onto
! the (now empty) input and iterate this procedure again, this
! time paying attention to the modifiers.
cx.cmd.cmd := tellabout;
cx.cmd.response^context := 0;
cx.cmd.type := inobj.thing.type;
cx.cmd.name ':=' inobj.FOBJ.Z^OBJNAME FOR spiffy^name^len BYTES;
cx.cmd.pop^name ':=' starname;
IF (er := _SEND^CI (cx.spif, cx.cmd, $LEN (cx.cmd),$LEN (cx.r))) THEN
RETURN error^object (er);
_THREAD^STATE := st^exec;
RETURN _RC^WAIT; ! We'll get _EV^IODONE when I/O completes
st^exec -> ! _EV^IODONE dispatched us
@inobj := @cx.currentobj;
IF _CI^LASTERROR (cx.spif) THEN
RETURN error^object (_CI^LASTERROR (cx.spif));
IF cx.r.error THEN
RETURN error^object (ZDSN^ERR^SUBSYSTEM^ERR, cx.r.error);