source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLOQUE.m@ 1073

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

revised back to 6/30/08 version

File size: 3.0 KB
Line 
1HLOQUE ;ALB/CJM- HL7 QUEUE MANAGEMENT - 10/4/94 1pm ;01/05/2007
2 ;;1.6;HEALTH LEVEL SEVEN;**126,132,134**;Oct 13, 1995;Build 30
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5INQUE(FROM,QNAME,IEN778,ACTION,PURGE) ;
6 ;Will place the message=IEN778 on the IN queue, incoming
7 ;Input:
8 ; FROM - sending facility from message header.
9 ; For actions other than incoming messages, its the specified link.
10 ; QNAME - queue named by the application
11 ; IEN778 = ien of the message in file 778
12 ; ACTION - <tag^routine> that should be executed for the application
13 ; PURGE (optional) - PURGE=1 indicates that the purge dt/tm needs to be set by the infiler
14 ; If PURGE("ACKTOIEN") is set, it indicates that the purge dt/tm of
15 ; the original message to this application ack also needs to be set.
16 ;Output: none
17 ;
18 I $G(FROM)="" S FROM="UNKNOWN"
19 I '$L($G(QNAME)) S QNAME="DEFAULT"
20 S ^HLB("QUEUE","IN",FROM,QNAME,IEN778)=ACTION_"^"_$G(PURGE)_"^"_$G(PURGE("ACKTOIEN"))
21 I $$INC^HLOSITE($NA(^HLC("QUEUECOUNT","IN",FROM,QNAME)))
22 Q
23 ;
24OUTQUE(LINKNAME,PORT,QNAME,IEN778) ;
25 ;Will place the message=IEN778 on the out-going queue
26 ;Input:
27 ; LINKNAME = name of (.01) the logical link
28 ; PORT (optional) the port to connect to
29 ; QNAME - queue named by the application
30 ; IEN778 = ien of the message in file 778
31 ;Output: none
32 ;
33 N SUB
34 S SUB=LINKNAME
35 I PORT S SUB=SUB_":"_PORT
36 I '$L($G(QNAME)) S QNAME="DEFAULT"
37 S ^HLB("QUEUE","OUT",SUB,QNAME,IEN778)=""
38 I $$INC^HLOSITE($NA(^HLC("QUEUECOUNT","OUT",SUB,QNAME)))
39 Q
40 ;
41DEQUE(FROMORTO,QNAME,DIR,IEN778) ;
42 ;This routine will remove the message=IEN778 from its queue
43 ;Input:
44 ; DIR = "IN" or "OUT", denoting the direction that the message is going in
45 ; FROMORTO = for outgoing: the .01 field of the logical link
46 ; for incoming: sending facility
47 ; IEN778 = ien of the message in file 778
48 ;Output: none
49 ;
50 Q:(FROMORTO="")
51 I ($G(QNAME)="") S QNAME="DEFAULT"
52 D
53 .I $E(DIR)="I" S DIR="IN" Q
54 .I $E(DIR)="O" S DIR="OUT" Q
55 I DIR'="IN",DIR'="OUT" Q
56 Q:'$G(IEN778)
57 D:$D(^HLB("QUEUE",DIR,FROMORTO,QNAME,IEN778))
58 .K ^HLB("QUEUE",DIR,FROMORTO,QNAME,IEN778)
59 .;don't let the count become negative
60 .I $$INC^HLOSITE($NA(^HLC("QUEUECOUNT",DIR,FROMORTO,QNAME)),-1)<0,$$INC^HLOSITE($NA(^HLC("QUEUECOUNT",DIR,FROMORTO,QNAME)))
61 Q
62 ;
63STOPQUE(DIR,QUEUE) ;
64 ;This API is used to set a stop flag on a named queue.
65 ;DIR=<"IN" or "OUT">
66 ;QUEUE - the name of the queue to be stopped
67 ;
68 Q:$G(DIR)=""
69 Q:$G(QUEUE)=""
70 S ^HLTMP("STOPPED QUEUES",DIR,QUEUE)=1
71 Q
72STARTQUE(DIR,QUEUE) ;
73 ;This API is used to REMOVE the stop flag on a named queue.
74 ;DIR=<"IN" or "OUT">
75 ;QUEUE - the name of the queue to be stopped
76 ;
77 Q:$G(DIR)=""
78 Q:$G(QUEUE)=""
79 K ^HLTMP("STOPPED QUEUES",DIR,QUEUE)
80 Q
81STOPPED(DIR,QUEUE) ;
82 ;This API is used to DETERMINE if the stop flag on a named queue is set.
83 ;Input:
84 ; DIR=<"IN" or "OUT">
85 ; QUEUE - the name of the queue to be checked
86 ;Output:
87 ; Function returns 1 if the queue is stopped, 0 otherwise
88 Q:$G(DIR)="" 0
89 Q:$G(QUEUE)="" 0
90 I $G(^HLTMP("STOPPED QUEUES",DIR,QUEUE)) Q 1
91 Q 0
Note: See TracBrowser for help on using the repository browser.