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

PSN50627.m

Go to the documentation of this file.
  1. PSN50627 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.627; 5 Sep 03
  1. ;;4.0; NATIONAL DRUG FILE;**80**; 30 Oct 98
  1. ;
  1. DATA(PSNIEN,PSNFT,LIST) ;
  1. ;PSNIEN - IEN of entry in WARNING LABEL MAP file (#50.627).
  1. ;PSNFT - Free Text name in VA DRUG CLASS file (#50.627).
  1. ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
  1. ; Field Number of the data piece being returned.
  1. N DIERR,ZZERR,PSN50627,PSN,CNT
  1. I $G(LIST)']"" Q
  1. K ^TMP($J,LIST)
  1. I +$G(PSNIEN)'>0,($G(PSNFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
  1. I $G(PSNIEN)]"",+$G(PSNIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
  1. I $G(PSNIEN)]"" N PSNIEN2 S PSNIEN2=$$FIND1^DIC(50.627,"","B","`"_PSNIEN,,,"") D
  1. .I +PSNIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
  1. .S ^TMP($J,LIST,0)=1
  1. .D GETS^DIQ(50.627,+PSNIEN,".01;1;2","IE","PSN50627") S PSN(1)=0
  1. .F S PSN(1)=$O(PSN50627(50.627,PSN(1))) Q:'PSN(1) D SETZRO
  1. I $G(PSNIEN)="",$G(PSNFT)]"" D
  1. .I PSNFT["??" D LOOP Q
  1. .D FIND^DIC(50.627,,"@;.01;1","QP",PSNFT,,"B",,,"")
  1. .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
  1. .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
  1. ..S PSNIEN=+^TMP("DILIST",$J,PSNXX,0) K PSN50627 D GETS^DIQ(50.627,+PSNIEN,".01;1;2","IE","PSN50627") S PSN(1)=0
  1. ..F S PSN(1)=$O(PSN50627(50.627,PSN(1))) Q:'PSN(1) D SETZRO
  1. K ^TMP("DILIST",$J)
  1. Q
  1. SETZRO ;
  1. S ^TMP($J,LIST,+PSN(1),.01)=$G(PSN50627(50.627,PSN(1),.01,"I"))
  1. S ^TMP($J,LIST,"B",$G(PSN50627(50.627,PSN(1),.01,"I")),+PSN(1))=""
  1. S ^TMP($J,LIST,+PSN(1),1)=$G(PSN50627(50.627,PSN(1),1,"I"))
  1. S ^TMP($J,LIST,+PSN(1),2)=$G(PSN50627(50.627,PSN(1),2,"I"))
  1. Q
  1. LOOP ;
  1. N PSNIEN,CNT S CNT=0
  1. S PSNIEN=0 F S PSNIEN=$O(^PS(50.627,PSNIEN)) Q:'PSNIEN D
  1. .K PSN50627 D GETS^DIQ(50.627,+PSNIEN,".01;1;2","IE","PSN50627") S PSN(1)=0 D
  1. ..F S PSN(1)=$O(PSN50627(50.627,PSN(1))) Q:'PSN(1) D SETZRO S CNT=CNT+1
  1. S ^TMP($J,LIST,0)=$S(+CNT>0:CNT,1:"-1^NO DATA FOUND")
  1. Q