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

HLOTRACE.m

Go to the documentation of this file.
  1. HLOTRACE ;OIFO-OAK/PIJ/CJM - HLO CLIENT TRACE Tool ; 03/07/2011
  1. ;;1.6;HEALTH LEVEL SEVEN;**146,147,153,172** ;Oct 13, 1995;Build 11
  1. ;Per VA Directive 6402, this routine should not be modified.
  1. ;;
  1. ;; HLO CLIENT TRACE Tool
  1. ;; *** For troubleshooting HLO client issues ***
  1. ;; Client runs in the foreground and writes trace statements
  1. ;; to the screen.
  1. ;;
  1. START ;
  1. N CONF
  1. I '$G(DUZ) W !,"Your DUZ must be set!" Q
  1. D OWNSKEY^XUSRB(.CONF,"XUPROG",DUZ)
  1. I 'CONF(0) D Q
  1. . W !!," Sorry, you are not authorized to use this tool.",!!
  1. ;I $P($$VERSION^%ZOSV(1),"/",1)'="Cache for OpenVMS" D Q
  1. I '(($P($$VERSION^%ZOSV(1),"/",1)[("Cache"))!($$VERSION^%ZOSV(1)["IRIS")) D Q
  1. .W !!," Sorry, this tool can only be used under Cache or IRIS",!!
  1. N LINK,PORT,QUE,SUB,WORK,HLMSTATE,HLCSTATE,OLD,MAXTRACE,TRACECNT
  1. S LINK=$$ASKLINK^HLOUSR
  1. Q:LINK=""
  1. S PORT=$$ASKPORT(LINK)
  1. Q:'PORT
  1. S SUB=LINK_":"_PORT
  1. S QUE=$$ASKQUE(SUB)
  1. Q:QUE=""
  1. ZB /INTERRUPT:NORMAL ;disable CTRL-C breaks
  1. L +^HLB("QUEUE","OUT",SUB,QUE):20
  1. ;
  1. I '$T W !,"That queue is currently being processed. You need to either stop that link,",!,"stop that queue, or totally stop HLO so that this tool can be used." Q
  1. I '$O(^HLB("QUEUE","OUT",SUB,QUE,0)) W !,"There are no messages pending on that queue!" Q
  1. S TRACECNT=0
  1. S MAXTRACE=$$ASKCOUNT
  1. Q:(MAXTRACE<1)
  1. S WORK("QUEUE")=QUE,WORK("LINK")=SUB
  1. D SETBREAKS
  1. D DOWORK^HLOCLNT(.WORK)
  1. D:$G(HLCSTATE("CONNECTED")) CLOSE^HLOT(.HLCSTATE)
  1. ;
  1. U $PRINCIPAL
  1. L -^HLB("QUEUE","OUT",SUB,QUE)
  1. ZB /CLEAR
  1. W !,"DONE!"
  1. ;
  1. Q
  1. SETBREAKS ;
  1. ZB /CLEAR
  1. ;
  1. ;set break in $$STOPPED^HLOQUE to circumvent shutdown of the queue
  1. ZB ZB0^HLOQUE:"N":1:"S RET=0"
  1. ;set break in $$IFSHUT^HLOTLNK to circumvent shutdown of the link
  1. ZB ZB0^HLOTLNK:"N":1:"S RET=0"
  1. ;set break at ZB0 in client (start of DOWORK)
  1. ZB ZB0^HLOCLNT:"N":1:"D WRITE^HLOTRACE(""Launching the client process..."")"
  1. ;set break at ZB1 in client ($$CONNECT)
  1. ZB ZB1^HLOCLNT1:"N":1:"D WRITE^HLOTRACE(""Trying to connect..."")"
  1. ;set break at ZB2 in client (end of $$CONNECT)
  1. ZB ZB2^HLOCLNT1:"N":1:"D ZB2^HLOTRACE"
  1. ;set break at ZB3 in client (ERROR TRAP)
  1. ZB ZB3^HLOCLNT:"N":1:"D ZB3^HLOTRACE"
  1. ;set break at ZB4 in client (FOR loop on the outgoing queue)
  1. ZB ZB4^HLOCLNT:"N":1:"D ZB4^HLOTRACE"
  1. ;set break at ZB5 in client (end of DOWORK, with just cleanup left)
  1. ZB ZB5^HLOCLNT:"N":1:"D WRITE3^HLOTRACE(""Cleaning up...."")"
  1. ;set break at ZB6 in client (start of $$TRANSMIT^HLOCLNT1)
  1. ZB ZB6^HLOCLNT1:"N":1:"D WRITE^HLOTRACE(""Beginning to transmit message...."")"
  1. ;set break at ZB7 in client (end of $$TRANSMIT^HLOCLNT1)
  1. ZB ZB7^HLOCLNT1:"N":1:"D WRITE^HLOTRACE(""Message transmitted!"")"
  1. ;set break at ZB8 in client (start of $$READACK^HLOCLNT1)
  1. ;ZB ZB8^HLOCLNT1:"N":1:"D WRITE^HLOTRACE(""Beginning to read commit acknowledgment...."")"
  1. ZB ZB8^HLOCLNT1:"N":1:"D ZB8^HLOTRACE"
  1. ;set break at ZB9 in client (end of $$READACK^HLOCLNT1)
  1. ;ZB ZB9^HLOCLNT1:"N":1:"D WRITE^HLOTRACE(""Commit acknowledgment received!"")"
  1. ZB ZB9^HLOCLNT1:"N":1:"D ZB9^HLOTRACE"
  1. ;set break ZB10 in the client(start of $$READHDR^HLOT)
  1. ZB ZB10^HLOT:"N":1:"D ZB10^HLOTRACE"
  1. ;set break ZB11 in the client(end of $$READHDR^HLOT)
  1. ZB ZB11^HLOT:"N":1:"D ZB11^HLOTRACE"
  1. ;set break ZB12 in the client(start of $$READSEG^HLOT)
  1. ZB ZB12^HLOT:"N":1:"D ZB12^HLOTRACE"
  1. ;set break ZB13 in the client(end of $$READSEG^HLOT)
  1. ZB ZB13^HLOT:"N":1:"D ZB13^HLOTRACE"
  1. ;set break ZB14 in the client(start of $$WRITESEG^HLOT)
  1. ZB ZB14^HLOT:"N":1:"D ZB14^HLOTRACE"
  1. ;set break ZB15 in the client(end of $$WRITESEG^HLOT)
  1. ZB ZB15^HLOT:"N":1:"D ZB15^HLOTRACE"
  1. ;set break ZB16 in the client(start of $$WRITEHDR^HLOT)
  1. ZB ZB16^HLOT:"N":1:"D ZB16^HLOTRACE"
  1. ;set break ZB17 in the client(end of $$WRITEHDR^HLOT)
  1. ZB ZB17^HLOT:"N":1:"D ZB17^HLOTRACE"
  1. ;set break ZB18 in the client(start of $$ENDMSG^HLOT)
  1. ZB ZB18^HLOT:"N":1:"D ZB18^HLOTRACE"
  1. ;set break ZB19 in the client(end of $$ENDMSG^HLOT)
  1. ZB ZB19^HLOT:"N":1:"D ZB19^HLOTRACE"
  1. ZB ZB20^HLOCLNT:"N":1:"D ZB20^HLOTRACE"
  1. ZB ZB21^HLOCLNT:"N":1:"D ZB21^HLOTRACE"
  1. ZB ZB22^HLOCLNT:"N":1:"D ZB22^HLOTRACE"
  1. ZB ZB23^HLOCLNT:"N":1:"D ZB23^HLOTRACE"
  1. ZB ZB24^HLOCLNT1:"N":1:"D ZB24^HLOTRACE"
  1. ZB ZB25^HLOCLNT:"N":1:"D WRITE^HLOTRACE(""Calling DEQUE..."")"
  1. ZB ZB31^HLOTCP:"N":1:"D WRITE^HLOTRACE(""Beginning READ over TCP..."")"
  1. ZB ZB32^HLOTCP:"N":1:"D ZB32^HLOTRACE"
  1. Q
  1. WRITE(MSG) ;
  1. N OLD
  1. S OLD=$IO
  1. U $PRINCIPAL
  1. W !,?5,"Time: ",$$NOW^XLFDT," ",MSG
  1. U OLD
  1. Q
  1. WRITE2(MSG,VALUE) ;
  1. N OLD,I
  1. S OLD=$IO
  1. U $PRINCIPAL
  1. W !,?5,"Time: ",$$NOW^XLFDT," ",MSG
  1. S I=0
  1. W:$O(VALUE(0)) !
  1. F S I=$O(VALUE(I)) Q:'I W VALUE(I)
  1. U OLD
  1. Q
  1. WRITE3(MSG) ;
  1. N OLD
  1. S OLD=$IO
  1. U $PRINCIPAL
  1. W !,MSG
  1. U OLD
  1. Q
  1. ;
  1. ZB3 ;
  1. N CON,MSG
  1. S CON=($ZA\8192#2)
  1. S MSG="Error encountered, $ECODE="_$ECODE
  1. D WRITE^HLOTRACE(MSG)
  1. S MSG=$S(CON:" TCP connection still active",1:" TCP connection was dropped")
  1. D WRITE3^HLOTRACE(MSG)
  1. D ^%ZTER
  1. Q
  1. ZB4 ;
  1. N OLD
  1. S OLD=$IO
  1. U $PRINCIPAL
  1. W !!,"Looking for the next message to transmit..."
  1. I 'MSGIEN W !!,"No more messages pending on that queue!" S SUCCESS=0 Q
  1. S TRACECNT=$G(TRACECNT)+1
  1. I MAXTRACE>1 D
  1. .W !!,"Message IEN=",MSGIEN," next on queue"
  1. .I TRACECNT>MAXTRACE D
  1. ..I $$ASKYESNO^HLOUSR2("Do you want to trace another group of message transmissions","YES") S SUCCESS=1,TRACECNT=1
  1. ..E S SUCCESS=0
  1. .E S SUCCESS=1
  1. E D
  1. .I '$$ASKYESNO^HLOUSR2("Message IEN="_MSGIEN_" next on queue, do you want to trace its transmission","YES") S SUCCESS=0
  1. U OLD
  1. Q
  1. ;
  1. ZB2 ;
  1. W !,$S('HLCSTATE("CONNECTED"):"Connection Failed!",1:"Connected!")
  1. Q
  1. ZB8 ;
  1. D WRITE^HLOTRACE("Beginning to read commit acknowledgment....")
  1. Q
  1. ZB9 ;
  1. I $G(SUCCESS) D
  1. .D WRITE^HLOTRACE("Commit acknowledgment received!")
  1. E D
  1. .D WRITE^HLOTRACE("Read of commit acknowledgment FAILED!")
  1. Q
  1. ZB10 ;
  1. D WRITE^HLOTRACE("Getting message header...")
  1. Q
  1. ZB11 ;
  1. I $D(HDR) D WRITE2^HLOTRACE("",.HDR)
  1. D WRITE^HLOTRACE($S(SUCCESS:"Got message header!",1:"**** FAILED TO READ MESSAGE HEADER! *****"))
  1. Q
  1. ZB12 ;
  1. D WRITE^HLOTRACE("Getting next segment...")
  1. Q
  1. ZB13 I $D(SEG) D WRITE2^HLOTRACE("",.SEG)
  1. D WRITE^HLOTRACE($S(RETURN:"Got next segment!",$G(HLCSTATE("MESSAGE ENDED")):"No more segments!",1:"**** FAILED TO COMPLETE READING NEXT SEGMENT *****"))
  1. Q
  1. ZB14 ;
  1. D WRITE2^HLOTRACE("Writing next segment...",.SEG)
  1. Q
  1. ZB15 D WRITE^HLOTRACE($S(RETURN:"Completed!",1:"**** FAILED TO COMPLETE *****"))
  1. Q
  1. ZB16 ;
  1. D WRITE2^HLOTRACE("Writing header segment...",.HDR)
  1. Q
  1. ZB17 D WRITE^HLOTRACE($S(SUCCESS:"Completed!",1:"**** FAILED TO COMPLETE *****"))
  1. Q
  1. ZB18 ;
  1. D WRITE^HLOTRACE("Writing message terminators and flushing buffer...")
  1. Q
  1. ZB19 D WRITE^HLOTRACE($S(RETURN:"Completed!",1:"**** FAILED TO COMPLETE *****"))
  1. Q
  1. ZB20 ;
  1. D WRITE^HLOTRACE("Message on queue was already transmitted, will be deleted from queue...")
  1. Q
  1. ZB21 ;
  1. D WRITE^HLOTRACE("MSA segment shows this is not a commit ack to the message transmitted...")
  1. Q
  1. ZB22 ;
  1. D WRITE^HLOTRACE("Commit ack not CA, message status set to error...")
  1. Q
  1. ZB23 ;
  1. D WRITE^HLOTRACE("Setting timestamp of sequence queue...")
  1. Q
  1. ZB24 ;S HLOCSTATE("CONNECTED")=1
  1. S HLCSTATE("LINK","SHUTDOWN")=0
  1. Q
  1. ZB32 D:('$G(RETURN)) WRITE^HLOTRACE("**** FAILED ****")
  1. D:$G(RETURN) WRITE3^HLOTRACE("")
  1. D:$G(RETURN) WRITE3^HLOTRACE($G(BUF))
  1. D:$G(RETURN) WRITE3^HLOTRACE("")
  1. D:$G(RETURN) WRITE^HLOTRACE("READ over TCP completed! #Characters read: "_$L($G(BUF)))
  1. Q
  1. ;
  1. ASKQUE(SUB) ;
  1. N DIR,Q1,Q2
  1. S Q1=$O(^HLB("QUEUE","OUT",SUB,""))
  1. I Q1="" W !,"There are no outgoing messages queued to that link!",! Q ""
  1. S Q2=$O(^HLB("QUEUE","OUT",SUB,Q1))
  1. I Q2="" D
  1. .S DIR("B")=Q1
  1. E I $D(^HLB("QUEUE","OUT",SUB,"DEFAULT")) D
  1. .S DIR("B")="DEFAULT"
  1. E D
  1. .S DIR("B")=Q1
  1. S DIR(0)="F^1:20"
  1. S DIR("A")="What is the name of the queue"
  1. S DIR("?",1)="To use this tool, there must be messages already pending transmission."
  1. S DIR("?")="Enter the name of the queue, or '^' to exit."
  1. D ^DIR
  1. I $D(DIRUT)!(Y="") Q ""
  1. Q Y
  1. ;
  1. ASKCOUNT() ;
  1. N DIR
  1. S DIR(0)="N^1:100"
  1. S DIR("A")="Send how many at a time"
  1. S DIR("B")=1
  1. S DIR("?",1)="How many messages do you want to transmit at once"
  1. S DIR("?")="while tracing the client (100 maximum)?"
  1. D ^DIR
  1. Q:$D(DTOUT)!$D(DUOUT) -1
  1. Q X
  1. ASKPORT(LINK) ;
  1. Q:LINK="" ""
  1. N PORT,QUEUE
  1. S QUEUE=$O(^HLB("QUEUE","OUT",LINK_":"))
  1. Q:$P(QUEUE,":")'=LINK ""
  1. S PORT=$P(QUEUE,":",2)
  1. Q:'PORT ""
  1. S QUEUE=$O(^HLB("QUEUE","OUT",QUEUE))
  1. Q:$P(QUEUE,":")'=LINK PORT
  1. S PORT=$$ASKPORT^HLOUSRA(LINK)
  1. Q PORT