Distributed Systems Network Management (DSNM) Subsystem Interface Development Guide

Sample User-Written Code for SPIFFY Subsystem
Interface Process
D-16
109759Distributed Systems Network Management (DSNM) Subsystem Interface
Development Guide
Sample I Process Program Code
---------------------------------------------------------------------
---------------------------------------------------------------------
-------------- Command Thread Auxiliary Procs -----------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
INT PROC append^numeric^resulttext (frameobj^arg,num);
INT(32) num;
INT .EXT frameobj^arg;
BEGIN
! Use DNUMOUT for conversions because it returns the length of
! the converted field (and accepts an extended string pointer
! besides). Return ZDSN^ERR if error occurs, probably memory.
INT .EXT frameobj (frame^output^lm^def) = frameobj^arg;
INT len, error := 0;
STRING text[0:23];
IF (len := DNUMOUT (text, num, 10)) THEN
error := _APPEND^OUTPUT (frameobj, ZDSN^VTY^RESULTTEXT,,,text, len);
RETURN error;
END;
_RC^TYPE PROC format^error^object (obj^arg);
INT .EXT obj^arg;
BEGIN
! Generate an error output object for an input object in error.
! Er:
! < 0 - ZDSN^ERR number; caller must append resulttext if any
! > 0 - File system error. Generate ZDSN^ERR^FS^ERR and put
! file system err into resulttext. Its object is the manager,
! which is already in the response object.
! = 0 - Shouldn't occur, but treat as ZDSN^ERR^NOERR
! If spifer is present with ZDSN^ERR^SUBSYSTEM^ERR then put it
! into result text; otherwise ignore it.
INT .EXT cx (cx^def) = _THREAD^CONTEXT^ADDRESS;
INT .EXT inobj (object^lm^def) = obj^arg;
INT .EXT frameobj (frame^output^lm^def);
INT er;
IF _ON (inobj.cf, c^errsuppress) THEN
RETURN _RC^NULL;
IF _ISNULL(@frameobj := _PUT^LM(cx._OUTPUT.OBJECTLIST,,$LEN(frameobj)))
THEN RETURN _RC^ABORT (ZDSN^ERR^MEMORY);
IF er := _FOBJECT^INIT (frameobj.FOBJ, inobj.FOBJ) THEN
RETURN _RC^ABORT (er);
IF (frameobj.FOBJ.Z^RESULT := inobj.er) <= 0 THEN
BEGIN
IF inobj.er = ZDSN^ERR^SUBSYSTEM^ERR
AND (er := append^numeric^resulttext (frameobj,
$DBL (inobj.spifer)))
THEN RETURN _RC^ABORT (er);
END