BSDX23 ; IHS/OIT/HMW/MSC/SAT - WINDOWS SCHEDULING RPCS ;
;;3.0;IHS WINDOWS SCHEDULING;;DEC 09, 2010
;
;
EVENT(BSDXEVENT,BSDXPARAM,BSDXSIP,BSDXSPT) ;EP
;Raise event to interested clients
;Clients are listed in ^BSDXTMP("EVENT",EVENT_NAME,IP,PORT)
;BSDXSIP and BSDXSPT represent the sender's IP and PORT.
;The event will not be raised back to the sender if these are non-null
;
Q:'$D(^BSDXTMP("EVENT",BSDXEVENT))
S BSDXIP=0 F S BSDXIP=$O(^BSDXTMP("EVENT",BSDXEVENT,BSDXIP)) Q:BSDXIP="" D
. S BSDXPORT=0 F S BSDXPORT=$O(^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT)) Q:'+BSDXPORT D
. . I BSDXIP=BSDXSIP Q ;,BSDXPORT=BSDXSPT Q
. . D CALL^%ZISTCP(BSDXIP,BSDXPORT,5)
. . I POP K ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT) Q
. . ;U IO R X#3:5
. . I X'="ACK" K ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT) Q
. . S BSDXPARAM=$S(BSDXPARAM="":"",1:U_BSDXPARAM)
. . U IO W BSDXEVENT,BSDXPARAM,!
. . D ^%ZISC
. . Q
. Q
Q
;
EVERR(BSDXEVENT,BSDXIP,BSDXPORT) ;
;
Q:$G(BSDXEVENT)=""
Q:$G(BSDXIP)=""
Q:$G(BSDXIP)=""
K ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT)
Q
;
REGET ;EP
;Error trap from REGEVNT
;
I '$D(BSDXI) N BSDXI S BSDXI=999
S BSDXI=BSDXI+1
D REGERR(BSDXI,99)
Q
;
REGERR(BSDXI,BSDXERID) ;Error processing
S BSDXI=BSDXI+1
S ^BSDXTMP($J,BSDXI)=BSDXERID_$C(30)
S BSDXI=BSDXI+1
S ^BSDXTMP($J,BSDXI)=$C(31)
Q
;
;
REGEVNT(BSDXY,BSDXEVENT,BSDXIP,BSDXPORT) ;EP
;RPC Called by client to inform RPMS server of client's interest in BSDXEVENT
;Returns RECORDSET with field ERRORID.
;If everything ok then ERRORID = 0;
;
N BSDXI
S BSDXI=0
S X="REGET^BSDX23",@^%ZOSF("TRAP")
S BSDXY="^BSDXTMP("_$J_")"
S ^BSDXTMP($J,0)="I00020ERRORID"_$C(30)
I '+BSDXPORT D REGERR(BSDXI,1) Q
I BSDXIP="" D REGERR(BSDXI,2) Q
S ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT)=""
;
S BSDXI=BSDXI+1
S ^BSDXTMP($J,BSDXI)="0"_$C(30)_$C(31)
Q
;
UNREG(BSDXY,BSDXEVENT,BSDXIP,BSDXPORT) ;EP
;RPC Called by client to Unregister client's interest in BSDXEVENT
;Returns RECORDSET with field ERRORID.
;If everything ok then ERRORID = 0;
;
N BSDXI
S BSDXI=0
S X="REGET^BSDX23",@^%ZOSF("TRAP")
S BSDXY="^BSDXTMP("_$J_")"
S ^BSDXTMP($J,0)="I00020ERRORID"_$C(30)
I '+BSDXPORT D REGERR(BSDXI,1) Q
I BSDXIP="" D REGERR(BSDXI,2) Q
K ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT)
;
S BSDXI=BSDXI+1
S ^BSDXTMP($J,BSDXI)="0"_$C(30)_$C(31)
Q
;
RAISEVNT(BSDXY,BSDXEVENT,BSDXPARAM,BSDXSIP,BSDXSPT) ;EP
;RPC Called to raise event BSDXEVENT with parameter BSDXPARAM
;BSDXSIP and BSDXSPT represent the sender's IP and PORT.
;If not null, these will prevent the event from being raised back
;to the sender.
;Returns a RECORDSET wit the field ERRORID.
;If everything ok then ERRORID = 0;
;
N BSDXI
S BSDXI=0
S BSDXY="^BSDXTMP("_$J_")"
S ^BSDXTMP($J,0)="I00020ERRORID"_$C(30)
S X="REGET^BSDX23",@^%ZOSF("TRAP")
;
D EVENT(BSDXEVENT,BSDXPARAM,BSDXSIP,BSDXSPT)
;
S BSDXI=BSDXI+1
S ^BSDXTMP($J,BSDXI)="0"_$C(30)_$C(31)
Q
BSDX23 ; IHS/OIT/HMW/MSC/SAT - WINDOWS SCHEDULING RPCS ;
+1 ;;3.0;IHS WINDOWS SCHEDULING;;DEC 09, 2010
+2 ;
+3 ;
EVENT(BSDXEVENT,BSDXPARAM,BSDXSIP,BSDXSPT) ;EP
+1 ;Raise event to interested clients
+2 ;Clients are listed in ^BSDXTMP("EVENT",EVENT_NAME,IP,PORT)
+3 ;BSDXSIP and BSDXSPT represent the sender's IP and PORT.
+4 ;The event will not be raised back to the sender if these are non-null
+5 ;
+6 IF '$DATA(^BSDXTMP("EVENT",BSDXEVENT))
QUIT
+7 SET BSDXIP=0
FOR
SET BSDXIP=$ORDER(^BSDXTMP("EVENT",BSDXEVENT,BSDXIP))
IF BSDXIP=""
QUIT
Begin DoDot:1
+8 SET BSDXPORT=0
FOR
SET BSDXPORT=$ORDER(^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT))
IF '+BSDXPORT
QUIT
Begin DoDot:2
+9 ;,BSDXPORT=BSDXSPT Q
IF BSDXIP=BSDXSIP
QUIT
+10 DO CALL^%ZISTCP(BSDXIP,BSDXPORT,5)
+11 IF POP
KILL ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT)
QUIT
+12 ;U IO R X#3:5
+13 IF X'="ACK"
KILL ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT)
QUIT
+14 SET BSDXPARAM=$SELECT(BSDXPARAM="":"",1:U_BSDXPARAM)
+15 USE IO
WRITE BSDXEVENT,BSDXPARAM,!
+16 DO ^%ZISC
+17 QUIT
End DoDot:2
+18 QUIT
End DoDot:1
+19 QUIT
+20 ;
EVERR(BSDXEVENT,BSDXIP,BSDXPORT) ;
+1 ;
+2 IF $GET(BSDXEVENT)=""
QUIT
+3 IF $GET(BSDXIP)=""
QUIT
+4 IF $GET(BSDXIP)=""
QUIT
+5 KILL ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT)
+6 QUIT
+7 ;
REGET ;EP
+1 ;Error trap from REGEVNT
+2 ;
+3 IF '$DATA(BSDXI)
NEW BSDXI
SET BSDXI=999
+4 SET BSDXI=BSDXI+1
+5 DO REGERR(BSDXI,99)
+6 QUIT
+7 ;
REGERR(BSDXI,BSDXERID) ;Error processing
+1 SET BSDXI=BSDXI+1
+2 SET ^BSDXTMP($JOB,BSDXI)=BSDXERID_$CHAR(30)
+3 SET BSDXI=BSDXI+1
+4 SET ^BSDXTMP($JOB,BSDXI)=$CHAR(31)
+5 QUIT
+6 ;
+7 ;
REGEVNT(BSDXY,BSDXEVENT,BSDXIP,BSDXPORT) ;EP
+1 ;RPC Called by client to inform RPMS server of client's interest in BSDXEVENT
+2 ;Returns RECORDSET with field ERRORID.
+3 ;If everything ok then ERRORID = 0;
+4 ;
+5 NEW BSDXI
+6 SET BSDXI=0
+7 SET X="REGET^BSDX23"
SET @^%ZOSF("TRAP")
+8 SET BSDXY="^BSDXTMP("_$JOB_")"
+9 SET ^BSDXTMP($JOB,0)="I00020ERRORID"_$CHAR(30)
+10 IF '+BSDXPORT
DO REGERR(BSDXI,1)
QUIT
+11 IF BSDXIP=""
DO REGERR(BSDXI,2)
QUIT
+12 SET ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT)=""
+13 ;
+14 SET BSDXI=BSDXI+1
+15 SET ^BSDXTMP($JOB,BSDXI)="0"_$CHAR(30)_$CHAR(31)
+16 QUIT
+17 ;
UNREG(BSDXY,BSDXEVENT,BSDXIP,BSDXPORT) ;EP
+1 ;RPC Called by client to Unregister client's interest in BSDXEVENT
+2 ;Returns RECORDSET with field ERRORID.
+3 ;If everything ok then ERRORID = 0;
+4 ;
+5 NEW BSDXI
+6 SET BSDXI=0
+7 SET X="REGET^BSDX23"
SET @^%ZOSF("TRAP")
+8 SET BSDXY="^BSDXTMP("_$JOB_")"
+9 SET ^BSDXTMP($JOB,0)="I00020ERRORID"_$CHAR(30)
+10 IF '+BSDXPORT
DO REGERR(BSDXI,1)
QUIT
+11 IF BSDXIP=""
DO REGERR(BSDXI,2)
QUIT
+12 KILL ^BSDXTMP("EVENT",BSDXEVENT,BSDXIP,BSDXPORT)
+13 ;
+14 SET BSDXI=BSDXI+1
+15 SET ^BSDXTMP($JOB,BSDXI)="0"_$CHAR(30)_$CHAR(31)
+16 QUIT
+17 ;
RAISEVNT(BSDXY,BSDXEVENT,BSDXPARAM,BSDXSIP,BSDXSPT) ;EP
+1 ;RPC Called to raise event BSDXEVENT with parameter BSDXPARAM
+2 ;BSDXSIP and BSDXSPT represent the sender's IP and PORT.
+3 ;If not null, these will prevent the event from being raised back
+4 ;to the sender.
+5 ;Returns a RECORDSET wit the field ERRORID.
+6 ;If everything ok then ERRORID = 0;
+7 ;
+8 NEW BSDXI
+9 SET BSDXI=0
+10 SET BSDXY="^BSDXTMP("_$JOB_")"
+11 SET ^BSDXTMP($JOB,0)="I00020ERRORID"_$CHAR(30)
+12 SET X="REGET^BSDX23"
SET @^%ZOSF("TRAP")
+13 ;
+14 DO EVENT(BSDXEVENT,BSDXPARAM,BSDXSIP,BSDXSPT)
+15 ;
+16 SET BSDXI=BSDXI+1
+17 SET ^BSDXTMP($JOB,BSDXI)="0"_$CHAR(30)_$CHAR(31)
+18 QUIT