source: FOIAVistA/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLCSIN.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 5.5 KB
Line 
1HLCSIN ;ALB/JRP - INCOMING FILER;01-MAY-95 ;10/17/2007 14:58
2 ;;1.6;HEALTH LEVEL SEVEN;**2,30,14,19,62,109,115,122**;Oct 13, 1995;Build 14
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4STARTIN ;Main entry point for incoming background filer
5 ;Create/find entry denoting this filer in the INCOMING FILER TASK
6 ; NUMBER multiple (field #20) of the HL COMMUNICATION SERVER PARAMETER
7 ; file (#869.3)
8 N HLFLG,HLEXIT,HLPTRFLR
9 ;
10 ; patch HL*1.6*122
11 ;; N HLDUZ,DUZ ; patch HL*1.6*122 TEST v2: DUZ code removed
12 N HLDUZ
13 S HLDUZ=+$G(DUZ)
14 ;
15 S HLPTRFLR=+$$CRTFLR^HLCSUTL1(ZTSK,"IN")
16 ;Loop through Logical Links and check for incoming messages
17 S HLEXIT=0
18 ; patch HL*1.6*122 TEST v2: DUZ code removed
19 ; patch HL*1.6*122, set DUZ for application proxy user
20 ;; D PROXY^HLCSTCP4
21 S HLPTRFLR("$J")=$J
22 F D Q:HLEXIT
23 . S HLFLG=0
24 . D DEFACK(.HLPTRFLR,.HLFLG,.HLEXIT) Q:HLEXIT
25 . D ACKNOW(.HLPTRFLR,.HLFLG,.HLEXIT) Q:HLEXIT
26 . Q:HLFLG
27 . I $$HDIFF^XLFDT($H,$G(HLPTRFLR("LASTDEL")),2)>3600 D Q
28 . . S HLPTRFLR("LASTDEL")=$H ; maintain queue sizes
29 . . D DELQUE(.HLPTRFLR,.HLEXIT) ; no more than once an hour.
30 . ; patch HL*1.6*122
31 . ; H 5
32 . H 1
33 . D CHKUPD(.HLPTRFLR,.HLEXIT) Q:HLEXIT
34 S ZTSTOP=1 ;Asked to stop
35 D DELFLR^HLCSUTL1(HLPTRFLR,"IN") ;Delete entry denoting this filer
36 S ZTREQ="@"
37 Q
38DEFACK(HLPTRFLR,HLFLG,HLEXIT) ; Process TCP links with a deferred response
39 N HLXX,HLD0,HLPCT
40 S HLXX=0
41 F S HLXX=$O(^HLMA("AC","I",HLXX)) Q:'HLXX D Q:HLEXIT
42 . ; HL*1.6*122, check the in-queue stop flag
43 . Q:$P($G(^HLCS(870,HLXX,0)),"^",9)
44 . D CHKUPD(.HLPTRFLR,.HLEXIT) Q:HLEXIT
45 . ; patch HL*1.6*109: Does another filer have this?
46 . ; L +^HLMA("AC","I",HLXX):0 Q:'$T
47 . L +^HLMA("AC","I",HLXX):2 Q:'$T ; patch HL*1.6*122
48 . S HLD0=0,HLFLG=1
49 . ; HL*1.6*109 changes in for loop below, and post-quit code placed
50 . ; on following lines.
51 . S HLPCT=0 ; Counter whether filer should stop every 100th entry.
52 .;**109 - insure queue last processed at least 2 seconds ago
53 . I ($$HDIFF^XLFDT($H,$G(^XTMP("HL7-AC","I",HLXX)),2)<2) L -^HLMA("AC","I",HLXX) Q
54 . F S HLD0=$O(^HLMA("AC","I",HLXX,HLD0)) Q:'HLD0!(HLEXIT) D
55 .. ; patch HL*1.6*122 start
56 .. ; patch HL*1.6*122 TEST v2: DUZ code removed
57 .. ; DUZ comparison/reset for application proxy user
58 .. ;; D HLDUZ^HLCSTCP4
59 .. D HLDUZ2^HLCSTCP4
60 .. ; protect HLDUZ
61 .. N HLDUZ
62 .. S HLPCT=HLPCT+1
63 .. I '(HLPCT#100) D CHKUPD(.HLPTRFLR,.HLEXIT) Q:HLEXIT
64 .. ; L +^HLMA(HLD0):0 Q:'$T
65 .. F L +^HLMA(HLD0):30 Q:$T H 1
66 .. I '$$CHECKAC("I",HLXX,HLD0) L -^HLMA(HLD0) Q ;-> Quit if not a valid AC xref
67 .. D DEFACK^HLTP3(HLXX,HLD0)
68 .. D DEQUE^HLCSREP(HLXX,"I",HLD0)
69 .. L -^HLMA(HLD0)
70 . ; patch HL*1.6*122 end
71 . ;**109 -add dt/tm stamp to time queue last processed
72 . S ^XTMP("HL7-AC","I",HLXX)=$H
73 . ;**109 -unlock the queue
74 . L -^HLMA("AC","I",HLXX)
75 Q
76 ;
77CHECKAC(WAY,IEN870,IEN773) ; If AC xref shouldn't exist, kill it...
78 ;
79 ; Check status and if 3 (processed) kill XREF...
80 I $P($G(^HLMA(+IEN773,"P")),U)=3 D QUIT "" ;->
81 . D DEQUE^HLCSREP(IEN870,WAY,IEN773)
82 ;
83 ; Add other checks here in the future...
84 ;
85 Q 1
86 ;
87ACKNOW(HLPTRFLR,HLFLG,HLEXIT) ; Process Logical Link's IN-queue for received message
88 N HLXX,HLD0,HLD1
89 S HLXX=0
90 F S HLXX=$O(^HLCS(870,"AISTAT","P",HLXX)) Q:'HLXX D Q:HLEXIT
91 . ; HL*1.6*122, check the in-queue stop flag
92 . Q:$P($G(^HLCS(870,HLXX,0)),"^",9)
93 . D CHKUPD(.HLPTRFLR,.HLEXIT) Q:HLEXIT
94 . ; HL*1.6*109: Does another filer have this?
95 . ; L +^HLCS(870,HLXX,"INFILER"):0 Q:'$T
96 . L +^HLCS(870,HLXX,"INFILER"):2 Q:'$T ; patch HL*1.6*122
97 . F D CHKUPD(.HLPTRFLR,.HLEXIT) Q:HLEXIT S HLD0=$$DEQUEUE^HLCSQUE(HLXX,"IN") Q:+HLD0<0 D
98 .. ;
99 .. ; patch HL*1.6*122 start
100 .. ; clean variables except Kernel related variables
101 .. D
102 ... ; protect variables defined in STARTIN^HLCSIN
103 ... N HLFLG,HLEXIT,HLPTRFLR
104 ... N HLDUZ
105 ... ; protect variables defined in ACKNOW^HLCSIN
106 ... N HLXX,HLD0,HLD1
107 ... D KILL^XUSCLEAN
108 .. ;
109 .. ; patch HL*1.6*122 TEST v2: DUZ code removed
110 .. ; DUZ comparison/reset for application proxy user
111 .. ;; D HLDUZ^HLCSTCP4
112 .. D HLDUZ2^HLCSTCP4
113 .. ; protect HLDUZ
114 .. N HLDUZ
115 .. ;Make sure message is ready to be received
116 .. S HLFLG=1
117 .. S HLD1=$P(HLD0,"^",2)
118 .. S HLD0=+HLD0 ; At this point, HLD0=HLXX
119 .. I $P($G(^HLCS(870,HLD0,1,HLD1,0)),"^",3)'="A" D Q
120 ... D MONITOR^HLCSDR2("D",2,HLD0,HLD1,"IN") ;Set status to DONE
121 .. D RECEIVE^HLMA0(HLD0,HLD1) ;Process received message
122 .. D MONITOR^HLCSDR2("D",2,HLD0,HLD1,"IN") ;Set status to DONE
123 . ; patch HL*1.6*122 end
124 . I HLD0<0,$D(^HLCS(870,"AISTAT","P",HLXX)) D
125 . . S HLD1=0 ; Make sure there aren't any loose xrefs hanging around.
126 . . F S HLD1=$O(^HLCS(870,"AISTAT","P",HLXX,HLD1)) Q:'HLD1 D
127 . . . ;I '$D(^HLCS(870,HLXX,1,HLD1,0)) K ^HLCS(870,"AISTAT","P",HLXX,HLD1)
128 . . . I $P($G(^HLCS(870,HLXX,1,HLD1,0)),U,2)'="P" K ^HLCS(870,"AISTAT","P",HLXX,HLD1)
129 . L -^HLCS(870,HLXX,"INFILER")
130 Q
131DELQUE(HLPTRFLR,HLEXIT) ; Delete messages outside the 'queue size' window.
132 N HLDIR,HLXX,HLFRONT
133 S HLDIR=1,HLXX=0
134 F S HLXX=$O(^HLCS(870,HLXX)) Q:'HLXX D Q:HLEXIT
135 . D CHKUPD(.HLPTRFLR,.HLEXIT) Q:HLEXIT
136 . ; patch HL*1.6*122, comment out, no need to lock
137 . ; L +^HLCS(870,HLXX,"IN QUEUE FRONT POINTER"):0 Q:'$T
138 . S HLFRONT=$G(^HLCS(870,HLXX,"IN QUEUE FRONT POINTER"))
139 . ; patch HL*1.6*122, comment out
140 . ; L -^HLCS(870,HLXX,"IN QUEUE FRONT POINTER")
141 . D DELETE^HLCSQUE1(HLXX,HLDIR,HLFRONT)
142 Q
143CHKUPD(HLPTRFLR,HLEXIT) ;
144 Q:$$HDIFF^XLFDT($H,$G(HLPTRFLR("LASTUP")),2)<15
145 D SETFLRDH^HLCSUTL1(HLPTRFLR,"IN") ; Update LAST KNOWN $H (field #.03) for filer
146 S HLPTRFLR("LASTUP")=$H
147 D CHK4STOP^HLCSUTL2(HLPTRFLR,"IN",.HLEXIT) Q:HLEXIT
148 Q
Note: See TracBrowser for help on using the repository browser.