HLOUSR1 ;ALB/CJM/OAK/PIJ -ListManager Screen for viewing messages;12 JUN 1997 10:00 am ;03/21/2010
;;1.6;HEALTH LEVEL SEVEN;**126,134,137,138,143,147**;Oct 13, 1995;Build 15
;Per VHA Directive 2004-038, this routine should not be modified.
;
EN ;
N MSGIEN,SEGS
S MSGIEN=$$PICKMSG
I 'MSGIEN S VALMBCK="R" Q
D EN^VALM("HLO SINGLE MESSAGE DISPLAY")
Q
;
HDR ;
;
Q
;
BLANK ;
S VALMCNT=0
D EXIT
Q
DISPLAY ;
K @VALMAR
S VALMBCK="R"
N MSG
S VALMBG=1
Q:'MSGIEN
D SHOWMSG($P(MSGIEN,"^"),$P(MSGIEN,"^",2))
Q
;
PICKMSG(DEFAULT) ;
;ask the user to select a message & return its ien
;Input: DEFAULT (optional) message id to display to user as default
N MSGIEN,DIR,COUNT,LIST
D FULL^VALM1
S DIR(0)="F3:30"
S DIR("A")="Message ID"
S:$L($G(DEFAULT)) DIR("B")=DEFAULT
S DIR("?")="Enter the full Message Control ID or Batch Control ID of the message, or '^' to exit."
PICK D ^DIR
I $D(DIRUT)!(Y="") Q 0
I $G(@VALMAR@("INDEX",Y)) Q $G(@VALMAR@("INDEX",Y))
S COUNT=$$FINDMSG^HLOMSG1(Y,.LIST)
I COUNT="0" W !!,"That message can not be found! Try Again",! G PICK
I COUNT=1 Q LIST(1)
I COUNT>1 D
.N ITEM
.W !,"There is more than one message with that ID! You must choose one to display.",1
.S ITEM=0
.F S ITEM=$O(LIST(ITEM)) Q:'ITEM D
..N MSG
..Q:'$$GETMSG^HLOMSG(+LIST(ITEM),.MSG)
..W !,"[",ITEM,"]"," DT/TM: ",$$FMTE^XLFDT(MSG("DT/TM CREATED"),2)," STATUS: ",MSG("STATUS")
.S DIR(0)="NO^1:"_COUNT,DIR("A")="Choose",DIR("?")="Choose one message from the list"
.D ^DIR
.I Y S Y=LIST(Y)
Q Y
;
HELP ;Help code
S X="?" D DISP^XQORM1 W !!
Q
;
EXIT ;Exit code
D CLEAN^VALM10
D CLEAR^VALM1
S VALMBCK="R"
;
Q
;
EXPND ;Expand code
Q
;
CJ(STRING,LEN) ;
Q $$CJ^XLFSTR(STRING,LEN)
LJ(STRING,LEN) ;
Q $$LJ^XLFSTR(STRING,LEN)
SP(LEN,CHAR) ;
;return padding - " " is the default pad character
N STR
S:$G(CHAR)="" CHAR=" "
S $P(STR,CHAR,LEN)=CHAR
Q STR
;
SHOWMSG(MSGIEN,SUBIEN) ;
;Description:
;
;Input:
;Output:
;
N MSG,I,TEMP,LINE,HDR,TRIES,STATUS
S VALMCNT=0
S SUBIEN=+$G(SUBIEN)
I '$$GETMSG^HLOMSG(MSGIEN,.MSG) W !,"UNABLE TO DISPLAY THE MESSAGE",!! Q
I SUBIEN S STATUS=MSG("STATUS") D GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG) I MSG("STATUS")="" S MSG("STATUS")=STATUS
S HDR(1)=MSG("HDR",1),HDR(2)=MSG("HDR",2)
I $$PARSEHDR^HLOPRS(.HDR)
S I=0
;** administrative information **
S @VALMAR@($$I,0)=$$CJ("Administrative Information",80)
D CNTRL^VALM10(VALMCNT,26,30,IORVON,IORVOFF)
;; ***patch HL*1.6*138 start
S LINE="MsgID: "_$$LJ(MSG("ID"),18) ;;
S:MSG("ACK TO")]"" LINE=LINE_$$LJ(" Application Ack To:",26)_MSG("ACK TO") ;;
S:MSG("ACK BY")]"" LINE=LINE_$$LJ(" Application Ack'd By:",26)_MSG("ACK BY") ;;
S @VALMAR@($$I,0)=LINE ;;
;;
S LINE=""
S:MSG("DIRECTION")="OUT" TRIES=$G(^HLB(MSGIEN,"TRIES"))
;
;determine current status - as opposed to final status
D
.I MSG("STATUS")="SU" S MSG("STATUS")="SUCCESSFUL" Q
.I MSG("STATUS")="ER" S MSG("STATUS")="ERROR" Q
.I MSG("DIRECTION")="IN" D Q
..I '$G(MSG("STATUS","APP HANDOFF")) S MSG("STATUS")="PENDING ON RECEIVING APPLICATION" Q
.I MSG("DIRECTION")="OUT" D Q
..I MSG("DT/TM")="" D Q
...I $O(^HLB("QUEUE","OUT",MSG("STATUS","LINK NAME")_":"_MSG("STATUS","PORT"),MSG("STATUS","QUEUE"),0))=MSG("IEN") S MSG("STATUS")="TRANSMISSION IN PROGRESS" Q
...S MSG("STATUS")="PENDING ON OUTGOING QUEUE" Q
..I $G(HDR("APP ACK TYPE"))="AL",'$G(MSG("STATUS","APP ACK'D")),$G(MSG("ACK BY"))="" S MSG("STATUS")="TRANSMITTED, PENDING RECEIPT OF APPLICATION ACKNOWLEDGEMENT" Q
;; ***patch HL*1.6*138 end
;
S LINE="Status: "_$$LJ(MSG("STATUS"),79)
S @VALMAR@($$I,0)=LINE
I MSG("STATUS","ERROR TEXT")]"" S @VALMAR@($$I,0)="Error: "_"** "_MSG("STATUS","ERROR TEXT")_" **"
;;**138 start cjm
;S @VALMAR@($$I,0)="Dir: "_$$LJ($S(MSG("DIRECTION")="IN":"INCOMING",1:"OUTGOING"),10)_$$LJ(" Trans Dt/Tm: ",12)_$$FMTE^XLFDT(MSG("DT/TM"),2)_$$LJ(" Purge DT/TM: ",8)_$$FMTE^XLFDT(MSG("STATUS","PURGE"),2)
S @VALMAR@($$I,0)="Direction: "_$$LJ($S(MSG("DIRECTION")="IN":"IN",1:"OUT"),4)_$$LJ(" TransDt/Tm"_$S($G(TRIES):"("_TRIES_"x): ",1:": "),12)_$$FMTE^XLFDT(MSG("DT/TM"),2)_$$LJ(" Purge DT/TM: ",8)_$$FMTE^XLFDT(MSG("STATUS","PURGE"),2)
;** 138 end cjm
S @VALMAR@($$I,0)="Link: "_$$LJ(MSG("STATUS","LINK NAME"),29)_" "_$$LJ("Queue: ",13)_MSG("STATUS","QUEUE")
I $L($G(MSG("STATUS","SEQUENCE QUEUE"))) D
.S @VALMAR@($$I,0)="Sequence Queue: "_MSG("STATUS","SEQUENCE QUEUE")_" Moved: "_$S(MSG("STATUS","MOVED TO OUT QUEUE"):"YES",1:"NO")
I MSG("STATUS","ACCEPT ACK'D") D
.S @VALMAR@($$I,0)="Accept Ack: "_$$LJ(MSG("STATUS","ACCEPT ACK ID"),26)_$$LJ(" DT/TM Ack'd: ",14)_$$FMTE^XLFDT(MSG("STATUS","ACCEPT ACK DT/TM"),2)
.S @VALMAR@($$I,0)=" "_MSG("STATUS","ACCEPT ACK MSA")
I MSG("DIRECTION")="IN" D
.S LINE="App Response Rtn: "
.;START HL*1.6*138 CJM
.;I $L($G(MSG("STATUS","APP ACK RESPONSE"))) S LINE=$$LJ(LINE_MSG("STATUS","APP ACK RESPONSE"),38)_" Executed: "_$S(MSG("STATUS","APP HANDOFF"):" YES",1:" NO")
.S LINE=$$LJ(LINE_$S($L($G(MSG("STATUS","ACTION"))):MSG("STATUS","ACTION"),1:"n/a"),38)_" Executed: "_$S('$L($G(MSG("STATUS","ACTION"))):"n/a",MSG("STATUS","APP HANDOFF"):" YES",1:" NO")
.;;END HL*1.6*138 CJM
.S @VALMAR@($$I,0)=LINE
I MSG("DIRECTION")="OUT",(MSG("STATUS","APP ACK'D")!MSG("STATUS","ACCEPT ACK'D")) D
.S LINE=""
.I MSG("STATUS","ACCEPT ACK'D") D
..I MSG("STATUS","ACCEPT ACK RESPONSE")="" S MSG("STATUS","ACCEPT ACK RESPONSE")="n/a"
..S LINE="Accept Ack Rtn: "_MSG("STATUS","ACCEPT ACK RESPONSE")
.S LINE=$$LJ(LINE,39)
.I MSG("STATUS","APP ACK'D") D
..I MSG("STATUS","APP ACK RESPONSE")="" S MSG("STATUS","APP ACK RESPONSE")="n/a"
..S LINE=LINE_"App Ack Rtn: "_MSG("STATUS","APP ACK RESPONSE")
.S @VALMAR@($$I,0)=LINE
;
;** the message text **
S @VALMAR@($$I,0)=""
I '$G(SUBIEN) D
.S @VALMAR@($$I,0)=$$CJ("Message Text",80)
.D CNTRL^VALM10(VALMCNT,33,16,IORVON,IORVOFF)
E D
.S @VALMAR@($$I,0)=$$CJ("Individual Message Text (Batched)",80)
.D CNTRL^VALM10(VALMCNT,23,35,IORVON,IORVOFF)
;; START 138
;D SHOWBODY(.MSG,$G(SUBIEN))
D SHOWBODY(.MSG,$G(SUBIEN),.SEGS)
;; END 138
;
;** display its application acknowledgment **
;**P143 START CJM
;I MSG("ACK BY")]"",$$FINDMSG^HLOMSG1(MSG("ACK BY"),.TEMP)=1 S MSGIEN=TEMP(1) D
I $G(MSG("ACK BY IEN")) S MSGIEN=MSG("ACK BY IEN") D
.;**P143 END CJM
.N MSG,STATUS
.Q:'$$GETMSG^HLOMSG(+MSGIEN,.MSG)
.I $P(MSGIEN,"^",2) S STATUS=MSG("STATUS") D GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG) I MSG("STATUS")="" S MSG("STATUS")=STATUS
.S @VALMAR@($$I,0)=""
.S @VALMAR@($$I,0)=$$CJ("Application Acknowledgment",80)
.D CNTRL^VALM10(VALMCNT,26,30,IORVON,IORVOFF)
.D SHOWBODY(.MSG,$P(MSGIEN,"^",2))
;
;** display the original message **
;**P143 START CJM
;I MSG("ACK TO")]"",$$FINDMSG^HLOMSG1(MSG("ACK TO"),.TEMP)=1 S MSGIEN=TEMP(1) D
I $G(MSG("ACK TO IEN")) S MSGIEN=MSG("ACK TO IEN") D
.;**P143 END CJM
.N MSG
.Q:'$$GETMSG^HLOMSG(+MSGIEN,.MSG)
.I $P(MSGIEN,"^",2) S STATUS=MSG("STATUS") D GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG) I MSG("STATUS")="" S MSG("STATUS")=STATUS
.S @VALMAR@($$I,0)=""
.S @VALMAR@($$I,0)=$$CJ("Original Message",80)
.D CNTRL^VALM10(VALMCNT,26,30,IORVON,IORVOFF)
.D SHOWBODY(.MSG,$P(MSGIEN,"^",2))
Q
;
SHOWBODY(MSG,SUBIEN,SEGS) ;
N NODE,I,SEG,QUIT
S QUIT=0
S SEGS("ARY")=VALMAR
S SEGS("TOP")=VALMCNT+1
M SEG=MSG("HDR")
D ADD(.SEG,.SEGS)
S MSG("BATCH","CURRENT MESSAGE")=0
I MSG("BATCH") D
.I $G(SUBIEN) D Q
..S MSG("BATCH","CURRENT MESSAGE")=SUBIEN
..F Q:'$$HLNEXT^HLOMSG(.MSG,.SEG) D ADD(.SEG,.SEGS)
.S MSG("BATCH","CURRENT MESSAGE")=0
.N LAST S LAST=0
.F Q:'$$NEXTMSG^HLOMSG(.MSG,.SEG) D Q:QUIT
..D ADD(.SEG,.SEGS)
..S LAST=MSG("BATCH","CURRENT MESSAGE")
..F Q:'$$HLNEXT^HLOMSG(.MSG,.SEG) D ADD(.SEG,.SEGS)
.I MSG("DIRECTION")="OUT" K SEG S SEG(1)="BTS"_$E($G(MSG("HDR",1)),4)_LAST D ADD(.SEG,.SEGS)
.;
E D
.F Q:'$$HLNEXT^HLOMSG(.MSG,.SEG) D Q:QUIT
..D ADD(.SEG,.SEGS)
S SEGS("BOT")=VALMCNT
Q
I() ;
S VALMCNT=VALMCNT+1
Q VALMCNT
ADD(SEG,SEGS) ;
N QUIT,I,J,LINE
S QUIT=0
S SEGS=$G(SEGS)+1
S (I,J)=1
S LINE(1)=$E(SEG(1),1,80),SEG(1)=$E(SEG(1),81,9999)
I SEG(1)="" K SEG(1)
D SHIFT(.I,.J)
S @VALMAR@($$I,0)=LINE(1)
;; START 138
D CNTRL^VALM10(VALMCNT,1,3,IOINHI,IOINORM)
;;END 138
S SEGS(SEGS)=VALMCNT
S I=1
F S I=$O(LINE(I)) Q:'I D
.S @VALMAR@($$I,0)=LINE(I)
.;;START 138
.;D CNTRL^VALM10(VALMCNT,1,1,IORVON,IORVOFF)
.;END 138
Q
;
SHIFT(I,J) ;
I '$D(SEG(I)) S I=$O(SEG(0)) Q:'I
I $L(LINE(J))<80 D
.N LEN
.S LEN=$L(LINE(J))
.S LINE(J)=LINE(J)_$E(SEG(I),1,80-LEN)
.S SEG(I)=$E(SEG(I),81-LEN,9999)
.I SEG(I)="" K SEG(I)
E D
.S J=J+1
.S LINE(J)=""
D SHIFT(.I,.J)
Q
;
SCRLMODE ;scroll mode
Q:'$L(HLRFRSH)
N QUIT,IOTM,IOBM,DX,DY,LINE,IOTM,IOBM
W !!,IOINHI,"Hit any key to escape scroll mode...",IOINORM
S IOTM=3,IOBM=23
S QUIT=0
S LINE=$S(VALMCNT<17:1,1:17)
W @IOSTBM
S DX=1,DY=$S(VALMCNT<17:VALMCNT+1,1:17) X IOXY
F I=1:1 D Q:QUIT
.;every 10 seconds refresh the data
.I I>42 D @HLRFRSH S I=0
.I LINE+1>VALMCNT D
..S TEMP=$G(@VALMAR@(LINE,0))
..W !,IOUON,TEMP_$$SP(80-$L(TEMP)),IOUOFF
.E W !,$G(@VALMAR@(LINE,0))
.S LINE=LINE+1
.I LINE>VALMCNT S LINE=1
.I (I=22)!(I=43) R *C:5 I $T S QUIT=1 Q
S VALMBG=LINE-23 I VALMBG<0 S VALMBG=1
S VALMBCK="R"
Q
HLP ;
Q
;
IFOPEN(LINK,TIME) ;
;returns 1 if the link can be opened, otherwise 0
;
;Inputs:
; LINK - name of the link (required), optionally post-fixed with ":"_<port #>, will default to that defined for link
; TIME (optional) defaults to 15 seconds
;
N LINKNAME,LINKARY,POP,IO,IOF,IOST,OPEN,PORT
S OPEN=0
;
;**P147 CJM adds TIME as an optional input parameter
I '$G(TIME) S TIME=15
;**P147 CJM END
;
S LINKNAME=$P(LINK,":")
S PORT=$P(LINK,":",2)
Q:LINKNAME="" 0
Q:'$$GETLINK^HLOTLNK(LINKNAME,.LINKARY) 0
S:PORT LINKARY("PORT")=PORT
Q:'$G(LINKARY("PORT")) 0
I LINKARY("IP")="",LINKARY("DOMAIN")="",LINKARY("LLP")="TCP",LINKARY("SERVER") D
.N DATA
.S LINKARY("DOMAIN")=$P($G(^HLD(779.1,1,0)),"^")
.Q:LINKARY("DOMAIN")=""
.S DATA(.08)=LINKARY("DOMAIN")
.Q:$$UPD^HLOASUB1(870,LINKARY("IEN"),.DATA)
D:$G(LINKARY("IP"))'=""
.D CALL^%ZISTCP(LINKARY("IP"),LINKARY("PORT"),TIME)
.S OPEN='POP
I 'OPEN,LINKARY("DOMAIN")'="",$G(^HLTMP("DNS LAST",LINKARY("IEN")))<$$DT^XLFDT D
.N IP
.S ^HLTMP("DNS LAST",LINKARY("IEN"))=$$DT^XLFDT
.S IP=$$DNS^HLOTCP(LINKARY("DOMAIN"))
.I IP'="",IP'=LINKARY("IP") D
..N DATA
..S DATA(400.01)=IP,LINKARY("IP")=IP
..Q:$$UPD^HLOASUB1(870,LINKARY("IEN"),.DATA)
..D CALL^%ZISTCP(LINKARY("IP"),LINKARY("PORT"),TIME)
..S OPEN='POP
C:OPEN IO
;D CLOSE^%ZISTCP
Q OPEN
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLOUSR1 10824 printed Oct 16, 2024@18:00:06 Page 2
HLOUSR1 ;ALB/CJM/OAK/PIJ -ListManager Screen for viewing messages;12 JUN 1997 10:00 am ;03/21/2010
+1 ;;1.6;HEALTH LEVEL SEVEN;**126,134,137,138,143,147**;Oct 13, 1995;Build 15
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
EN ;
+1 NEW MSGIEN,SEGS
+2 SET MSGIEN=$$PICKMSG
+3 IF 'MSGIEN
SET VALMBCK="R"
QUIT
+4 DO EN^VALM("HLO SINGLE MESSAGE DISPLAY")
+5 QUIT
+6 ;
HDR ;
+1 ;
+2 QUIT
+3 ;
BLANK ;
+1 SET VALMCNT=0
+2 DO EXIT
+3 QUIT
DISPLAY ;
+1 KILL @VALMAR
+2 SET VALMBCK="R"
+3 NEW MSG
+4 SET VALMBG=1
+5 if 'MSGIEN
QUIT
+6 DO SHOWMSG($PIECE(MSGIEN,"^"),$PIECE(MSGIEN,"^",2))
+7 QUIT
+8 ;
PICKMSG(DEFAULT) ;
+1 ;ask the user to select a message & return its ien
+2 ;Input: DEFAULT (optional) message id to display to user as default
+3 NEW MSGIEN,DIR,COUNT,LIST
+4 DO FULL^VALM1
+5 SET DIR(0)="F3:30"
+6 SET DIR("A")="Message ID"
+7 if $LENGTH($GET(DEFAULT))
SET DIR("B")=DEFAULT
+8 SET DIR("?")="Enter the full Message Control ID or Batch Control ID of the message, or '^' to exit."
PICK DO ^DIR
+1 IF $DATA(DIRUT)!(Y="")
QUIT 0
+2 IF $GET(@VALMAR@("INDEX",Y))
QUIT $GET(@VALMAR@("INDEX",Y))
+3 SET COUNT=$$FINDMSG^HLOMSG1(Y,.LIST)
+4 IF COUNT="0"
WRITE !!,"That message can not be found! Try Again",!
GOTO PICK
+5 IF COUNT=1
QUIT LIST(1)
+6 IF COUNT>1
Begin DoDot:1
+7 NEW ITEM
+8 WRITE !,"There is more than one message with that ID! You must choose one to display.",1
+9 SET ITEM=0
+10 FOR
SET ITEM=$ORDER(LIST(ITEM))
if 'ITEM
QUIT
Begin DoDot:2
+11 NEW MSG
+12 if '$$GETMSG^HLOMSG(+LIST(ITEM),.MSG)
QUIT
+13 WRITE !,"[",ITEM,"]"," DT/TM: ",$$FMTE^XLFDT(MSG("DT/TM CREATED"),2)," STATUS: ",MSG("STATUS")
End DoDot:2
+14 SET DIR(0)="NO^1:"_COUNT
SET DIR("A")="Choose"
SET DIR("?")="Choose one message from the list"
+15 DO ^DIR
+16 IF Y
SET Y=LIST(Y)
End DoDot:1
+17 QUIT Y
+18 ;
HELP ;Help code
+1 SET X="?"
DO DISP^XQORM1
WRITE !!
+2 QUIT
+3 ;
EXIT ;Exit code
+1 DO CLEAN^VALM10
+2 DO CLEAR^VALM1
+3 SET VALMBCK="R"
+4 ;
+5 QUIT
+6 ;
EXPND ;Expand code
+1 QUIT
+2 ;
CJ(STRING,LEN) ;
+1 QUIT $$CJ^XLFSTR(STRING,LEN)
LJ(STRING,LEN) ;
+1 QUIT $$LJ^XLFSTR(STRING,LEN)
SP(LEN,CHAR) ;
+1 ;return padding - " " is the default pad character
+2 NEW STR
+3 if $GET(CHAR)=""
SET CHAR=" "
+4 SET $PIECE(STR,CHAR,LEN)=CHAR
+5 QUIT STR
+6 ;
SHOWMSG(MSGIEN,SUBIEN) ;
+1 ;Description:
+2 ;
+3 ;Input:
+4 ;Output:
+5 ;
+6 NEW MSG,I,TEMP,LINE,HDR,TRIES,STATUS
+7 SET VALMCNT=0
+8 SET SUBIEN=+$GET(SUBIEN)
+9 IF '$$GETMSG^HLOMSG(MSGIEN,.MSG)
WRITE !,"UNABLE TO DISPLAY THE MESSAGE",!!
QUIT
+10 IF SUBIEN
SET STATUS=MSG("STATUS")
DO GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG)
IF MSG("STATUS")=""
SET MSG("STATUS")=STATUS
+11 SET HDR(1)=MSG("HDR",1)
SET HDR(2)=MSG("HDR",2)
+12 IF $$PARSEHDR^HLOPRS(.HDR)
+13 SET I=0
+14 ;** administrative information **
+15 SET @VALMAR@($$I,0)=$$CJ("Administrative Information",80)
+16 DO CNTRL^VALM10(VALMCNT,26,30,IORVON,IORVOFF)
+17 ;; ***patch HL*1.6*138 start
+18 ;;
SET LINE="MsgID: "_$$LJ(MSG("ID"),18)
+19 ;;
if MSG("ACK TO")]""
SET LINE=LINE_$$LJ(" Application Ack To:",26)_MSG("ACK TO")
+20 ;;
if MSG("ACK BY")]""
SET LINE=LINE_$$LJ(" Application Ack'd By:",26)_MSG("ACK BY")
+21 ;;
SET @VALMAR@($$I,0)=LINE
+22 ;;
+23 SET LINE=""
+24 if MSG("DIRECTION")="OUT"
SET TRIES=$GET(^HLB(MSGIEN,"TRIES"))
+25 ;
+26 ;determine current status - as opposed to final status
+27 Begin DoDot:1
+28 IF MSG("STATUS")="SU"
SET MSG("STATUS")="SUCCESSFUL"
QUIT
+29 IF MSG("STATUS")="ER"
SET MSG("STATUS")="ERROR"
QUIT
+30 IF MSG("DIRECTION")="IN"
Begin DoDot:2
+31 IF '$GET(MSG("STATUS","APP HANDOFF"))
SET MSG("STATUS")="PENDING ON RECEIVING APPLICATION"
QUIT
End DoDot:2
QUIT
+32 IF MSG("DIRECTION")="OUT"
Begin DoDot:2
+33 IF MSG("DT/TM")=""
Begin DoDot:3
+34 IF $ORDER(^HLB("QUEUE","OUT",MSG("STATUS","LINK NAME")_":"_MSG("STATUS","PORT"),MSG("STATUS","QUEUE"),0))=MSG("IEN")
SET MSG("STATUS")="TRANSMISSION IN PROGRESS"
QUIT
+35 SET MSG("STATUS")="PENDING ON OUTGOING QUEUE"
QUIT
End DoDot:3
QUIT
+36 IF $GET(HDR("APP ACK TYPE"))="AL"
IF '$GET(MSG("STATUS","APP ACK'D"))
IF $GET(MSG("ACK BY"))=""
SET MSG("STATUS")="TRANSMITTED, PENDING RECEIPT OF APPLICATION ACKNOWLEDGEMENT"
QUIT
End DoDot:2
QUIT
End DoDot:1
+37 ;; ***patch HL*1.6*138 end
+38 ;
+39 SET LINE="Status: "_$$LJ(MSG("STATUS"),79)
+40 SET @VALMAR@($$I,0)=LINE
+41 IF MSG("STATUS","ERROR TEXT")]""
SET @VALMAR@($$I,0)="Error: "_"** "_MSG("STATUS","ERROR TEXT")_" **"
+42 ;;**138 start cjm
+43 ;S @VALMAR@($$I,0)="Dir: "_$$LJ($S(MSG("DIRECTION")="IN":"INCOMING",1:"OUTGOING"),10)_$$LJ(" Trans Dt/Tm: ",12)_$$FMTE^XLFDT(MSG("DT/TM"),2)_$$LJ(" Purge DT/TM: ",8)_$$FMTE^XLFDT(MSG("STATUS","PURGE"),2)
+44 SET @VALMAR@($$I,0)="Direction: "_$$LJ($SELECT(MSG("DIRECTION")="IN":"IN",1:"OUT"),4)_$$LJ(" TransDt/Tm"_$SELECT($GET(TRIES):"("_TRIES_"x): ",1:": "),12)_$$FMTE^XLFDT(MSG("DT/TM"),2)_$$LJ(" Purge DT/TM: ",8)_$$FMTE^XLFDT(MSG("STATUS","PURGE")
,2)
+45 ;** 138 end cjm
+46 SET @VALMAR@($$I,0)="Link: "_$$LJ(MSG("STATUS","LINK NAME"),29)_" "_$$LJ("Queue: ",13)_MSG("STATUS","QUEUE")
+47 IF $LENGTH($GET(MSG("STATUS","SEQUENCE QUEUE")))
Begin DoDot:1
+48 SET @VALMAR@($$I,0)="Sequence Queue: "_MSG("STATUS","SEQUENCE QUEUE")_" Moved: "_$SELECT(MSG("STATUS","MOVED TO OUT QUEUE"):"YES",1:"NO")
End DoDot:1
+49 IF MSG("STATUS","ACCEPT ACK'D")
Begin DoDot:1
+50 SET @VALMAR@($$I,0)="Accept Ack: "_$$LJ(MSG("STATUS","ACCEPT ACK ID"),26)_$$LJ(" DT/TM Ack'd: ",14)_$$FMTE^XLFDT(MSG("STATUS","ACCEPT ACK DT/TM"),2)
+51 SET @VALMAR@($$I,0)=" "_MSG("STATUS","ACCEPT ACK MSA")
End DoDot:1
+52 IF MSG("DIRECTION")="IN"
Begin DoDot:1
+53 SET LINE="App Response Rtn: "
+54 ;START HL*1.6*138 CJM
+55 ;I $L($G(MSG("STATUS","APP ACK RESPONSE"))) S LINE=$$LJ(LINE_MSG("STATUS","APP ACK RESPONSE"),38)_" Executed: "_$S(MSG("STATUS","APP HANDOFF"):" YES",1:" NO")
+56 SET LINE=$$LJ(LINE_$SELECT($LENGTH($GET(MSG("STATUS","ACTION"))):MSG("STATUS","ACTION"),1:"n/a"),38)_" Executed: "_$SELECT('$LENGTH($GET(MSG("STATUS","ACTION"))):"n/a",MSG("STATUS","APP HANDOFF"):" YES",1:" NO")
+57 ;;END HL*1.6*138 CJM
+58 SET @VALMAR@($$I,0)=LINE
End DoDot:1
+59 IF MSG("DIRECTION")="OUT"
IF (MSG("STATUS","APP ACK'D")!MSG("STATUS","ACCEPT ACK'D"))
Begin DoDot:1
+60 SET LINE=""
+61 IF MSG("STATUS","ACCEPT ACK'D")
Begin DoDot:2
+62 IF MSG("STATUS","ACCEPT ACK RESPONSE")=""
SET MSG("STATUS","ACCEPT ACK RESPONSE")="n/a"
+63 SET LINE="Accept Ack Rtn: "_MSG("STATUS","ACCEPT ACK RESPONSE")
End DoDot:2
+64 SET LINE=$$LJ(LINE,39)
+65 IF MSG("STATUS","APP ACK'D")
Begin DoDot:2
+66 IF MSG("STATUS","APP ACK RESPONSE")=""
SET MSG("STATUS","APP ACK RESPONSE")="n/a"
+67 SET LINE=LINE_"App Ack Rtn: "_MSG("STATUS","APP ACK RESPONSE")
End DoDot:2
+68 SET @VALMAR@($$I,0)=LINE
End DoDot:1
+69 ;
+70 ;** the message text **
+71 SET @VALMAR@($$I,0)=""
+72 IF '$GET(SUBIEN)
Begin DoDot:1
+73 SET @VALMAR@($$I,0)=$$CJ("Message Text",80)
+74 DO CNTRL^VALM10(VALMCNT,33,16,IORVON,IORVOFF)
End DoDot:1
+75 IF '$TEST
Begin DoDot:1
+76 SET @VALMAR@($$I,0)=$$CJ("Individual Message Text (Batched)",80)
+77 DO CNTRL^VALM10(VALMCNT,23,35,IORVON,IORVOFF)
End DoDot:1
+78 ;; START 138
+79 ;D SHOWBODY(.MSG,$G(SUBIEN))
+80 DO SHOWBODY(.MSG,$GET(SUBIEN),.SEGS)
+81 ;; END 138
+82 ;
+83 ;** display its application acknowledgment **
+84 ;**P143 START CJM
+85 ;I MSG("ACK BY")]"",$$FINDMSG^HLOMSG1(MSG("ACK BY"),.TEMP)=1 S MSGIEN=TEMP(1) D
+86 IF $GET(MSG("ACK BY IEN"))
SET MSGIEN=MSG("ACK BY IEN")
Begin DoDot:1
+87 ;**P143 END CJM
+88 NEW MSG,STATUS
+89 if '$$GETMSG^HLOMSG(+MSGIEN,.MSG)
QUIT
+90 IF $PIECE(MSGIEN,"^",2)
SET STATUS=MSG("STATUS")
DO GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG)
IF MSG("STATUS")=""
SET MSG("STATUS")=STATUS
+91 SET @VALMAR@($$I,0)=""
+92 SET @VALMAR@($$I,0)=$$CJ("Application Acknowledgment",80)
+93 DO CNTRL^VALM10(VALMCNT,26,30,IORVON,IORVOFF)
+94 DO SHOWBODY(.MSG,$PIECE(MSGIEN,"^",2))
End DoDot:1
+95 ;
+96 ;** display the original message **
+97 ;**P143 START CJM
+98 ;I MSG("ACK TO")]"",$$FINDMSG^HLOMSG1(MSG("ACK TO"),.TEMP)=1 S MSGIEN=TEMP(1) D
+99 IF $GET(MSG("ACK TO IEN"))
SET MSGIEN=MSG("ACK TO IEN")
Begin DoDot:1
+100 ;**P143 END CJM
+101 NEW MSG
+102 if '$$GETMSG^HLOMSG(+MSGIEN,.MSG)
QUIT
+103 IF $PIECE(MSGIEN,"^",2)
SET STATUS=MSG("STATUS")
DO GETMSGB^HLOMSG1(.MSG,SUBIEN,.MSG)
IF MSG("STATUS")=""
SET MSG("STATUS")=STATUS
+104 SET @VALMAR@($$I,0)=""
+105 SET @VALMAR@($$I,0)=$$CJ("Original Message",80)
+106 DO CNTRL^VALM10(VALMCNT,26,30,IORVON,IORVOFF)
+107 DO SHOWBODY(.MSG,$PIECE(MSGIEN,"^",2))
End DoDot:1
+108 QUIT
+109 ;
SHOWBODY(MSG,SUBIEN,SEGS) ;
+1 NEW NODE,I,SEG,QUIT
+2 SET QUIT=0
+3 SET SEGS("ARY")=VALMAR
+4 SET SEGS("TOP")=VALMCNT+1
+5 MERGE SEG=MSG("HDR")
+6 DO ADD(.SEG,.SEGS)
+7 SET MSG("BATCH","CURRENT MESSAGE")=0
+8 IF MSG("BATCH")
Begin DoDot:1
+9 IF $GET(SUBIEN)
Begin DoDot:2
+10 SET MSG("BATCH","CURRENT MESSAGE")=SUBIEN
+11 FOR
if '$$HLNEXT^HLOMSG(.MSG,.SEG)
QUIT
DO ADD(.SEG,.SEGS)
End DoDot:2
QUIT
+12 SET MSG("BATCH","CURRENT MESSAGE")=0
+13 NEW LAST
SET LAST=0
+14 FOR
if '$$NEXTMSG^HLOMSG(.MSG,.SEG)
QUIT
Begin DoDot:2
+15 DO ADD(.SEG,.SEGS)
+16 SET LAST=MSG("BATCH","CURRENT MESSAGE")
+17 FOR
if '$$HLNEXT^HLOMSG(.MSG,.SEG)
QUIT
DO ADD(.SEG,.SEGS)
End DoDot:2
if QUIT
QUIT
+18 IF MSG("DIRECTION")="OUT"
KILL SEG
SET SEG(1)="BTS"_$EXTRACT($GET(MSG("HDR",1)),4)_LAST
DO ADD(.SEG,.SEGS)
+19 ;
End DoDot:1
+20 IF '$TEST
Begin DoDot:1
+21 FOR
if '$$HLNEXT^HLOMSG(.MSG,.SEG)
QUIT
Begin DoDot:2
+22 DO ADD(.SEG,.SEGS)
End DoDot:2
if QUIT
QUIT
End DoDot:1
+23 SET SEGS("BOT")=VALMCNT
+24 QUIT
I() ;
+1 SET VALMCNT=VALMCNT+1
+2 QUIT VALMCNT
ADD(SEG,SEGS) ;
+1 NEW QUIT,I,J,LINE
+2 SET QUIT=0
+3 SET SEGS=$GET(SEGS)+1
+4 SET (I,J)=1
+5 SET LINE(1)=$EXTRACT(SEG(1),1,80)
SET SEG(1)=$EXTRACT(SEG(1),81,9999)
+6 IF SEG(1)=""
KILL SEG(1)
+7 DO SHIFT(.I,.J)
+8 SET @VALMAR@($$I,0)=LINE(1)
+9 ;; START 138
+10 DO CNTRL^VALM10(VALMCNT,1,3,IOINHI,IOINORM)
+11 ;;END 138
+12 SET SEGS(SEGS)=VALMCNT
+13 SET I=1
+14 FOR
SET I=$ORDER(LINE(I))
if 'I
QUIT
Begin DoDot:1
+15 SET @VALMAR@($$I,0)=LINE(I)
+16 ;;START 138
+17 ;D CNTRL^VALM10(VALMCNT,1,1,IORVON,IORVOFF)
+18 ;END 138
End DoDot:1
+19 QUIT
+20 ;
SHIFT(I,J) ;
+1 IF '$DATA(SEG(I))
SET I=$ORDER(SEG(0))
if 'I
QUIT
+2 IF $LENGTH(LINE(J))<80
Begin DoDot:1
+3 NEW LEN
+4 SET LEN=$LENGTH(LINE(J))
+5 SET LINE(J)=LINE(J)_$EXTRACT(SEG(I),1,80-LEN)
+6 SET SEG(I)=$EXTRACT(SEG(I),81-LEN,9999)
+7 IF SEG(I)=""
KILL SEG(I)
End DoDot:1
+8 IF '$TEST
Begin DoDot:1
+9 SET J=J+1
+10 SET LINE(J)=""
End DoDot:1
+11 DO SHIFT(.I,.J)
+12 QUIT
+13 ;
SCRLMODE ;scroll mode
+1 if '$LENGTH(HLRFRSH)
QUIT
+2 NEW QUIT,IOTM,IOBM,DX,DY,LINE,IOTM,IOBM
+3 WRITE !!,IOINHI,"Hit any key to escape scroll mode...",IOINORM
+4 SET IOTM=3
SET IOBM=23
+5 SET QUIT=0
+6 SET LINE=$SELECT(VALMCNT<17:1,1:17)
+7 WRITE @IOSTBM
+8 SET DX=1
SET DY=$SELECT(VALMCNT<17:VALMCNT+1,1:17)
XECUTE IOXY
+9 FOR I=1:1
Begin DoDot:1
+10 ;every 10 seconds refresh the data
+11 IF I>42
DO @HLRFRSH
SET I=0
+12 IF LINE+1>VALMCNT
Begin DoDot:2
+13 SET TEMP=$GET(@VALMAR@(LINE,0))
+14 WRITE !,IOUON,TEMP_$$SP(80-$LENGTH(TEMP)),IOUOFF
End DoDot:2
+15 IF '$TEST
WRITE !,$GET(@VALMAR@(LINE,0))
+16 SET LINE=LINE+1
+17 IF LINE>VALMCNT
SET LINE=1
+18 IF (I=22)!(I=43)
READ *C:5
IF $TEST
SET QUIT=1
QUIT
End DoDot:1
if QUIT
QUIT
+19 SET VALMBG=LINE-23
IF VALMBG<0
SET VALMBG=1
+20 SET VALMBCK="R"
+21 QUIT
HLP ;
+1 QUIT
+2 ;
IFOPEN(LINK,TIME) ;
+1 ;returns 1 if the link can be opened, otherwise 0
+2 ;
+3 ;Inputs:
+4 ; LINK - name of the link (required), optionally post-fixed with ":"_<port #>, will default to that defined for link
+5 ; TIME (optional) defaults to 15 seconds
+6 ;
+7 NEW LINKNAME,LINKARY,POP,IO,IOF,IOST,OPEN,PORT
+8 SET OPEN=0
+9 ;
+10 ;**P147 CJM adds TIME as an optional input parameter
+11 IF '$GET(TIME)
SET TIME=15
+12 ;**P147 CJM END
+13 ;
+14 SET LINKNAME=$PIECE(LINK,":")
+15 SET PORT=$PIECE(LINK,":",2)
+16 if LINKNAME=""
QUIT 0
+17 if '$$GETLINK^HLOTLNK(LINKNAME,.LINKARY)
QUIT 0
+18 if PORT
SET LINKARY("PORT")=PORT
+19 if '$GET(LINKARY("PORT"))
QUIT 0
+20 IF LINKARY("IP")=""
IF LINKARY("DOMAIN")=""
IF LINKARY("LLP")="TCP"
IF LINKARY("SERVER")
Begin DoDot:1
+21 NEW DATA
+22 SET LINKARY("DOMAIN")=$PIECE($GET(^HLD(779.1,1,0)),"^")
+23 if LINKARY("DOMAIN")=""
QUIT
+24 SET DATA(.08)=LINKARY("DOMAIN")
+25 if $$UPD^HLOASUB1(870,LINKARY("IEN"),.DATA)
QUIT
End DoDot:1
+26 if $GET(LINKARY("IP"))'=""
Begin DoDot:1
+27 DO CALL^%ZISTCP(LINKARY("IP"),LINKARY("PORT"),TIME)
+28 SET OPEN='POP
End DoDot:1
+29 IF 'OPEN
IF LINKARY("DOMAIN")'=""
IF $GET(^HLTMP("DNS LAST",LINKARY("IEN")))<$$DT^XLFDT
Begin DoDot:1
+30 NEW IP
+31 SET ^HLTMP("DNS LAST",LINKARY("IEN"))=$$DT^XLFDT
+32 SET IP=$$DNS^HLOTCP(LINKARY("DOMAIN"))
+33 IF IP'=""
IF IP'=LINKARY("IP")
Begin DoDot:2
+34 NEW DATA
+35 SET DATA(400.01)=IP
SET LINKARY("IP")=IP
+36 if $$UPD^HLOASUB1(870,LINKARY("IEN"),.DATA)
QUIT
+37 DO CALL^%ZISTCP(LINKARY("IP"),LINKARY("PORT"),TIME)
+38 SET OPEN='POP
End DoDot:2
End DoDot:1
+39 if OPEN
CLOSE IO
+40 ;D CLOSE^%ZISTCP
+41 QUIT OPEN