source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLCSMON.m@ 1046

Last change on this file since 1046 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 7.3 KB
Line 
1HLCSMON ;SF-DISPLAY DRIVER PROGRAM ;07/10/2000 12:18
2 ;;1.6;HEALTH LEVEL SEVEN;**34,40,48,49,65,66,73,109**;Oct 13, 1995
3 ;
4 ;This Program drives a real-time display monitor for the HL7
5 ;Package. All the data used by this display is stored in file
6 ;# 870. Several callable entry points were broken
7 ;out of this routine and placed into HLCSMON1
8 ;
9 ;This routine has no required input parameters other than require that
10 ;U be defined, it does not instantiate any parameters either.
11 ;
12 ;
13 ;HLARY=array of all,HLARYD=array of display,HLARYO=array of old values
14 ;HLPTR1=top of display,HLPTR2=bottom of display,HLPTR3=last in HLVARY
15INIT N HLARY,HLARYD,HLARYO,HLCOFF,HLCON,HLDISP,HLPTR1,HLPTR2,HLPTR3,HLRESP
16 N HLDEV,HLERR,HLEVL,HLHDR,HLNODE,HLOCK
17 N HLPARAM,HLPROC,HLPROD,HLSEND,HLSENT,HLSITE
18 N HLI,HLREC,HLRUNCNT,HLSTAT,HLTMSTAT,HLLMSTAT,HLVIEW,HLXX,HLYY,X,Y,DX,DY
19 ;
20 D ^HLCSTERM ;Sets up variables to control display attributes
21INIT1 ;
22 ; Next 4 lines copied here from top of START by patch 73...
23 ;HLRUNCNT=number of in filers^out filers, HLDISP=display mode
24 S HLRUNCNT="-1^-1",HLPTR1=1 S:'$D(HLDISP) HLDISP="S"
25 D BUILDARY ;Build an array for display
26 QUIT:$$LOCKED(.HLOCK) ;-> Anything locked?
27 ;
28 W HLCOFF ;Shut Cursor off
29 D HEADER^HLCSTERM ;Write header
30 D WDATA^HLCSMON1(5,17,"","","Incoming filers running => ")
31 D WDATA^HLCSMON1(5,18,"","","Outgoing filers running => ")
32 D WDATA^HLCSMON1(5,20,"","","Select a Command:")
33 D WDATA^HLCSMON1(1,21,"","","(N)EXT (B)ACKUP (A)LL LINKS (S)CREENED (V)IEWS (Q)UIT (?) HELP: ")
34 ;HLRUNCNT=number of in filers^out filers, HLDISP=display mode
35 S HLRUNCNT="-1^-1",HLPTR1=1 S:'$D(HLDISP) HLDISP="S"
36START ;
37 D BUILDARY ;Build an array for display
38 D DISPLAY^HLCSMON1 ;Display the array just built
39 D READ
40 ;HLRESP=user response
41 I '$L(HLRESP) G START
42 G:HLRESP="Q" EXIT
43 ;any of following commands, kill old values
44 K HLARYO,HLTMSTAT,HLLMSTAT
45 I HLRESP="?" D HELP G INIT1
46 I HLRESP="V" D VIEW G INIT1
47 I "AS"[HLRESP K HLARY,HLEVL S HLDISP=HLRESP G INIT1
48 I "NB"[HLRESP D NEXT
49 G START
50 ;
51READ ;Prompt the user for the next action
52 D WDATA^HLCSMON1(71,21,"","","",1)
53 W HLCON
54 R X#1:3
55 W HLCOFF
56 S HLRESP=$S(X="":X,"Qq^"[X:"Q","Bb"[X:"B","Nn"[X:"N","Aa"[X:"A","Vv"[X:"V",X="?":"?","Ss"[X:"S",1:"")
57 Q
58 ;
59VIEW ;select new view
60 W HLCON,!!
61 N DIC
62 S DIC="^HLCS(869.3,1,6,",DIC(0)="QEA"
63 D ^DIC Q:Y<0
64 S HLVIEW=+Y,HLDISP="V"
65 W HLCOFF
66 Q
67 ;
68NEXT ;
69 ;Next page
70 I HLRESP="N" D
71 . ;no more
72 . I HLPTR2=HLPTR3 D EOB Q
73 . S Y=HLPTR2+10,HLEVL(HLPTR1)=""
74 . ;exceed list, get last 10
75 . I Y>HLPTR3 S HLPTR2=HLPTR3,HLPTR1=HLPTR2-9 Q
76 . S HLPTR1=HLPTR2,HLPTR2=Y
77 ;
78 ;Backup a page
79 I HLRESP="B" D
80 . ;top of list
81 . I HLPTR1=1 D EOB Q
82 . I HLDISP="S" S HLPTR1=$O(HLEVL(HLPTR1),-1) Q
83 . S Y=HLPTR1-9
84 . ;can't go back 10, reset to top
85 . I Y'>0 S HLPTR1=1,HLPTR2=10 Q
86 . S HLPTR2=HLPTR1,HLPTR1=Y
87 ;
88 ;Erase what might be displayed on line 22
89 D WDATA^HLCSMON1(1,22,IOELALL,"","")
90 Q
91EOB D WDATA^HLCSMON1(5,22,IORVON,IORVOFF,"CANNOT "_$S(HLRESP="N":"ADVANCE",1:"BACKUP")_" BEYOND END OF BUFFER")
92 W $C(7) H 2
93 Q
94 ;
95BUILDARY ;
96 K HLARYD
97 ;
98 ;if view is defined, get links
99 I $G(HLVIEW) D S HLVIEW=0,HLDISP="V"
100 . N HLTMP
101 . K HLARY,HLEVL S HLI=0
102 . F S HLI=$O(^HLCS(869.3,1,6,HLVIEW,1,HLI)) Q:'HLI S HLYY=+$P($G(^(HLI,0)),U,2) D
103 .. S Y=$P($G(^HLCS(870,HLI,0)),U) Q:Y=""
104 .. ;build array by DISPLAY ORDER and then by NAME
105 .. I HLYY S HLTMP(HLYY,HLI)="" Q
106 .. S HLTMP(Y,HLI)=""
107 . S (HLI,HLYY)=0
108 . ;rebuild array to put in proper order
109 . F S HLI=$O(HLTMP(HLI)),HLXX=0 Q:HLI="" D
110 .. F S HLXX=$O(HLTMP(HLI,HLXX)) Q:'HLXX S HLYY=HLYY+1,HLARY(HLYY,HLXX)=""
111 . S HLPTR3=HLYY
112 ;
113 I '$D(HLARY) S HLYY=0,HLXX="" D
114 . ;build array in alphabetical order
115 . F S HLXX=$O(^HLCS(870,"B",HLXX)) Q:HLXX="" S Y=$O(^(HLXX,0)),HLYY=HLYY+1,HLARY(HLYY,Y)=""
116 . S HLPTR3=HLYY
117 ;
118 S HLI=HLPTR1,HLYY=6 ;HLYY=6TH Line of display
119 ;HLARYD(6) through HLARYD(15) with 6 through 15 also representing line
120 ;numbers on the display
121 F HLI=HLI:1 S HLXX=$O(HLARY(HLI,0)) Q:HLYY=16!'HLXX D COPY
122 S HLPTR2=HLI-1
123 ;Set all HLARY elements not defined on this pass to null
124 F HLYY=HLYY:1:15 S HLARYD(HLYY)=""
125 Q
126COPY ;
127 Q:'$D(^HLCS(870,HLXX))
128 ;
129 ;These lock tags lock nodes in the global so that the screen is
130 ;refreshed in real-time. The lock forces the buffer to be refreshed,
131 ;so that the display is up to date.
132 ;
133 ;**109**
134 ;L +^HLCS(870,HLXX,0):0 L -^HLCS(870,HLXX,0) D CHKLOCK
135 ;
136 ; Set, even if not able to lock...
137 S Y=$G(^HLCS(870,HLXX,0))
138 ;
139 ;name^rec^proc^send^sent^device^state^error
140 S HLARYD(HLYY)=$P(Y,U)_"^^^^^"_$P(Y,U,4)_"^"_$P(Y,U,5)_"^"_$P(Y,U,19)
141 ;
142 ;**109**
143 ;L +^HLCS(870,HLXX,"IN QUEUE BACK POINTER"):0 D CHKLOCK
144 ;L -^HLCS(870,HLXX,"IN QUEUE BACK POINTER")
145 ;
146 S $P(HLARYD(HLYY),U,2)=$G(^HLCS(870,HLXX,"IN QUEUE BACK POINTER"))
147 ;
148 ;**109**
149 ;L +^HLCS(870,HLXX,"IN QUEUE FRONT POINTER"):0 D CHKLOCK
150 ;L -^HLCS(870,HLXX,"IN QUEUE FRONT POINTER")
151 ;
152 S $P(HLARYD(HLYY),U,3)=$G(^HLCS(870,HLXX,"IN QUEUE FRONT POINTER"))
153 ;
154 ;**109**
155 ;L +^HLCS(870,HLXX,"OUT QUEUE BACK POINTER"):0 D CHKLOCK
156 ;L -^HLCS(870,HLXX,"OUT QUEUE BACK POINTER")
157 ;
158 S $P(HLARYD(HLYY),U,4)=$G(^HLCS(870,HLXX,"OUT QUEUE BACK POINTER"))
159 ;
160 ;**109**
161 ;L +^HLCS(870,HLXX,"OUT QUEUE FRONT POINTER"):0 D CHKLOCK
162 ;L -^HLCS(870,HLXX,"OUT QUEUE FRONT POINTER")
163 ;
164 S $P(HLARYD(HLYY),U,5)=$G(^HLCS(870,HLXX,"OUT QUEUE FRONT POINTER"))
165 ;
166 S X=HLARYD(HLYY),Y=$P(X,U,2)+$P(X,U,3)+$P(X,U,4)+$P(X,U,5)
167 ;if Select and the Y=0, nothing to report
168 I 'Y,HLDISP="S" S HLARYD(HLYY)="" Q
169 S HLYY=HLYY+1
170 Q
171 ;
172CHKLOCK ; Call here immediately after trying to lock. And, BE SURE that
173 ; nothing might occur that would change $T after the lock attempt!!
174 ; $T,HLXX -- req
175 N NM870
176 QUIT:$T ;-> Lock obtained...
177 S NM870=$P($G(^HLCS(870,+HLXX,0)),U)
178 S NM870=$S(NM870]"":NM870_" (IEN #"_HLXX_")",1:"IEN #"_HLXX)
179 S HLOCK(NM870)=""
180 QUIT
181 ;
182HELP ;
183 W HLCON,@IOF
184 W !,"You have the following options when monitoring the Messaging System:"
185 W !,"Enter the command letter parentheses: N,B,Q,A,S,V or ?"
186 W !!,"(N) takes you to the next page of the display of Logical Links."
187 W !!,"(B) takes you back one page."
188 W !!,"(Q) terminates the monitor."
189 W !!,"(A) provides a display of all links defined on your system."
190 W !!,"(S) displays only those links that have had message traffic."
191 W !!,"(V) prompts for a view name and displays links defined in view."
192 W !!," Note that (S) is the default display at startup."
193 W !!,"**PRESS <RET> TO CONTINUE**"
194 R X:DTIME
195 W @IOF
196 W !,?25,"Device Types and corresponding prefixes:"
197 W !!,?30,"PC -- Persistent TCP/IP Client"
198 W !!,?30,"NC -- Non-Persistent TCP/IP Client"
199 W !!,?30,"SS -- Single-threaded TCP/IP Server"
200 W !!,?30,"MS -- Multi-threaded TCP/IP Server"
201 W !!,?30,"SH -- Serial HLLP"
202 W !!,?30,"SX -- Serial X3.28"
203 W !!,?30,"MM -- MailMan"
204 W !!,"**PRESS <RET> TO CONTINUE**"
205 R X:DTIME
206 W HLCOFF
207 Q
208EXIT ;
209 ;Turn Cursor back on
210 W HLCON
211 D KVAR^HLCSTERM
212 Q
213 ;
214LOCKED(HLOCK) ; Anything locked?
215 ;
216 ;
217 ; Nothing locked...
218 I '$D(HLOCK) QUIT "" ;->
219 ;
220 W !!,"Editing of logical link data is occurring right now. For this reason, some of"
221 W !,"the information on the 'System Link Monitor' report might not be accurate for"
222 W !,"the following node(s)..."
223 W !
224 ;
225 S HLOCK=""
226 F S HLOCK=$O(HLOCK(HLOCK)) Q:HLOCK']"" D
227 . W !,?5,HLOCK
228 ;
229 S ACTION=$$BTE("Press RETURN to print report or '^' to exit... ",1)
230 ;
231 QUIT $S(ACTION=1:1,1:"")
232 ;
233BTE(PMT,FF) ;
234 N DIR,DIRUT,DTOUT,DUOUT,X,Y
235 F X=1:1:$G(FF) W !
236 S DIR(0)="EA",DIR("A")=PMT
237 D ^DIR
238 QUIT $S(Y=1:"",1:1)
239 ;
Note: See TracBrowser for help on using the repository browser.