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

PSSDRDOS.m

Go to the documentation of this file.
PSSDRDOS ;BIR/RTR-Display Dosing related information for DRUG File(#50) entry ;08/20/11
 ;;1.0;PHARMACY DATA MANAGEMENT;**160,173,195,178,206**;9/30/97;Build 10
 ;
 ;Reference to $$PROD0^PSNAPIS(P1,P3) supported by DBIA #2531
 ;Reference to $$OVRIDE^PSNAPIS(P1,P3) supported by DBIA #2531
 ;
EN ;
 N X,Y,DIR,DTOUT,DUOUT,DIRUT,DIROUT,DIC,DA,DR,DLAYGO,DIDEL,%,%DT,D0,I,J,XX,D
 N PSSVVHIN,PSSVVHZR,PSSVVHND,PSSVVHN1,PSSVVHN3,PSSVVHRS,PSSVVHMT,PSSVVHOV,PSSVVHNM,PSSVVHDF,PSSVVHGC,PSSVVHDX,PSSVVHLG,PSSVVHQT,PSSVVHL3,PSSVVHL4
 N PSSVVHA1,PSSVVHA2,PSSVVHA3,PSSVVHA4,PSSVVHA5,PSSVVHA7,PSSVVHA8,PSSVVHA9,PSSVVHAR,PSSIEN,PSSVVHXX,PSSVVHPL,PSSVVHHH
 N PSSVVHL1,PSSVVHL2
 S $P(PSSVVHL1,"=",75)=""
 S $P(PSSVVHL2,"-",75)=""
EN1 ;Come back through to prompt for another drug before exiting option
 K X,Y,DIR,DTOUT,DUOUT,DIRUT,DIROUT,DIC,DA,DR,DLAYGO,DIDEL,%,%DT,D0,I,J,XX,D
 K PSSVVHIN,PSSVVHZR,PSSVVHND,PSSVVHN1,PSSVVHN3,PSSVVHRS,PSSVVHMT,PSSVVHOV,PSSVVHNM,PSSVVHDF,PSSVVHGC,PSSVVHDX,PSSVVHLG,PSSVVHQT,PSSVVHL3,PSSVVHL4
 K PSSVVHA1,PSSVVHA2,PSSVVHA3,PSSVVHA4,PSSVVHA5,PSSVVHA7,PSSVVHA8,PSSVVHA9,PSSVVHAR,PSSIEN,PSSVVHXX,PSSVVHPL,PSSVVHHH
 W ! K DIC,X,DTOUT,DUOUT S DIC="^PSDRUG(",DIC(0)="AEQMZ" D ^DIC K DIC,X I Y<0!($D(DUOUT))!($D(DTOUT)) W ! Q
 S PSSVVHIN=+Y
 S (PSSVVHDX,PSSVVHQT,PSSVVHLG)=0,(PSSVVHOV,PSSVVHGC,PSSVVHNM,PSSVVHDF,PSSVVHPL,PSSVVHHH)=""
 S PSSVVHZR=$G(^PSDRUG(PSSVVHIN,0)),PSSVVHND=$G(^PSDRUG(PSSVVHIN,"ND")),PSSVVHMT=1
 S PSSVVHN1=$P(PSSVVHND,"^"),PSSVVHN3=$P(PSSVVHND,"^",3) I 'PSSVVHN1!('PSSVVHN3) S PSSVVHMT=0
 I 'PSSVVHMT S PSSVVHLG=1 G NOTM
 S PSSVVHRS=$$PROD0^PSNAPIS(PSSVVHN1,PSSVVHN3),PSSVVHOV=$$OVRIDE^PSNAPIS(PSSVVHN1,PSSVVHN3) S PSSVVHHH=$S(PSSVVHOV:1,1:0)
 S PSSVVHNM=$P(PSSVVHRS,"^"),PSSVVHDF=$P(PSSVVHRS,"^",2),PSSVVHGC=$P(PSSVVHRS,"^",7)
 I PSSVVHDF S PSSVVHPL=0 I $P($G(^PS(50.606,PSSVVHDF,1)),"^") S (PSSVVHDX,PSSVVHPL)=1
 S PSSVVHLG=$$ELG
 ;
NOTM ;Jump to here if not matched to National Drug File
 W @IOF
 S PSSVVHL3=$L($P(PSSVVHZR,"^")),PSSVVHL4=$S(PSSVVHGC'="":$L(PSSVVHGC),1:4) D
 .I (PSSVVHL3+PSSVVHL4)<54 W !?12,$P(PSSVVHZR,"^")_"  (GCNSEQNO: "_$S(PSSVVHGC'="":PSSVVHGC,1:"None")_")" D PAUSE Q
 .W !?12,$P(PSSVVHZR,"^") D PAUSE Q:PSSVVHQT
 .W !?12,"(GCNSEQNO: "_$S(PSSVVHGC'="":PSSVVHGC,1:"None")_")" D PAUSE
 G:PSSVVHQT EN1
 W !,PSSVVHL1 D PAUSE G:PSSVVHQT EN1
 S PSSVVHL3=$L(PSSVVHNM) D
 .I PSSVVHL3<63 W !,"VA PRODUCT NAME: "_PSSVVHNM D PAUSE Q
 .W !,"VA PRODUCT NAME:" D PAUSE Q:PSSVVHQT
 .W !?2,PSSVVHNM D PAUSE
 G:PSSVVHQT EN1
 W !,"NDF DOSAGE FORM: "_$S(PSSVVHDF:$P($G(^PS(50.606,+PSSVVHDF,0)),"^"),1:"") D PAUSE G:PSSVVHQT EN1
 W !,"DEA, SPECIAL HDLG: "_$P(PSSVVHZR,"^",3)_"   VA DRUG CLASS: "_$P(PSSVVHZR,"^",2) D PAUSE G:PSSVVHQT EN1
 W !,"EXCLUDE DOSAGE FORM FROM DOSAGE CHECKS: " W $S(PSSVVHPL:"YES",PSSVVHPL=0:"NO",1:"") D PAUSE G:PSSVVHQT EN1
 W !,"OVERRIDE DOSAGE FORM DOSE CHECK EXCLUSION FOR VA PRODUCT: " W $S(PSSVVHHH:"YES",PSSVVHHH=0:"NO",1:"") D PAUSE G:PSSVVHQT EN1
 W ! D PAUSE G:PSSVVHQT EN1
 W !?7,"***DRUG "_$S(PSSVVHLG:"NOT ",1:"")_"ELIGIBLE FOR DOSAGE CHECKS***" D PAUSE G:PSSVVHQT EN1
 W !,PSSVVHL2 D PAUSE G:PSSVVHQT EN1
 ;
 S PSSVVHA1=$G(^PSDRUG(PSSVVHIN,"DOS")) S PSSVVHL3=0
 S PSSVVHA2=$P(PSSVVHA1,"^"),PSSVVHA3=$P(PSSVVHA1,"^",2) I PSSVVHA3,$P($G(^PS(50.607,+PSSVVHA3,0)),"^")'["/" S PSSVVHL3=$L($P($G(^PS(50.607,+PSSVVHA3,0)),"^"))
 W !,"Strength: "_$S($E($G(PSSVVHA2),1)=".":"0",1:"")_$G(PSSVVHA2) D
 .I PSSVVHA3="" W "   Unit:" D PAUSE Q
 .I PSSVVHL3<46 W "   Unit: "_$S($P($G(^PS(50.607,+$G(PSSVVHA3),0)),"^")'["/":$P($G(^(0)),"^"),1:"") D PAUSE Q
 .W ! D PAUSE Q:PSSVVHQT
 .W "   Unit: "_$S($P($G(^PS(50.607,+$G(PSSVVHA3),0)),"^")'["/":$P($G(^(0)),"^"),1:"") D PAUSE Q
 G:PSSVVHQT EN1
 W !,"POSSIBLE DOSAGES:" D PAUSE G:PSSVVHQT EN1 D
 .F PSSVVHA4=0:0 S PSSVVHA4=$O(^PSDRUG(PSSVVHIN,"DOS1",PSSVVHA4)) Q:'PSSVVHA4!(PSSVVHQT)  D
 ..S PSSVVHA5=$G(^PSDRUG(PSSVVHIN,"DOS1",PSSVVHA4,0))
 ..W !,"  DISPENSE UNITS PER DOSE: " D
 ...W $S($E($P(PSSVVHA5,"^"),1)=".":"0",1:"")_$P(PSSVVHA5,"^")
 ...S X=$P(PSSVVHA5,"^"),PSSIEN=PSSVVHIN D SET^PSSDOSLZ S PSSVVHXX=$G(X)
 ...W ?43,"DOSE: ",PSSVVHXX
 ...I $L(PSSVVHXX)'>14 W ?65,"PACKAGE: ",$P(PSSVVHA5,U,3) D PAUSE Q
 ...W ! D PAUSE Q:PSSVVHQT
 ...W ?65,"PACKAGE: ",$P(PSSVVHA5,U,3) D PAUSE
 ..Q:PSSVVHQT
 ..W !,"      BCMA UNITS PER DOSE: "_$S($E($P(PSSVVHA5,"^",4),1)=".":"0",1:"")_$P(PSSVVHA5,"^",4) D PAUSE
 G:PSSVVHQT EN1
 W !!,"LOCAL POSSIBLE DOSAGES:" D PAUSE G:PSSVVHQT EN1 D
 .F PSSVVHA7=0:0 S PSSVVHA7=$O(^PSDRUG(PSSVVHIN,"DOS2",PSSVVHA7)) Q:'PSSVVHA7!(PSSVVHQT)  D
 ..S PSSVVHA8=$G(^PSDRUG(PSSVVHIN,"DOS2",PSSVVHA7,0)) W !,"  LOCAL POSSIBLE DOSAGE: " D
 ...I $L($P(PSSVVHA8,"^"))'>37 W $P(PSSVVHA8,"^"),?65,"PACKAGE: ",$P(PSSVVHA8,"^",2) D PAUSE Q:PSSVVHQT  D WXFPT(PSSVVHA8) Q
 ...W !,?3,$P(PSSVVHA8,"^"),?65,"PACKAGE: ",$P(PSSVVHA8,"^",2) D PAUSE Q:PSSVVHQT  D WXFPT(PSSVVHA8)
 G:PSSVVHQT EN1
 W !,PSSVVHL2 D PAUSE G:PSSVVHQT EN1
 I $G(PSSVVHGC)=""!(PSSVVHLG) D  G EN1
 .W !,"FDB ROUTES:" D PAUSE Q:PSSVVHQT
 .W !,"FDB DOSE UNITS:" D PAUSE Q:PSSVVHQT
 .W !,"BSA REQUIRED FOR DOSAGE CHECKS:" D PAUSE Q:PSSVVHQT
 .W !,"WEIGHT REQUIRED FOR DOSAGE CHECKS:" D PAUSE
 D NGC,NGCK
 I $P($G(^PSDRUG(PSSVVHIN,"ND")),"^",3)'="" D CLEFF^PSSDRDO2(PSSVVHN3) D PAUSE Q:PSSVVHQT  ; Clinical Effects of Drug fields
 G EN1
 ;
WXFPT(PSSVVHCL) ;
 N PSSVVHC1,PSSVVHC2,PSSVVHC3,PSSVVHC4,PSSVVHC5,PSSVVHC6,PSSVVHC7
 S PSSVVHC4=""
 S PSSVVHC1=$P(PSSVVHCL,"^",3),PSSVVHC2=$P(PSSVVHCL,"^",5),PSSVVHC3=$P(PSSVVHCL,"^",6)
 I PSSVVHC2 S PSSVVHC4=$P($G(^PS(51.24,+PSSVVHC2,0)),"^")
 S PSSVVHC5=$S($E(PSSVVHC3)=".":"0",1:"")_PSSVVHC3
 S PSSVVHC7=$S($E(PSSVVHC1)=".":"0",1:"")_PSSVVHC1
 S PSSVVHC6=$L(PSSVVHC5)
 W !?4,"BCMA UNITS PER DOSE: "_PSSVVHC7 D PAUSE Q:PSSVVHQT
 I PSSVVHC6<12 W !?4,"       NUMERIC DOSE: "_PSSVVHC5,?38,"DOSE UNIT: "_PSSVVHC4 D PAUSE Q
 W !,?4,"       NUMERIC DOSE: "_PSSVVHC5 D PAUSE Q:PSSVVHQT
 W !,?38,"DOSE UNIT: "_PSSVVHC4 D PAUSE
 Q
 ;
PAUSE ;
 I ($Y+5)'>IOSL Q
 W ! K DIR S DIR(0)="E",DIR("A")="Press Return to continue, '^' to exit" D ^DIR K DIR I 'Y S PSSVVHQT=1 Q
 W @IOF
 Q
 ;
ELG() ;Is drug Dose Call Eligible, for matched drugs
 N PSSVVHDA
 S PSSVVHDA=PSSVVHDF
 ;1=exempt from Dose Check, 0=not exempt from Dose check
 I $P(PSSVVHZR,"^",3)["S"!($E($P(PSSVVHZR,"^",2),1,2)="XA") Q 1
 I $G(PSSVVHGC)="" Q 1
 I $G(PSSVVHDA)'>0,$P($G(^PSDRUG(PSSVVHIN,2)),"^") S PSSVVHDA=$P($G(^PS(50.7,+$P($G(^PSDRUG(PSSVVHIN,2)),"^"),0)),"^",2) I PSSVVHDA,$P($G(^PS(50.606,+$G(PSSVVHDA),1)),"^") S PSSVVHDX=1
 I PSSVVHOV=""!('$G(PSSVVHDA))!($P($G(^PS(50.606,+$G(PSSVVHDA),1)),"^")="") Q 0
 I $P($G(^PS(50.606,+$G(PSSVVHDA),1)),"^"),'PSSVVHOV Q 1
 I '$P($G(^PS(50.606,+$G(PSSVVHDA),1)),"^"),PSSVVHOV Q 1
 Q 0
 ;
NGC ;Print First Databank data from Dosing records
 N PSSDCR1,PSSDCR2,PSSDCR3,PSSDCR4,PSSDCR5,PSSDCR6,PSSDCR7,PSSDCR8,PSSDCR9,PSSDCRN3,PSSDCRVL,PSSDCRMR,PSSDCRUN,PSSDCRWT,PSSDCRBS,PSSDCRCO,PSSDCRF1,PSSDCRF2,PSSDCRF3,PSSDCRF4,PSSDCRF5,PSSDCRX1,PSSDCRX2,PSSDCRXX,PSSDCRK1,PSSDCRK2
 N PSSDCRJ1,PSSDCRJ2,PSSDCRJ3,PSSDCRJ4,PSSDCRJ5,PSSDCRJ6
 D NGCK
 D EN^PSSFDBDI(PSSVVHGC,.PSSDCRVL)
 I $P($G(PSSDCRVL(0)),"^")=-1 D  Q
 .W !,"Vendor database cannot be reached. FDB Dosing information could not be" D PAUSE Q:PSSVVHQT
 .W !,"retrieved at this time." D PAUSE
 ;
 ;set arrays used for printing from doseRanges records
 S (PSSDCRX1,PSSDCRX2)=1
 S PSSVVHGC=+PSSVVHGC
 S PSSDCR1="" F  S PSSDCR1=$O(^TMP($J,"PSSFDBDI",PSSVVHGC,"doseRanges",PSSDCR1)) Q:PSSDCR1=""  D
 .S PSSDCR2=$G(^TMP($J,"PSSFDBDI",PSSVVHGC,"doseRanges",PSSDCR1,1,0)) Q:$P(PSSDCR2,"^",4)'="SINGLE DOSE"&($P(PSSDCR2,"^",4)'="MAINTENANCE")  S:$P(PSSDCR2,"^",6)'="" PSSDCRMR($P(PSSDCR2,"^",6))=""
 .S PSSDCR5=$G(^TMP($J,"PSSFDBDI",PSSVVHGC,"doseRanges",PSSDCR1,5,0))
 .S PSSDCR6=$G(^TMP($J,"PSSFDBDI",PSSVVHGC,"doseRanges",PSSDCR1,6,0))
 .S PSSDCR7=$G(^TMP($J,"PSSFDBDI",PSSVVHGC,"doseRanges",PSSDCR1,7,0))
 .S PSSDCRN3=$G(^TMP($J,"PSSFDBDI",PSSVVHGC,"doseRanges",PSSDCR1,3,0))
 .F PSSDCR8=2,4,6,8 D
 ..S:$P(PSSDCR5,"^",PSSDCR8)'="" PSSDCRUN($P($P(PSSDCR5,"^",PSSDCR8),"/"))="" S:$P(PSSDCR6,"^",PSSDCR8)'="" PSSDCRUN($P($P(PSSDCR6,"^",PSSDCR8),"/"))=""
 .F PSSDCR8=2,4 D
 ..S:$P(PSSDCR7,"^",PSSDCR8)'="" PSSDCRUN($P($P(PSSDCR7,"^",PSSDCR8),"/"))=""
 .I $P(PSSDCR2,"^",7)'="",$P(PSSDCR2,"^",8)'="" S PSSDCRCO=$P(PSSDCR2,"^",7)_"-"_$P(PSSDCR2,"^",8) D
 ..I $P(PSSDCRN3,"^")="true"!($P(PSSDCRN3,"^")="false") I '$$DUP1 S PSSDCRBS(PSSDCRX1,PSSDCRCO,$P(PSSDCRN3,"^"))=$P(PSSDCR2,"^",6)_"^"_$P(PSSDCR2,"^",4) S PSSDCRX1=PSSDCRX1+1
 ..I $P(PSSDCRN3,"^",2)="true"!($P(PSSDCRN3,"^",2)="false") I '$$DUP2 S PSSDCRWT(PSSDCRX2,PSSDCRCO,$P(PSSDCRN3,"^",2))=$P(PSSDCR2,"^",6)_"^"_$P(PSSDCR2,"^",4) S PSSDCRX2=PSSDCRX2+1
 ;
 ;Removed all Min/Max Dosing records per CR 5781, CR 5783 and CCR 5778
 W !,"FDB ROUTES: " S PSSDCR3=0 D
 .S PSSDCR4="" F  S PSSDCR4=$O(PSSDCRMR(PSSDCR4)) Q:PSSDCR4=""!(PSSVVHQT)  D
 ..I 'PSSDCR3 W PSSDCR4 S PSSDCR3=1 D PAUSE Q
 ..W !?12,PSSDCR4 D PAUSE
 I PSSVVHQT Q
 ;
 W !,"FDB DOSE UNITS: " S PSSDCR3=0 D
 .S PSSDCR4="" F  S PSSDCR4=$O(PSSDCRUN(PSSDCR4)) Q:PSSDCR4=""!(PSSVVHQT)  D
 ..I 'PSSDCR3 W PSSDCR4 S PSSDCR3=1 D PAUSE Q
 ..W !?16,PSSDCR4 D PAUSE
 I PSSVVHQT Q
 ;
 ;Write BSA and WT required data
 ;If all Age ranges under BSA or WT, are the same do not list individual age ranges
 ;When listing Age ranges under BSA or WT, then within that Yes or No, if 2 or more and ranges exist, and one or more has
 ;a route associated with it, do not show the age range that does not have a route. Other than that, duplicates are not screened out.
 S (PSSDCRF3,PSSDCRF4)="" D
 .S PSSDCRXX="" F  S PSSDCRXX=$O(PSSDCRBS(PSSDCRXX)) Q:PSSDCRXX=""!(PSSDCRF4)  D
 ..S PSSDCRF1="" F  S PSSDCRF1=$O(PSSDCRBS(PSSDCRXX,PSSDCRF1)) Q:PSSDCRF1=""!(PSSDCRF4)  D
 ...S PSSDCRF2="" F  S PSSDCRF2=$O(PSSDCRBS(PSSDCRXX,PSSDCRF1,PSSD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RF5="true"
 ......S PSSDCRK1=PSSDCRJ5(PSSDCRJ6,PSSDCRXX,PSSDCR4,PSSDCRF5)
 ......W:PSSDCR3 !?22 W " "_PSSDCR4_"  " D  Q:PSSVVHQT  S PSSDCR3=1 D PAUSE Q
 .......D LWRP(PSSDCRK1)
 .Q:PSSVVHQT
 .W !?3,"NO for Age in Days:" S PSSDCR3=0 D
 ..S PSSDCRJ6="" F  S PSSDCRJ6=$O(PSSDCRJ5(PSSDCRJ6)) Q:PSSDCRJ6=""!(PSSVVHQT)  D
 ...S PSSDCRXX="" F  S PSSDCRXX=$O(PSSDCRJ5(PSSDCRJ6,PSSDCRXX)) Q:PSSDCRXX=""!(PSSVVHQT)  D
 ....S PSSDCR4="" F  S PSSDCR4=$O(PSSDCRJ5(PSSDCRJ6,PSSDCRXX,PSSDCR4)) Q:PSSDCR4=""!(PSSVVHQT)  D
 .....S PSSDCRF5="" F  S PSSDCRF5=$O(PSSDCRJ5(PSSDCRJ6,PSSDCRXX,PSSDCR4,PSSDCRF5)) Q:PSSDCRF5=""!(PSSVVHQT)  D:PSSDCRF5="false"
 ......S PSSDCRK2=PSSDCRJ5(PSSDCRJ6,PSSDCRXX,PSSDCR4,PSSDCRF5)
 ......W:PSSDCR3 !?22 W " "_PSSDCR4_"  " D  Q:PSSVVHQT  S PSSDCR3=1 D PAUSE Q
 .......D LWRP(PSSDCRK2)
 I PSSVVHQT Q 
 ;
 S (PSSDCRF3,PSSDCRF4)="" D
 .S PSSDCRXX="" F  S PSSDCRXX=$O(PSSDCRWT(PSSDCRXX)) Q:PSSDCRXX=""!(PSSDCRF4)  D
 ..S PSSDCRF1="" F  S PSSDCRF1=$O(PSSDCRWT(PSSDCRXX,PSSDCRF1)) Q:PSSDCRF1=""!(PSSDCRF4)  D
 ...S PSSDCRF2="" F  S PSSDCRF2=$O(PSSDCRWT(PSSDCRXX,PSSDCRF1,PSSDCRF2)) Q:PSSDCRF2=""!(PSSDCRF4)  D
 ....I PSSDCRF3="" S P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RXX,PSSDCR4,PSSDCRF5)
 ......W:PSSDCR3 !?22 W " "_PSSDCR4_"  " D  Q:PSSVVHQT  S PSSDCR3=1 D PAUSE Q
 .......D LWRP(PSSDCRK1)
 .Q:PSSVVHQT
 .W !?3,"NO for Age in Days:" S PSSDCR3=0 D
 ..S PSSDCRJ6="" F  S PSSDCRJ6=$O(PSSDCRJ5(PSSDCRJ6)) Q:PSSDCRJ6=""!(PSSVVHQT)  D
 ...S PSSDCRXX="" F  S PSSDCRXX=$O(PSSDCRJ5(PSSDCRJ6,PSSDCRXX)) Q:PSSDCRXX=""!(PSSVVHQT)  D
 ....S PSSDCR4="" F  S PSSDCR4=$O(PSSDCRJ5(PSSDCRJ6,PSSDCRXX,PSSDCR4)) Q:PSSDCR4=""!(PSSVVHQT)  D
 .....S PSSDCRF5="" F  S PSSDCRF5=$O(PSSDCRJ5(PSSDCRJ6,PSSDCRXX,PSSDCR4,PSSDCRF5)) Q:PSSDCRF5=""!(PSSVVHQT)  D:PSSDCRF5="false"
 ......S PSSDCRK2=PSSDCRJ5(PSSDCRJ6,PSSDCRXX,PSSDCR4,PSSDCRF5)
 ......W:PSSDCR3 !?22 W " "_PSSDCR4_"  " D  Q:PSSVVHQT  S PSSDCR3=1 D PAUSE Q
 .......D LWRP(PSSDCRK2)
 Q
 ;
NGCK ;
 K ^TMP($J,"PSSFDBDI")
 Q
 ;
DUP1() ;Screen out duplicates, needed if Min/max records are added back
 N PSSDCRD1,PSSDCRD2,PSSDCRDF,PSSDCRD4,PSSDCRG1,PSSDCRG2
 S PSSDCRDF=0
 S PSSDCRD1=$P(PSSDCRN3,"^"),PSSDCRD2=$P(PSSDCR2,"^",6),PSSDCRG1=$P(PSSDCR2,"^",4),PSSDCRG2=PSSDCRD2_"^"_PSSDCRG1
 S PSSDCRD4="" F  S PSSDCRD4=$O(PSSDCRBS(PSSDCRD4)) Q:PSSDCRD4=""!(PSSDCRDF)  D
 .I $G(PSSDCRBS(PSSDCRD4,PSSDCRCO,PSSDCRD1))=PSSDCRG2 S PSSDCRDF=1
 Q PSSDCRDF
 ;
DUP2() ;
 N PSSDCRD5,PSSDCRD6,PSSDCRDG,PSSDCRD7,PSSDCRG4,PSSDCRG5
 S PSSDCRDG=0
 S PSSDCRD5=$P(PSSDCRN3,"^",2),PSSDCRD6=$P(PSSDCR2,"^",6),PSSDCRG4=$P(PSSDCR2,"^",4),PSSDCRG5=PSSDCRD6_"^"_PSSDCRG4
 S PSSDCRD7="" F  S PSSDCRD7=$O(PSSDCRWT(PSSDCRD7)) Q:PSSDCRD7=""!(PSSDCRDG)  D
 .I $G(PSSDCRWT(PSSDCRD7,PSSDCRCO,PSSDCRD5))=PSSDCRG5 S PSSDCRDG=1
 Q PSSDCRDG
 ;
LWRP(PSSDCRL1) ;Print last line, check for wrapping
 N PSSDCRL2,PSSDCRL3,PSSDCRL4,PSSDCRL5
 S PSSDCRL2=$S($P(PSSDCRL1,"^")'="":$L($P(PSSDCRL1,"^")),1:13),PSSDCRL3=$S($P(PSSDCRL1,"^",2)'="":$L($P(PSSDCRL1,"^",2)),1:12) I $P(PSSDCRL1,"^",2)="MAINTENANCE" S PSSDCRL3=PSSDCRL3+5
 S PSSDCRL4=PSSDCRL2+PSSDCRL3+$L(PSSDCR4)
 W "("_$S($P(PSSDCRL1,"^",2)="":"No Dose Type",1:$P(PSSDCRL1,"^",2))_$S($P(PSSDCRL1,"^",2)="MAINTENANCE":" DOSE, ",1:", ")
 I PSSDCRL4<51 W $S($P(PSSDCRL1,"^")="":"No Dose Route)",1:$P(PSSDCRL1,"^")_")") Q
 D PAUSE Q:PSSVVHQT  S PSSDCRL5=$L(PSSDCR4)+26 W !?PSSDCRL5,$S($P(PSSDCRL1,"^")="":"No Dose Route)",1:$P(PSSDCRL1,"^")_")")
 Q
 ;