- PSN50627 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.627; 5 Sep 03
- ;;4.0; NATIONAL DRUG FILE;**80**; 30 Oct 98
- ;
- DATA(PSNIEN,PSNFT,LIST) ;
- ;PSNIEN - IEN of entry in WARNING LABEL MAP file (#50.627).
- ;PSNFT - Free Text name in VA DRUG CLASS file (#50.627).
- ;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.
- N DIERR,ZZERR,PSN50627,PSN,CNT
- I $G(LIST)']"" Q
- K ^TMP($J,LIST)
- I +$G(PSNIEN)'>0,($G(PSNFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
- I $G(PSNIEN)]"",+$G(PSNIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
- I $G(PSNIEN)]"" N PSNIEN2 S PSNIEN2=$$FIND1^DIC(50.627,"","B","`"_PSNIEN,,,"") D
- .I +PSNIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
- .S ^TMP($J,LIST,0)=1
- .D GETS^DIQ(50.627,+PSNIEN,".01;1;2","IE","PSN50627") S PSN(1)=0
- .F S PSN(1)=$O(PSN50627(50.627,PSN(1))) Q:'PSN(1) D SETZRO
- I $G(PSNIEN)="",$G(PSNFT)]"" D
- .I PSNFT["??" D LOOP Q
- .D FIND^DIC(50.627,,"@;.01;1","QP",PSNFT,,"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 PSNXX S PSNXX=0 F S PSNXX=$O(^TMP("DILIST",$J,PSNXX)) Q:'PSNXX D
- ..S PSNIEN=+^TMP("DILIST",$J,PSNXX,0) K PSN50627 D GETS^DIQ(50.627,+PSNIEN,".01;1;2","IE","PSN50627") S PSN(1)=0
- ..F S PSN(1)=$O(PSN50627(50.627,PSN(1))) Q:'PSN(1) D SETZRO
- K ^TMP("DILIST",$J)
- Q
- SETZRO ;
- S ^TMP($J,LIST,+PSN(1),.01)=$G(PSN50627(50.627,PSN(1),.01,"I"))
- S ^TMP($J,LIST,"B",$G(PSN50627(50.627,PSN(1),.01,"I")),+PSN(1))=""
- S ^TMP($J,LIST,+PSN(1),1)=$G(PSN50627(50.627,PSN(1),1,"I"))
- S ^TMP($J,LIST,+PSN(1),2)=$G(PSN50627(50.627,PSN(1),2,"I"))
- Q
- LOOP ;
- N PSNIEN,CNT S CNT=0
- S PSNIEN=0 F S PSNIEN=$O(^PS(50.627,PSNIEN)) Q:'PSNIEN D
- .K PSN50627 D GETS^DIQ(50.627,+PSNIEN,".01;1;2","IE","PSN50627") S PSN(1)=0 D
- ..F S PSN(1)=$O(PSN50627(50.627,PSN(1))) Q:'PSN(1) D SETZRO S CNT=CNT+1
- S ^TMP($J,LIST,0)=$S(+CNT>0:CNT,1:"-1^NO DATA FOUND")
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSN50627 2052 printed Mar 13, 2025@21:27:15 Page 2
- PSN50627 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.627; 5 Sep 03
- +1 ;;4.0; NATIONAL DRUG FILE;**80**; 30 Oct 98
- +2 ;
- DATA(PSNIEN,PSNFT,LIST) ;
- +1 ;PSNIEN - IEN of entry in WARNING LABEL MAP file (#50.627).
- +2 ;PSNFT - Free Text name in VA DRUG CLASS file (#50.627).
- +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 NEW DIERR,ZZERR,PSN50627,PSN,CNT
- +6 IF $GET(LIST)']""
- QUIT
- +7 KILL ^TMP($JOB,LIST)
- +8 IF +$GET(PSNIEN)'>0
- IF ($GET(PSNFT)']"")
- SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
- QUIT
- +9 IF $GET(PSNIEN)]""
- IF +$GET(PSNIEN)'>0
- SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
- QUIT
- +10 IF $GET(PSNIEN)]""
- NEW PSNIEN2
- SET PSNIEN2=$$FIND1^DIC(50.627,"","B","`"_PSNIEN,,,"")
- Begin DoDot:1
- +11 IF +PSNIEN2'>0
- SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
- QUIT
- +12 SET ^TMP($JOB,LIST,0)=1
- +13 DO GETS^DIQ(50.627,+PSNIEN,".01;1;2","IE","PSN50627")
- SET PSN(1)=0
- +14 FOR
- SET PSN(1)=$ORDER(PSN50627(50.627,PSN(1)))
- if 'PSN(1)
- QUIT
- DO SETZRO
- End DoDot:1
- +15 IF $GET(PSNIEN)=""
- IF $GET(PSNFT)]""
- Begin DoDot:1
- +16 IF PSNFT["??"
- DO LOOP
- QUIT
- +17 DO FIND^DIC(50.627,,"@;.01;1","QP",PSNFT,,"B",,,"")
- +18 IF +$GET(^TMP("DILIST",$JOB,0))=0
- SET ^TMP($JOB,LIST,0)=-1_"^"_"NO DATA FOUND"
- QUIT
- +19 IF +^TMP("DILIST",$JOB,0)>0
- SET ^TMP($JOB,LIST,0)=+^TMP("DILIST",$JOB,0)
- NEW PSNXX
- SET PSNXX=0
- FOR
- SET PSNXX=$ORDER(^TMP("DILIST",$JOB,PSNXX))
- if 'PSNXX
- QUIT
- Begin DoDot:2
- +20 SET PSNIEN=+^TMP("DILIST",$JOB,PSNXX,0)
- KILL PSN50627
- DO GETS^DIQ(50.627,+PSNIEN,".01;1;2","IE","PSN50627")
- SET PSN(1)=0
- +21 FOR
- SET PSN(1)=$ORDER(PSN50627(50.627,PSN(1)))
- if 'PSN(1)
- QUIT
- DO SETZRO
- End DoDot:2
- End DoDot:1
- +22 KILL ^TMP("DILIST",$JOB)
- +23 QUIT
- SETZRO ;
- +1 SET ^TMP($JOB,LIST,+PSN(1),.01)=$GET(PSN50627(50.627,PSN(1),.01,"I"))
- +2 SET ^TMP($JOB,LIST,"B",$GET(PSN50627(50.627,PSN(1),.01,"I")),+PSN(1))=""
- +3 SET ^TMP($JOB,LIST,+PSN(1),1)=$GET(PSN50627(50.627,PSN(1),1,"I"))
- +4 SET ^TMP($JOB,LIST,+PSN(1),2)=$GET(PSN50627(50.627,PSN(1),2,"I"))
- +5 QUIT
- LOOP ;
- +1 NEW PSNIEN,CNT
- SET CNT=0
- +2 SET PSNIEN=0
- FOR
- SET PSNIEN=$ORDER(^PS(50.627,PSNIEN))
- if 'PSNIEN
- QUIT
- Begin DoDot:1
- +3 KILL PSN50627
- DO GETS^DIQ(50.627,+PSNIEN,".01;1;2","IE","PSN50627")
- SET PSN(1)=0
- Begin DoDot:2
- +4 FOR
- SET PSN(1)=$ORDER(PSN50627(50.627,PSN(1)))
- if 'PSN(1)
- QUIT
- DO SETZRO
- SET CNT=CNT+1
- End DoDot:2
- End DoDot:1
- +5 SET ^TMP($JOB,LIST,0)=$SELECT(+CNT>0:CNT,1:"-1^NO DATA FOUND")
- +6 QUIT