Distributed Systems Network Management (DSNM) Subsystem Interface Development Guide
Sample I Process Program Code
Distributed Systems Network Management (DSNM) Subsystem Interface Development 
Guide—109759 D-19
Sample User-Written Code for SPIFFY Subsystem
Interface Process
 ! Return SPIFFY type code for type name
 INT SUBPROC typecode (tname);
 STRING .EXT tname;
 BEGIN;
 IF tname = "REACTOR " THEN RETURN reactor
 ELSE IF tname = "BOILER " THEN RETURN boiler
 ELSE IF tname = "VALVE " THEN RETURN valve
 ELSE IF tname = "CHAMBER " THEN RETURN chamber
 ELSE IF tname = "ASSEMBLY" THEN RETURN assembly
 ELSE IF tname = "COGWHEEL" THEN RETURN cogwheel
 ELSE IF tname = "GEAR " THEN RETURN gear
 ELSE RETURN other;
 END;
 ! Boolean, true if type has subordinates
 INT SUBPROC has^subordinates (type);
 INT type;
 BEGIN
 CASE type OF 
 BEGIN
 reactor, assembly, other, anything -> RETURN 1;
 OTHERWISE -> RETURN 0;
 END;
 END;
------------ Procedure Body ----------------------
 ! First analyze the command modifiers and the action code to
 ! set command flags that will determine the major paths through
 ! the thread procedure states.
 CASE _THREAD^STATE OF BEGIN
 _ST^INITIAL ->
 ! Flags for modifiers
 cx.hmodf := hmodflags (cx._INPUT.MOD.Z^HMOD);
 smodf := smodflags (cx._INPUT.MOD.Z^SMOD);
 emodf := emodflags (cx._INPUT.MOD.Z^EMOD);
 rmodf := rmodflags (cx._INPUT.MOD.Z^RMOD);
 amodf := amodflags (cx._INPUT.MOD.Z^AMOD);
 ! Set command flags by action
 CASE cx._INPUT.ACTION OF BEGIN
 ZDSN^ACTION^STATUS ->
 cx.cf := rmodf + emodf + smodf + c^info + c^replystate;
 ZDSN^ACTION^INFO ->
 cx.cf := rmodf + emodf + c^info;
 ZDSN^ACTION^STATISTICS ->
 cx.cf := rmodf + emodf + amodf + c^info;
 ZDSN^ACTION^START, ZDSN^ACTION^STOP, ZDSN^ACTION^ABORT ->
 cx.cf := emodf + smodf;
 ZDSN^ACTION^AGGREGATE ->
 cx.hmodf := hmodflags(0);
 cx.cf := smodflags(0) + emodflags(0) + cx.hmodf + c^info;
 OTHERWISE ->
 RETURN _RC^ABORT (ZDSN^ERR^CMD^NOT^SUPP);
 END;
 _TURNON (cx.cf, c^fromcmd); ! Everything comes from the command 
 ! at first
 ! Having analyzed the command and modifiers, process command
 ! objects one at a time.
 ! Redispatch this thread procedure in the new^object state to get
 ! first command object for processing.
 _DISPATCH^THREAD (, st^new^object, _EV^CONTINUE);










