source: FOIAVistA/trunk/r/NATIONAL_DRUG_FILE-PSN/PSN50P67.m@ 1114

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

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1PSN50P67 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.607; 5 Sep 03
2 ;;4.0; NATIONAL DRUG FILE;**80**; 30 Oct 98
3 ;
4ALL(PSNIEN,PSNFT,PSNFL,LIST) ;
5 ;PSNIEN - IEN of entry in DRUG UNITS file (#50.607).
6 ;PSNFT - Free Text name in DRUG UNITS file (#50.607).
7 ;PSNFL - Inactive flag - "" - All entries.
8 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
9 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
10 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where
11 ; Field Number is the Field Number of the data piece being returned.
12 ;Returns NAME field (#.01), and INACTIVATION DATE field (#1) of DRUG UNITS file (#50.607).
13 N DIERR,ZZERR,PSN50P67,PSN,SCR
14 I $G(LIST)']"" Q
15 K ^TMP($J,LIST)
16 I $G(PSNIEN)']"",($G(PSNFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
17 I $G(PSNIEN)]"",(+$G(PSNIEN)'>0) S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
18 S SCR("S")=""
19 I +$G(PSNFL)>0 N ND D SETSCRN
20 I $G(PSNIEN)]"" N PSNIEN2 S PSNIEN2=$$FIND1^DIC(50.607,"","B","`"_PSNIEN,,SCR("S"),"") D
21 .I +PSNIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
22 .S ^TMP($J,LIST,0)=1
23 .D GETS^DIQ(50.607,+PSNIEN2,".01;1","IE","PSN50P67") S PSN(1)=0
24 .F S PSN(1)=$O(PSN50P67(50.607,PSN(1))) Q:'PSN(1) D SETZRO
25 I $G(PSNIEN)="",$G(PSNFT)]"" D
26 .I PSNFT["??" D LOOP Q
27 .D FIND^DIC(50.607,,"@;.01;1","QP",PSNFT,,"B",SCR("S"),,"")
28 .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
29 .I +^TMP("DILIST",$J,0)>0 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) N PSNXX S PSNXX=0 F S PSNXX=$O(^TMP("DILIST",$J,PSNXX)) Q:'PSNXX D
30 ..S PSNIEN=+^TMP("DILIST",$J,PSNXX,0) K PSN50P67 D GETS^DIQ(50.607,+PSNIEN,".01;1","IE","PSN50P67") S PSN(1)=0
31 ..F S PSN(1)=$O(PSN50P67(50.607,PSN(1))) Q:'PSN(1) D SETZRO
32 K ^TMP("DILIST",$J)
33 Q
34 ;
35SETZRO ;
36 S ^TMP($J,LIST,+PSN(1),.01)=$G(PSN50P67(50.607,PSN(1),.01,"I"))
37 S ^TMP($J,LIST,"B",$G(PSN50P67(50.607,PSN(1),.01,"I")),+PSN(1))=""
38 S ^TMP($J,LIST,+PSN(1),1)=$S($G(PSN50P67(50.607,PSN(1),1,"I"))="":"",1:PSN50P67(50.607,PSN(1),1,"I")_"^"_PSN50P67(50.607,PSN(1),1,"E"))
39 Q
40 ;
41LOOP ;
42 N PSNIEN
43 S ^TMP($J,LIST,0)=0,PSNIEN=0 F S PSNIEN=$O(^PS(50.607,PSNIEN)) Q:'PSNIEN D
44 .I +$G(PSNFL)>0,$P($G(^PS(50.607,PSNIEN,0)),"^",2)]"",$P($G(^(0)),"^",2)'>PSNFL Q
45 .K PSN50P67 D GETS^DIQ(50.607,+PSNIEN,".01;1","IE","PSN50P67") S PSN(1)=0 D
46 ..F S PSN(1)=$O(PSN50P67(50.607,PSN(1))) Q:'PSN(1) D SETZRO S ^TMP($J,LIST,0)=^TMP($J,LIST,0)+1
47 Q
48 ;
49SETSCRN ;
50 S SCR("S")="S ND=$P($G(^PS(50.607,+Y,0)),""^"",2) I ND=""""!(ND>PSNFL)"
51 Q
Note: See TracBrowser for help on using the repository browser.