BGUAPI ; IHS/OIT/MJL - Call back for API/RPC Query Utility ;
;;1.5;BGU;;MAY 26, 2005
APICALL(RESULT,BGUFILE,BGUIEN,BGUMSG,BGUPARAM) ;PEP CALL FROM REMOTE PROCEDURE BGU APICALL
; Has to return data in RESULT(n)
S BGUIEN=+BGUIEN
I BGUMSG="" S RESULT(1)=-1,RESULT(2)="No Message Sent To API Call!" Q
I '$D(^BGUMCD("C",BGUMSG)) S RESULT(1)=-1,RESULT(2)=BGUMSG_" Is Not Defined In BGU MUMPS CODE File!" Q
S BGUACT="",BGUCIEN=$O(^BGUMCD("C",BGUMSG,"")) S:BGUCIEN'="" BGUACT=$P(^BGUMCD(BGUCIEN,0),"^",4) I BGUACT'="A" S RESULT(1)=-1,RESULT(2)=BGUMSG_" Is Not Active!" Q
F S X=$P(BGUMSG,"|",2) Q:'$L(X) S X=$P(BGUMSG,"|",1)_"^"_$P(BGUMSG,"|",2,99) S BGUMSG=X
X BGUMSG
Q
RPCCALL(RESULT,BGUMSG,BGUPARAM) ;PEP CALL FROM REMOTE PROCEDURE BGU RPCCALL
I BGUMSG="" S RESULT(1)=-1,RESULT(2)="No Message Sent To RPC Call!" Q
I '$D(^BGUMCD("C",BGUMSG)) S RESULT(1)=-1,RESULT(2)=BGUMSG_" Is Not Defined In BGU MUMPS CODE File!" Q
S BGUACT="",BGUCIEN=$O(^BGUMCD("C",BGUMSG,"")) S:BGUCIEN'="" BGUACT=$P(^BGUMCD(BGUCIEN,0),"^",4) I BGUACT'="A" S RESULT(1)=-1,RESULT(2)=BGUMSG_" Is Not Active!" Q
; Has to return data in RESULT(n)
F S X=$P(BGUMSG,"|",2) Q:'$L(X) S X=$P(BGUMSG,"|",1)_"^"_$P(BGUMSG,"|",2,99) S BGUMSG=X
X BGUMSG
Q
OLD ;
S X=$P(MSG,"|",1) I $L(X) S X=$P(MSG,"|",1)_"^"_$P(MSG,"|",2,99) S MSG=X
X MSG
; Has to return data in RESULT(n)
Q
;
BGUAPI ; IHS/OIT/MJL - Call back for API/RPC Query Utility ;
+1 ;;1.5;BGU;;MAY 26, 2005
APICALL(RESULT,BGUFILE,BGUIEN,BGUMSG,BGUPARAM) ;PEP CALL FROM REMOTE PROCEDURE BGU APICALL
+1 ; Has to return data in RESULT(n)
+2 SET BGUIEN=+BGUIEN
+3 IF BGUMSG=""
SET RESULT(1)=-1
SET RESULT(2)="No Message Sent To API Call!"
QUIT
+4 IF '$DATA(^BGUMCD("C",BGUMSG))
SET RESULT(1)=-1
SET RESULT(2)=BGUMSG_" Is Not Defined In BGU MUMPS CODE File!"
QUIT
+5 SET BGUACT=""
SET BGUCIEN=$ORDER(^BGUMCD("C",BGUMSG,""))
IF BGUCIEN'=""
SET BGUACT=$PIECE(^BGUMCD(BGUCIEN,0),"^",4)
IF BGUACT'="A"
SET RESULT(1)=-1
SET RESULT(2)=BGUMSG_" Is Not Active!"
QUIT
+6 FOR
SET X=$PIECE(BGUMSG,"|",2)
IF '$LENGTH(X)
QUIT
SET X=$PIECE(BGUMSG,"|",1)_"^"_$PIECE(BGUMSG,"|",2,99)
SET BGUMSG=X
+7 XECUTE BGUMSG
+8 QUIT
RPCCALL(RESULT,BGUMSG,BGUPARAM) ;PEP CALL FROM REMOTE PROCEDURE BGU RPCCALL
+1 IF BGUMSG=""
SET RESULT(1)=-1
SET RESULT(2)="No Message Sent To RPC Call!"
QUIT
+2 IF '$DATA(^BGUMCD("C",BGUMSG))
SET RESULT(1)=-1
SET RESULT(2)=BGUMSG_" Is Not Defined In BGU MUMPS CODE File!"
QUIT
+3 SET BGUACT=""
SET BGUCIEN=$ORDER(^BGUMCD("C",BGUMSG,""))
IF BGUCIEN'=""
SET BGUACT=$PIECE(^BGUMCD(BGUCIEN,0),"^",4)
IF BGUACT'="A"
SET RESULT(1)=-1
SET RESULT(2)=BGUMSG_" Is Not Active!"
QUIT
+4 ; Has to return data in RESULT(n)
+5 FOR
SET X=$PIECE(BGUMSG,"|",2)
IF '$LENGTH(X)
QUIT
SET X=$PIECE(BGUMSG,"|",1)_"^"_$PIECE(BGUMSG,"|",2,99)
SET BGUMSG=X
+6 XECUTE BGUMSG
+7 QUIT
OLD ;
+1 SET X=$PIECE(MSG,"|",1)
IF $LENGTH(X)
SET X=$PIECE(MSG,"|",1)_"^"_$PIECE(MSG,"|",2,99)
SET MSG=X
+2 XECUTE MSG
+3 ; Has to return data in RESULT(n)
+4 QUIT
+5 ;