PSS32P3 ;BIR/LDT - API FOR INFORMATION FROM FILE 9009032.3; 5 Sep 03
;;1.0;PHARMACY DATA MANAGEMENT;**85**;9/30/97
;
ALL(PSSIEN,PSSFT,LIST) ;
;PSSIEN - IEN of entry in 9009032.3.
;PSSFT - Free Text TYPE in 9009032.3.
;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
;Field Number of the data piece being returned.
;Returns TYPE field (#.01) of APSP INTERVENTION TYPE file (#9009032.3).
N DIERR,ZZERR,PSS32P3,PSS
I $G(LIST)']"" Q
K ^TMP($J,LIST)
I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
I $G(PSSIEN)]"",+$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(9009032.3,"","A","`"_PSSIEN,,,"") D
.I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
.S ^TMP($J,LIST,0)=1
.D GETS^DIQ(9009032.3,+PSSIEN2,".01","I","PSS32P3") S PSS(1)=0
.F S PSS(1)=$O(PSS32P3(9009032.3,PSS(1))) Q:'PSS(1) D SETALL
I $G(PSSIEN)="",$G(PSSFT)]"" D
.I PSSFT["??" D LOOP Q
.D FIND^DIC(9009032.3,,"@;.01;","QP",PSSFT,,"B",,,"")
.I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
.I +^TMP("DILIST",$J,0)>0 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) N PSSXX S PSSXX=0 F S PSSXX=$O(^TMP("DILIST",$J,PSSXX)) Q:'PSSXX D
..S PSSIEN=+^TMP("DILIST",$J,PSSXX,0) K PSS32P3 D GETS^DIQ(9009032.3,+PSSIEN,".01","I","PSS32P3") S PSS(1)=0
..F S PSS(1)=$O(PSS32P3(9009032.3,PSS(1))) Q:'PSS(1) D SETALL
K ^TMP("DILIST",$J)
Q
;
SETALL ;
S ^TMP($J,LIST,+PSS(1),.01)=$G(PSS32P3(9009032.3,PSS(1),.01,"I"))
S ^TMP($J,LIST,"B",$G(PSS32P3(9009032.3,PSS(1),.01,"I")),+PSS(1))=""
Q
;
LOOP ;
N PSSIEN
S PSSIEN=0 F S PSSIEN=$O(^APSPQA(32.3,PSSIEN)) Q:'PSSIEN D
.D GETS^DIQ(9009032.3,+PSSIEN,".01","I","PSS32P3") S PSS(1)=0,^TMP($J,LIST,0)=0 D
..F S PSS(1)=$O(PSS32P3(9009032.3,PSS(1))) Q:'PSS(1) D SETALL S ^TMP($J,LIST,0)=^TMP($J,LIST,0)+1
Q
PSS32P3 ;BIR/LDT - API FOR INFORMATION FROM FILE 9009032.3; 5 Sep 03
+1 ;;1.0;PHARMACY DATA MANAGEMENT;**85**;9/30/97
+2 ;
ALL(PSSIEN,PSSFT,LIST) ;
+1 ;PSSIEN - IEN of entry in 9009032.3.
+2 ;PSSFT - Free Text TYPE in 9009032.3.
+3 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
+4 ;Field Number of the data piece being returned.
+5 ;Returns TYPE field (#.01) of APSP INTERVENTION TYPE file (#9009032.3).
+6 NEW DIERR,ZZERR,PSS32P3,PSS
+7 IF $GET(LIST)']""
QUIT
+8 KILL ^TMP($JOB,LIST)
+9 IF +$GET(PSSIEN)'>0
IF ($GET(PSSFT)']"")
SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
QUIT
+10 IF $GET(PSSIEN)]""
IF +$GET(PSSIEN)'>0
SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
QUIT
+11 IF +$GET(PSSIEN)>0
NEW PSSIEN2
SET PSSIEN2=$$FIND1^DIC(9009032.3,"","A","`"_PSSIEN,,,"")
Begin DoDot:1
+12 IF +PSSIEN2'>0
SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
QUIT
+13 SET ^TMP($JOB,LIST,0)=1
+14 DO GETS^DIQ(9009032.3,+PSSIEN2,".01","I","PSS32P3")
SET PSS(1)=0
+15 FOR
SET PSS(1)=$ORDER(PSS32P3(9009032.3,PSS(1)))
IF 'PSS(1)
QUIT
DO SETALL
End DoDot:1
+16 IF $GET(PSSIEN)=""
IF $GET(PSSFT)]""
Begin DoDot:1
+17 IF PSSFT["??"
DO LOOP
QUIT
+18 DO FIND^DIC(9009032.3,,"@;.01;","QP",PSSFT,,"B",,,"")
+19 IF +$GET(^TMP("DILIST",$JOB,0))=0
SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
QUIT
+20 IF +^TMP("DILIST",$JOB,0)>0
SET ^TMP($JOB,LIST,0)=+^TMP("DILIST",$JOB,0)
NEW PSSXX
SET PSSXX=0
FOR
SET PSSXX=$ORDER(^TMP("DILIST",$JOB,PSSXX))
IF 'PSSXX
QUIT
Begin DoDot:2
+21 SET PSSIEN=+^TMP("DILIST",$JOB,PSSXX,0)
KILL PSS32P3
DO GETS^DIQ(9009032.3,+PSSIEN,".01","I","PSS32P3")
SET PSS(1)=0
+22 FOR
SET PSS(1)=$ORDER(PSS32P3(9009032.3,PSS(1)))
IF 'PSS(1)
QUIT
DO SETALL
End DoDot:2
End DoDot:1
+23 KILL ^TMP("DILIST",$JOB)
+24 QUIT
+25 ;
SETALL ;
+1 SET ^TMP($JOB,LIST,+PSS(1),.01)=$GET(PSS32P3(9009032.3,PSS(1),.01,"I"))
+2 SET ^TMP($JOB,LIST,"B",$GET(PSS32P3(9009032.3,PSS(1),.01,"I")),+PSS(1))=""
+3 QUIT
+4 ;
LOOP ;
+1 NEW PSSIEN
+2 SET PSSIEN=0
FOR
SET PSSIEN=$ORDER(^APSPQA(32.3,PSSIEN))
IF 'PSSIEN
QUIT
Begin DoDot:1
+3 DO GETS^DIQ(9009032.3,+PSSIEN,".01","I","PSS32P3")
SET PSS(1)=0
SET ^TMP($JOB,LIST,0)=0
Begin DoDot:2
+4 FOR
SET PSS(1)=$ORDER(PSS32P3(9009032.3,PSS(1)))
IF 'PSS(1)
QUIT
DO SETALL
SET ^TMP($JOB,LIST,0)=^TMP($JOB,LIST,0)+1
End DoDot:2
End DoDot:1
+5 QUIT