Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XWBBRK2

XWBBRK2.m

Go to the documentation of this file.
  1. XWBBRK2 ;ISC-SF/EG - DHCP BROKER PROTOYPE - [ 04/02/2003 8:48 AM ]
  1. ;;1.1;RPC BROKER;**5,1001,1018**;JUN 7, 2013;Build 7
  1. CAPI(XWBY,TAG,NAM,PAR) ;make API call
  1. N R,T,DX,DY
  1. IF XWB(1,"FLAG")=2 D
  1. . S PAR=$P(PAR,XWB("FRM"))_XWB("TO")_$P(PAR,XWB("FRM"),2)
  1. S R=$S(PAR'=+PAR&(PAR=""):TAG_"^"_NAM_"(.XWBY)",1:TAG_"^"_NAM_"(.XWBY,"_PAR_")")
  1. D:$D(XRTL) T0^%ZOSV ;start RTL
  1. U XWBNULL
  1. ;
  1. ;start RUM for RPC
  1. I $G(XWB(2,"CAPI"))]"" D LOGRSRC^%ZOSV(XWB(2,"CAPI"),2,1)
  1. ;
  1. D @R
  1. ;
  1. N X,STS S X="BUSARPC",STS="" X ^%ZOSF("TEST") S:$T STS=$$XWB^BUSARPC(.XWB) K X,STS ;IHS/OIT/FBD - 4/17/2013 - BXWB*1.1 / XWB*1.1*1018 - ADDED LINE - ENABLE BUSA AUDITING (MU2 REQUIREMENT)
  1. ;
  1. ;restart RUM for handler
  1. D LOGRSRC^%ZOSV("$BROKER HANDLER$",2,1)
  1. ;
  1. S:$D(XRT0) XRTN=XWB(2,"NAME") D:$D(XRT0) T1^%ZOSV ;stop RTL
  1. ;once call is completed, write buffer should be empty, make it so!
  1. U XWBNULL S DX=0,DY=0 X ^%ZOSF("XY")
  1. U XWBTDEV
  1. Q
  1. ;
  1. BHDR(WKID,WINH,PRCH,WISH) ;Build a protocol header
  1. N S,L
  1. S S=""
  1. S S=WKID_";"_WINH_";"_PRCH_";"_WISH_";"
  1. S L=$L(S)
  1. S S=$E("000"_L,$L(L)+1,$L(L)+3)_S
  1. Q S
  1. ;
  1. BARY(A,R,V) ;add array elements+values to storage array
  1. IF A'["XWBS" Q "-1^ARRAY NAME MUST BE XWBS"
  1. S @A@(R)=V
  1. Q 0
  1. ;
  1. BLDB(P) ;Build formatted string
  1. N L
  1. S L=$L(P)
  1. Q $E("000"_L,$L(L)+1,$L(L)+3)_P
  1. ;
  1. BLDA(N,P) ;Build API string
  1. ;M Extrinsic Function
  1. ;Inputs
  1. ;N API name
  1. ;P Comma delimited parameter string
  1. ;Outputs
  1. ;String API string if successful, "-1^Text" if error
  1. ;
  1. N I,F,L,T,U,T1,T2
  1. IF '+$D(N) Q "-1^Required input reference is NULL"
  1. S U="^"
  1. S (F,T,Y)=0
  1. IF '$D(P) S P=""
  1. IF P'="" D
  1. . S L=$L(P)-$L($TR(P,$C(44)))+1
  1. . IF L=0 S L=1
  1. . F I=1:1:L D Q:T
  1. . . S T1=$P(P,",",I)
  1. . . S T2=$E(T1,1,1)="."
  1. . . IF T1=+T1 Q
  1. . . IF $E(T1,1,1)="^" S F=2,T=1 Q
  1. . . ;IF $E(T1,1,5)="$NA(^" S F=2,T=1 Q
  1. . . IF T2&($E(T1,2,$L(T1))?.ANP) S F=1,T=1 Q
  1. ;IF P?.ANP1"."1A.ANP S F=1
  1. S P=$$BLDB(P)
  1. S L=$L(P)+$L(P)-3
  1. S P=F_N_U_P
  1. S L=$L(P)
  1. Q $E("000"_L,$L(L)+1,$L(L)+3)_P
  1. ;
  1. BLDS(R) ;Build a parameter string from an array
  1. N L,T,Y
  1. S Y=""
  1. F D Q:R=""
  1. . S R=$Q(@R)
  1. . IF R="" Q
  1. . S L=$L(R)+$L(@R)+1
  1. . S T=@R
  1. . S T=$TR(T,$C(44),$C(23))
  1. . S Y=Y_$E("000"_L,$L(L)+1,$L(L)+3)_R_"="_T
  1. Q Y_"000"
  1. ;
  1. BLDU(R) ;Build a parameter string from a scalar
  1. N DONE,L,N,N1,P1
  1. IF R=+R Q R
  1. S N=$F(R,$C(34))
  1. IF N=0 Q $C(34)_R_$C(34)
  1. S P1=$E(R,1,N-2)
  1. S (L,DONE)=0
  1. F D Q:DONE
  1. . S N1=$F(R,$C(34),N)
  1. . IF N1=0 S L=$L(R)+2,N1=L
  1. . S P1=P1_$C(34,34)_$E(R,N,N1-2)
  1. . IF N1=L S DONE=1,P1=$C(34)_P1_$C(34) Q
  1. . S N=N1
  1. Q $TR(P1,$C(44),$C(23))
  1. ;
  1. BLDG(R) ;build a parameter string from a global reference
  1. N I,L,L1,M,T,T1,T2,Y
  1. K ^TMP("XWB",$J)
  1. IF '$D(R) Q "-1^Reference does not exist"
  1. S Y=$NA(^TMP("XWB",$J,$P($H,",",2)))
  1. S I=0
  1. S M=512
  1. S T1=$P(R,")")
  1. S L1=$L($P(R,"("))
  1. F D Q:R=""
  1. . S R=$Q(@R)
  1. . S T2=$F(R,"(")
  1. . IF R=""!(R'[T1) Q
  1. . S L=$L(R)+$L(@R)-L1
  1. . S T=@R
  1. . S T=$TR(T,$C(44),$C(23))
  1. . S @Y@(I)=$E("000"_L,$L(L)+1,$L(L)+3)_"^("_$E(R,T2,M)_"="_$$BLDU(T)
  1. . S I=I+1
  1. S @Y@(I)="000"
  1. S Y=$TR(Y,$C(44),$C(23))
  1. Q Y
  1. ;
  1. OARY() ;create storage array
  1. N A,DONE,I
  1. S (DONE,I)=0
  1. F I=1:1 D Q:DONE
  1. . S A="XWBS"_I
  1. . K @A ;temp fix for single array
  1. . IF '$D(@A) S DONE=1
  1. ;S Y("XWBS")=A
  1. S @A="" ;set naked
  1. Q A
  1. ;
  1. CREF(R,P) ;Convert array contained in P to reference A
  1. N I,X,DONE,F1,S
  1. S DONE=0
  1. S S=""
  1. F I=1:1 D Q:DONE
  1. . IF $P(P,",",I)="" S DONE=1 Q
  1. . S X(I)=$P(P,",",I)
  1. . IF X(I)?1"."1A.E D
  1. . . S F1=$F(X(I),".")
  1. . . S X(I)="."_R
  1. . S S=S_X(I)_","
  1. Q $E(S,1,$L(S)-1)
  1. ;
  1. GETP(P) ;returns various parameters out of the Protocol string
  1. N M,T,XWB
  1. S M=512
  1. S T=$$PRSP^XWBBRK(P)
  1. IF '+T D
  1. . S T=$$PRSM^XWBBRK(XWB(0,"MESG"))
  1. . IF '+T S T=XWB(0,"WKID")_";"_XWB(0,"WINH")_";"_XWB(0,"PRCH")_";"_XWB(0,"WISH")_";"_$P(XWB(1,"TEXT"),"^")
  1. Q T
  1. ;
  1. CALLM(X,P,DEBUG) ;make call using Message string
  1. N ERR,S
  1. S X="",ERR=0
  1. S ERR=$$PRSM^XWBBRK(P)
  1. IF '+ERR S ERR=$$PRSA^XWBBRK(XWB(1,"TEXT"))
  1. IF '+ERR S S=$$PRSB^XWBBRK(XWB(2,"PARM"))
  1. IF (+S=0)!(+S>0) D
  1. . D CAPI(.X,XWB(2,"RTAG"),XWB(2,"RNAM"),S)
  1. IF 'DEBUG K XWB
  1. K @(X("XWBS")),X("XWBS")
  1. Q
  1. ;
  1. CALLA(X,P,DEBUG) ;make call using API string
  1. N ERR,S
  1. S X="",ERR=0
  1. S ERR=$$PRSA^XWBBRK(P)
  1. IF '+ERR S S=$$PRSB^XWBBRK(XWB(2,"PARM"))
  1. IF (+S=0)!(+S>0) D
  1. . D CAPI(.X,XWB(2,"RTAG"),XWB(2,"RNAM"),S)
  1. IF 'DEBUG K XWB
  1. K @(X("XWBS")),X("XWBS")
  1. Q
  1. ;
  1. TRANSPRT() ;Determine the Transport Method
  1. ;DDP is local :=0
  1. ;TCP/IP is remote :=1
  1. ;Serial/RS-232 is remote :=2
  1. Q 1
  1. ;Q 0 ;Do DDP for Now