MGIRPC Q INIT(I,O,NLDLM) S $ZT="D TRAP^MGIRPC($ZPOS)" Q SETPARAM(KEY,VAL) S ^TMP($J,KEY)=VAL Q TRAP(POS) S $ZT="",^TMP($J,"ERROR")=POS Q WL(LINE) D W(LINE_$C(13,10)) Q W(STR) N LNO S LNO=$G(^TMP($J,"RESP","DATA"),0) S ^TMP($J,"RESP","DATA",LNO)=STR,^TMP($J,"RESP","DATA")=LNO+1 Q SETHDR(K,V) S ^TMP($J,"RESP","HDR",K)=V Q GETHDR(K) Q $G(^TMP($J,"RESP","HDR",K)) PROCESS(REQ) D SETHDR("X-SomeHeader","blabla") D SETHDR("content-type","text/html") D SETHDR("lala_something","lala") ;N RES S R=$$^MRPC155(.RES,1,"SELECT * FROM SCAU") ;D W(RES) ; $L is more than record size D WL("") D WL("Timestamp: "_$$MKTIMESTAMP^CMNUTL()) D WL("Database structure:") S T="",X="" F S T=$O(^DBTBL("SYSDEV",1,T)) Q:T="" D . D WL(""),WL(" *** "_T_": "_^DBTBL("SYSDEV",1,T)) . F S X=$O(^DBTBL("SYSDEV",1,T,9,X)) Q:X="" D . . D WL($J(X,15)_" -> "_$P(^(X),"|",10)) D WL("") Q RESPORDER(I,R) S I=+I+1 S:'$D(^TMP($J,"RESP","DATA",I)) I=-1 S R=$G(^TMP($J,"RESP","DATA",I-1)) Q HDRORDER(K) Q $O(^TMP($J,"RESP","HDR",K)) REQCLNUP K ^TMP($J) Q FINALIZE K ^TMP($J) Q ERROR(ERR) S ERR=$G(^TMP($J,"ERROR")) K ^TMP($J,"ERROR")