Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: LAXSYMHQ

LAXSYMHQ.m

Go to the documentation of this file.
  1. LAXSYMHQ ;MLD/ABBOTT/SLC/RAF - ABBOTT AxSYM 'HOST QUERY' PGM ; 6/12/96 0900; [ 01/12/98 11:20 AM ]
  1. ;;5.2;LA;**1001**;DEC 10, 1997
  1. ;;5.2;AUTOMATED LAB INSTRUMENTS;**11,19**;Sep 27, 1994
  1. ;
  1. Q ; call line tag
  1. ;
  1. HQSET ; Build hst qry to send to AxSYM (stored in ^LA(INST,"HQ",CNT) nodes)
  1. ; called from Q^LAXSYM
  1. N I,FRM,CR,ETX,CKSM,STX,LF,CNT,X,EOT,LATEST
  1. S X="ERR^LAXSYMHQ",@^%ZOSF("TRAP"),(LRTST,I)=0
  1. S CNT=0,LF=$C(10),STX=$C(2),ETX=$C(3),CR=$C(13),EOT=4
  1. ;
  1. ; LATEST array
  1. F S I=$O(^LAB(62.4,INST,3,I)) Q:'I S X=$G(^(I,0)) S LATEST(+X)=$P(X,U,4)
  1. L +^LA(INST,"HQ")
  1. F I="H","P","O","L" D ; loop thru frame types
  1. .S LRFRM=$G(LRFRM)+1 S:(LRFRM=8) LRFRM=0 ; increment frame cntr
  1. .S FRM=LRFRM_$S(I="H":$$H^LAXSYMBL,I="P":$$P^LAXSYMBL,I="O":$$O,1:$$L^LAXSYMBL)_CR_ETX
  1. .S CKSM=$$CKSUM^LAXSYMU(FRM) ; CR_ETX is counted in chksum
  1. .; build msg frame: <STX>~|~msg text~|~<CR><ETX>~checksum~<CR><LF>
  1. .S FRM=STX_FRM_CKSM_CR_LF
  1. .; set frame to ^LA(,"HQ" node
  1. .S CNT=$G(^LA(INST,"HQ"))+1,^LA(INST,"HQ")=CNT,^LA(INST,"TMPHQ",CNT)=FRM
  1. OUT I $G(HQBAD)=0 D ;positive query response sets
  1. .M ^LA(INST,"HQ")=^LA(INST,"TMPHQ")
  1. I $G(HQBAD)=1 D ;negative query response sets
  1. .S FRM=^LA(INST,"TMPHQ",3),FRM="2Q|"_$P(FRM,"|",2,12)_"|X"_CR_ETX
  1. .S ^LA(INST,"TMPHQ",2)=STX_FRM_$$CKSUM^LAXSYMU(FRM)_CR_LF
  1. .S FRM=^LA(INST,"TMPHQ",4),FRM="3L|1"_CR_ETX
  1. .S ^LA(INST,"TMPHQ",3)=STX_FRM_$$CKSUM^LAXSYMU(FRM)_CR_LF
  1. .S ^LA(INST,"HQ")=3 K ^LA(INST,"TMPHQ",4)
  1. .M ^LA(INST,"HQ")=^LA(INST,"TMPHQ")
  1. K ^LA(INST,"TMPHQ")
  1. L -^LA(INST,"HQ")
  1. QUIT
  1. ;
  1. O() ; Build Order frame NOTEs:
  1. ; a. 10 chars is size limit for rev 1.xx 15 will be limit for rev 2
  1. ; b. Potential for REPEAT (multiple) tests to cause the Order frame to
  1. ; exceed 247 chars! However, if the AxSYM doesn't offer more than
  1. ; about 25 tests, this should not be a problem.
  1. ;
  1. Q:$G(BAD) IN ; cannot process request - set in Q^LAXSYM
  1. N O,CNT,DLM,PRI,LRPRI,LRTEST,LRTST
  1. S (CNT,PRI,LRTEST,HQBAD)=0,LRPRI=9,$P(O,D,5)=""
  1. F S LRTEST=$O(^LRO(68,WL,1,LADT,1,+LRAN,4,LRTEST)) Q:'LRTEST D
  1. .Q:$L($P(^LRO(68,WL,1,LADT,1,+LRAN,4,LRTEST,0),U,5))
  1. .S CNT=CNT+1 S DLM=$S(CNT>1:"\",1:"")
  1. .S LRTST=$$PNL^LAXSYMBL ; get AxSYM's internal tst #
  1. .S:LRTST="" CNT=CNT-1
  1. .Q:LRTST="" ; test not in Auto Inst file
  1. .S $P(O,D,5)=$P(O,D,5)_DLM_"^^^"_LRTST ; 'repeat' tests use '\'
  1. .S PRI=+$P($G(^LRO(68,WL,1,LADT,1,+LRAN,4,LRTEST,0)),U,2)
  1. .I PRI,(PRI<LRPRI) S LRPRI=PRI ; take 'highest' prio
  1. ;
  1. ; If no orders can be found, return orig query with 'X'
  1. I $P(O,D,5)="" S $P(IN,D,13)="X",HQBAD=1 Q IN
  1. ;
  1. S LRPRI=$E($P($G(^LAB(62.05,LRPRI,0)),U)) S:LRPRI="" LRPRI="R"
  1. ; 2nd pc is (hardcoded) # of 'O' frames. Change if loop is needed
  1. S $P(O,D,1,3)="O|1|"_LRAN
  1. S $P(O,D,6)=LRPRI,$P(O,D,12)="A",$P(O,D,26)="Q"
  1. Q O
  1. ;
  1. ERR ; Error Trap
  1. D ^LABERR
  1. K ^LA(INST,"HQ") ; remove bad data/incomplete list
  1. G OUT