source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LAXSYMHQ.m@ 635

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

initial load of FOIAVistA 6/30/08 version

File size: 2.7 KB
Line 
1LAXSYMHQ ;MLD/ABBOTT/SLC/RAF - ABBOTT AxSYM 'HOST QUERY' PGM ; 6/12/96 0900;
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**11,19**;Sep 27, 1994
3 ;
4 Q ; call line tag
5 ;
6HQSET ; Build hst qry to send to AxSYM (stored in ^LA(INST,"HQ",CNT) nodes)
7 ; called from Q^LAXSYM
8 N I,FRM,CR,ETX,CKSM,STX,LF,CNT,X,EOT,LATEST
9 S X="ERR^LAXSYMHQ",@^%ZOSF("TRAP"),(LRTST,I)=0
10 S CNT=0,LF=$C(10),STX=$C(2),ETX=$C(3),CR=$C(13),EOT=4
11 ;
12 ; LATEST array
13 F S I=$O(^LAB(62.4,INST,3,I)) Q:'I S X=$G(^(I,0)) S LATEST(+X)=$P(X,U,4)
14 L +^LA(INST,"HQ")
15 F I="H","P","O","L" D ; loop thru frame types
16 .S LRFRM=$G(LRFRM)+1 S:(LRFRM=8) LRFRM=0 ; increment frame cntr
17 .S FRM=LRFRM_$S(I="H":$$H^LAXSYMBL,I="P":$$P^LAXSYMBL,I="O":$$O,1:$$L^LAXSYMBL)_CR_ETX
18 .S CKSM=$$CKSUM^LAXSYMU(FRM) ; CR_ETX is counted in chksum
19 .; build msg frame: <STX>~|~msg text~|~<CR><ETX>~checksum~<CR><LF>
20 .S FRM=STX_FRM_CKSM_CR_LF
21 .; set frame to ^LA(,"HQ" node
22 .S CNT=$G(^LA(INST,"HQ"))+1,^LA(INST,"HQ")=CNT,^LA(INST,"TMPHQ",CNT)=FRM
23OUT I $G(HQBAD)=0 D ;positive query response sets
24 .M ^LA(INST,"HQ")=^LA(INST,"TMPHQ")
25 I $G(HQBAD)=1 D ;negative query response sets
26 .S FRM=^LA(INST,"TMPHQ",3),FRM="2Q|"_$P(FRM,"|",2,12)_"|X"_CR_ETX
27 .S ^LA(INST,"TMPHQ",2)=STX_FRM_$$CKSUM^LAXSYMU(FRM)_CR_LF
28 .S FRM=^LA(INST,"TMPHQ",4),FRM="3L|1"_CR_ETX
29 .S ^LA(INST,"TMPHQ",3)=STX_FRM_$$CKSUM^LAXSYMU(FRM)_CR_LF
30 .S ^LA(INST,"HQ")=3 K ^LA(INST,"TMPHQ",4)
31 .M ^LA(INST,"HQ")=^LA(INST,"TMPHQ")
32 K ^LA(INST,"TMPHQ")
33 L -^LA(INST,"HQ")
34 QUIT
35 ;
36O() ; Build Order frame NOTEs:
37 ; a. 10 chars is size limit for rev 1.xx 15 will be limit for rev 2
38 ; b. Potential for REPEAT (multiple) tests to cause the Order frame to
39 ; exceed 247 chars! However, if the AxSYM doesn't offer more than
40 ; about 25 tests, this should not be a problem.
41 ;
42 Q:$G(BAD) IN ; cannot process request - set in Q^LAXSYM
43 N O,CNT,DLM,PRI,LRPRI,LRTEST,LRTST
44 S (CNT,PRI,LRTEST,HQBAD)=0,LRPRI=9,$P(O,D,5)=""
45 F S LRTEST=$O(^LRO(68,WL,1,LADT,1,+LRAN,4,LRTEST)) Q:'LRTEST D
46 .Q:$L($P(^LRO(68,WL,1,LADT,1,+LRAN,4,LRTEST,0),U,5))
47 .S CNT=CNT+1 S DLM=$S(CNT>1:"\",1:"")
48 .S LRTST=$$PNL^LAXSYMBL ; get AxSYM's internal tst #
49 .S:LRTST="" CNT=CNT-1
50 .Q:LRTST="" ; test not in Auto Inst file
51 .S $P(O,D,5)=$P(O,D,5)_DLM_"^^^"_LRTST ; 'repeat' tests use '\'
52 .S PRI=+$P($G(^LRO(68,WL,1,LADT,1,+LRAN,4,LRTEST,0)),U,2)
53 .I PRI,(PRI<LRPRI) S LRPRI=PRI ; take 'highest' prio
54 ;
55 ; If no orders can be found, return orig query with 'X'
56 I $P(O,D,5)="" S $P(IN,D,13)="X",HQBAD=1 Q IN
57 ;
58 S LRPRI=$E($P($G(^LAB(62.05,LRPRI,0)),U)) S:LRPRI="" LRPRI="R"
59 ; 2nd pc is (hardcoded) # of 'O' frames. Change if loop is needed
60 S $P(O,D,1,3)="O|1|"_LRAN
61 S $P(O,D,6)=LRPRI,$P(O,D,12)="A",$P(O,D,26)="Q"
62 Q O
63 ;
64ERR ; Error Trap
65 D ^LABERR
66 K ^LA(INST,"HQ") ; remove bad data/incomplete list
67 G OUT
Note: See TracBrowser for help on using the repository browser.