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

XWBTCPMT.m

Go to the documentation of this file.
  1. XWBTCPMT ;ISF/RWF - Routine to test a connection ;10/07/09 16:37
  1. ;;1.1;RPC BROKER;**43,49,53**;Mar 28, 1997;Build 5
  1. CALL ;Interactive
  1. N IP,PORT,STAT
  1. D HOME^%ZIS
  1. S U="^",DTIME=$$DTIME^XUP
  1. W !,"Interactive Broker Test"
  1. R !,"IP ADDRESS: ",IP:DTIME
  1. I IP["^" Q
  1. R !,"PORT: ",PORT:DTIME
  1. I PORT["^" Q
  1. S STAT=$$TEST(IP,PORT,1)
  1. U $P
  1. W !,$S(STAT>0:"Success, response: "_$P(STAT,U,2),1:"Failed: "_$P(STAT,U,2,9))
  1. Q
  1. ;
  1. TEST(IP,PORT,TALK) ;
  1. N T1,T2,T3,T4,OS,RES,RES2,RES3
  1. S OS=^%ZOSF("OS")
  1. I IP'?1.3N1P1.3N1P1.3N1P1.3N S IP=$$ADDRESS^XLFNSLK(IP)
  1. I IP'?1.3N1P1.3N1P1.3N1P1.3N Q "-1^BAD IP"
  1. I OS["OpenM" X "S T1=$ZH"
  1. D CALL^%ZISTCP(IP,PORT)
  1. I OS["OpenM" X "S T2=$ZH"
  1. I POP Q "-1^Failed to Connect"
  1. U IO
  1. N $ET S $ET="G ERR^XWBTCPMT"
  1. ;TCPConnect
  1. W "[XWB]10304"_$C(10)_"TCPConnect5001010.6.17.95f00010f0024ISF-FORTW.vha.med.va.govf"_$C(4),@IOF
  1. R RES:10 I '$T S RES="-1^TIMEOUT" G EXIT
  1. I OS["OpenM" X "S T3=$ZH"
  1. W "[XWB]11302"_$C(1)_"0"_$C(16)_"XUS SIGNON SETUP54f"_$C(4),@IOF
  1. R RES2:10
  1. I OS["OpenM" X "S T4=$ZH"
  1. W "[XWB]10304"_$C(5)_"#BYE#"_$C(4),@IOF
  1. R RES3:3 I '$T S RES="-1^TIMEOUT after accept" G EXIT
  1. S RES="1^"_RES_U_($G(T2)-$G(T1))_U_($G(T3)-$G(T2))_U_($G(T4)-$G(T3))
  1. EXIT ;Close and Exit
  1. D CLOSE^%ZISTCP
  1. Q RES
  1. ;
  1. ERR ;
  1. D CLOSE^%ZISTCP
  1. U $P
  1. Q "-1^"_$$EC^%ZOSV
  1. ;
  1. CHECK ;Check server setup
  1. N XPARSYS,XWBDEBUG,XWBOS,XWBT,XWNRBUF,XWBTIME,NEWJOB,XWBVER
  1. W !,"This will check for some of the errors that can prevent the Broker"
  1. W !,"from getting started.",!
  1. D HOME^%ZIS
  1. S XWBVER=1.108
  1. D INIT^XWBTCPM
  1. W !,"Debugging is set to ",$S(XWBDEBUG=1:"On",XWBDEBUG=2:"Verbose",XWBDEBUG=3:"Very Verbose",1:"Off")
  1. D SETTIME^XWBTCPM(0)
  1. W !,"Broker activity timeout is set to ",XWBTIME
  1. S %ZIS="M",IOP="NULL" D ^%ZIS
  1. I POP W !,"The NULL device is not setup correctly."
  1. I 'POP D
  1. . W !,"Checking can Write to null device"
  1. . U IO W !,"TEST",!
  1. . D ^%ZISC U IO W !,"The NULL device is OK."
  1. I $T(SHARELIC^%ZOSV)="" W !,"The routine %ZOSV is missing the entry point 'SHARELIC'."
  1. I $T(GETPEER^%ZOSV)="" W !,"The routine %ZOSV is missing the entry point 'GETPEER'."
  1. I $G(XWBT("PCNT")),$T(COUNT^XUSCNT)="" W !,"The routine XUSCNT is missing on a GT.M system."
  1. W !,"Checking if new JOB's can start."
  1. S ^TMP("XWB",$J)=1 X "J HOLD^XWBTCPMT($J) H 1"
  1. I $G(^TMP("XWB",$J))=1 W !,"Doesn't look like a new JOB could start!",!
  1. S NEWJOB=$$NEWJOB^XWBTCPM()
  1. W !,"New jobs are "_$S('NEWJOB:"not ",1:"")_"allowed."
  1. W !,"Done with the checks.",!
  1. K ^TMP("XWB",$J)
  1. Q
  1. ;
  1. HOLD(MJ) ;Show that a new job is allowed.
  1. S ^TMP("XWB",MJ)=5
  1. HANG 5
  1. Q