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

PSNVCR2.m

Go to the documentation of this file.
PSNVCR2 ;BIR/RTR-VISTA COMPARISON REPORT CONTINUED ; 11 January 2017
 ;;4.0;NATIONAL DRUG FILE;**513**; 30 Oct 98;Build 53
 ;
 ;Reference to ^DIA supported by DBIA 2602
 ;
 ;
START ;Print report
 N Y,DIR,DIROUT,DIRUT,DTOUT,DUOUT
START1 ;Print report without queuing
 N PSNCH,PSNCRA2,PSNCRAT,PSNCROUT,PSNCRDEV,PSNCRLIN,PSNCRTOT,PSNCRPG,PSNCRBG,PSNCREN,PSNCRL2,PSNCRLC1,PSNCRLC2,PSNCRLC3,PSNCRLC4,PSNCRS7,PSNCRS8,PSNCRSUB,PSNFON,PSNCRLF,PSNCRS9,PSNCRSM9
 S Y=$E(PSNVRBEG,1,7) D DD^%DT S PSNCRBG=Y
 S Y=$E(PSNVREND,1,7) D DD^%DT S PSNCREN=Y
 S PSNFON=$S(PSNVRTYP="P":1,1:0)
 S PSNCRL2=PSNCRBG_" to "_PSNCREN I PSNVRPMI S PSNCRL2=PSNCRL2_"  (Including PMI and Warning Labels)"
 S (PSNCROUT,PSNCRTOT,PSNCRLF)=0,PSNCRDEV=$S($E(IOST,1,2)'="C-":"P",1:"C"),PSNCRPG=1
 K PSNCRLIN S $P(PSNCRLIN,"-",78)="",PSNCRSUB=""
 I PSNFON D HD
 ;
 S PSNCH="" F  S PSNCH=$O(PSNVRFIL(PSNCH)) Q:PSNCH=""!(PSNCROUT)  D
 .I 'PSNFON,'PSNCRLF W !
 .D @$S(PSNCH=50.416:"DIN",PSNCH=50.6:"VAG",PSNCH=50.605:"VDC",PSNCH=50.606:"DFO",PSNCH=50.607:"DRU",PSNCH=50.608:"PAT",PSNCH=50.609:"PAS",PSNCH=50.64:"VAD",PSNCH=50.67:"NDC",PSNCH=50.68:"VAP",PSNCH=55.95:"DRM",1:"DRI")
 .I 'PSNFON S PSNCRLF=1
 I PSNCROUT G END
 I PSNVRPMI D PMIP^PSNVCR1
 ;
END ;
 I 'PSNCROUT,'PSNCRTOT W !!,"No data to print.",!
 I PSNCRDEV="P"  W !!,"End of Report.",!
 I 'PSNCROUT,PSNCRDEV="C" W !!,"End of Report.",! K DIR S DIR(0)="E",DIR("A")="Press Return to continue" D ^DIR K DIR
 I PSNCRDEV="C" W !
 E  W @IOF
 K PSNVRBEG,PSNVREND,PSNVRPMI,PSNVRTYP,PSNVRAR,PSNVRFIL,PSNVRSUM
 I 'PSNFON Q
 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
 Q
 ;
 ;
HD ;Report Header
 I $G(PSNCRDEV)="C",$G(PSNCRPG)'=1 W ! K DIR,Y S DIR(0)="E",DIR("A")="Press Return to continue, '^' to exit" D ^DIR K DIR I 'Y S PSNCROUT=1 Q
 W @IOF
 W !,"UPDATE FILE CHANGE REPORT" W:PSNVRSUM="S" "  (Summary)"
 W ?68,"PAGE: "_PSNCRPG,!,PSNCRL2_PSNCRSUB,!,PSNCRLIN S PSNCRPG=PSNCRPG+1
 Q
 ;
 ;
MESS ;
 W !!,"Nothing queued to print.",!
 Q
 ;
 ;
DIN ;print info for Drug Ingredient (#50.416) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.416,PSNCRLC3="DRUG INGREDIENTS"
 I PSNVRSUM="F" S PSNCRSUB="   (Drug Ingredient (#50.416) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PS(50.416,PSNCRA2)) Q:'PSNCRA2  I $G(^PS(50.416,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"DRUG INGREDIENT file (#50.416) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
VAG ;print info for VA Generic (#50.6) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.6,PSNCRLC3="VA GENERIC"
 I PSNVRSUM="F" S PSNCRSUB="   (VA Generic (#50.6) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PSNDF(50.6,PSNCRA2)) Q:'PSNCRA2  I $G(^PSNDF(50.6,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"VA GENERIC file (#50.6) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
VDC ;print info for VA Drug Class (#50.605) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.605,PSNCRLC3="VA DRUG CLASS"
 I PSNVRSUM="F" S PSNCRSUB="   (VA Drug Class (#50.605) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PS(50.605,PSNCRA2)) Q:'PSNCRA2  I $G(^PS(50.605,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"VA DRUG CLASS file (#50.605) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
DFO ;print info for Dosage Form (#50.606) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.606,PSNCRLC3="DOSAGE FORM"
 I PSNVRSUM="F" S PSNCRSUB="   (Dosage Form (#50.606) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PS(50.606,PSNCRA2)) Q:'PSNCRA2  I $G(^PS(50.606,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"DOSAGE FORM file (#50.606) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
DRU ;print info for Drug Units (#50.607) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.607,PSNCRLC3="DRUG UNITS"
 I PSNVRSUM="F" S PSNCRSUB="   (Drug Units (#50.607) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PS(50.607,PSNCRA2)) Q:'PSNCRA2  I $G(^PS(50.607,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"DRUG UNITS file (#50.607) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
PAT ;print info for Package Type (#50.608) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.608,PSNCRLC3="PACKAGE TYPE"
 I PSNVRSUM="F" S PSNCRSUB="   (Package Type (#50.608) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PS(50.608,PSNCRA2)) Q:'PSNCRA2  I $G(^PS(50.608,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"PACKAGE TYPE file (#50.608) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
PAS ;print info for Package Size (#50.609) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.609,PSNCRLC3="PACKAGE SIZE"
 I PSNVRSUM="F" S PSNCRSUB="   (Package Size (#50.609) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PS(50.609,PSNCRA2)) Q:'PSNCRA2  I $G(^PS(50.609,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"PACKAGE SIZE file (#50.609) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
VAD ;print info for VA Dispense Unit (#50.64) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.64,PSNCRLC3="VA DISPENSE UNIT"
 I PSNVRSUM="F" S PSNCRSUB="   (VA Dispense Unit (#50.64) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PSNDF(50.64,PSNCRA2)) Q:'PSNCRA2  I $G(^PSNDF(50.64,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"VA DISPENSE UNIT file (#50.64) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
NDC ;print info for NDC/UPN (#50.67) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.67,PSNCRLC3="NDC/UPN"
 I PSNVRSUM="F" S PSNCRSUB="   (NDC/UPN (#50.67) File cont.)"
 I PSNCRDEV="C",PSNFON W !
 F PSNCRA2=0:0 S PSNCRA2=$O(^PSNDF(50.67,PSNCRA2)) Q:'PSNCRA2  I $G(^PSNDF(50.67,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1 I PSNCRDEV="C",PSNFON,PSNCRAT#20000=0 W "."
 I PSNFON W !!,"NDC/UPN file (#50.67) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
VAP ;print info for VA Product (#50.68) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=50.68,PSNCRLC3="VA PRODUCT"
 I PSNVRSUM="F" S PSNCRSUB="   (VA Product (#50.68) File cont.)"
 I PSNCRDEV="C",PSNFON W !
 F PSNCRA2=0:0 S PSNCRA2=$O(^PSNDF(50.68,PSNCRA2)) Q:'PSNCRA2  I $G(^PSNDF(50.68,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1 I PSNCRDEV="C",PSNFON,PSNCRAT#5000=0 W "."
 I PSNFON W !!,"VA PRODUCT file (#50.68) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
DRM ;print info for Drug Manufacturer (#55.95) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=55.95,PSNCRLC3="DRUG MANUFACTURER"
 I PSNVRSUM="F" S PSNCRSUB="   (Drug Manufacturer (#55.95) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PS(55.95,PSNCRA2)) Q:'PSNCRA2  I $G(^PS(55.95,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"DRUG MANUFACTURER file (#55.95) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
DRI ;print info for Drug Interaction (#56) File
 S PSNCRTOT=1,PSNCRAT=0,PSNCRLC1=56,PSNCRLC3="DRUG INTERACTION"
 I PSNVRSUM="F" S PSNCRSUB="   (Drug Interaction (#56) File cont.)"
 F PSNCRA2=0:0 S PSNCRA2=$O(^PS(56,PSNCRA2)) Q:'PSNCRA2  I $G(^PS(56,PSNCRA2,0))'="" S PSNCRAT=PSNCRAT+1
 I PSNFON W !!,"DRUG INTERACTION file (#56) - "_PSNCRAT_" records"
 I PSNFON,($Y+5)>IOSL D HD Q:PSNCROUT
 D @$S(PSNVRSUM="F":"KLF",1:"KL")
 I $D(PSNVRAR(PSNCRLC1)) D
 .I PSNVRSUM="F" D PRT(PSNCRLC1) Q
 .D SUM(PSNCRLC1)
 I PSNVRSUM="F" D PFUL(PSNCRLC3,PSNCRAT),KLF Q
 D PSUM(PSNCRLC3,PSNCRAT)
 Q
 ;
 ;
PRT(PSNCRS2) ;Print Audit File changes
 ;TMP("PSNFFILE",$J,.01 name, IEN, Field Name, Field Number, File or Subfile #, counter)=Old Value^New Value
 ;PSNCRLC2(File #, IEN, File or Subfile #, Field #)=Count
 N PSNCRSL1,PSNCRSL2,PSNCRSLF,PSNCRSLI,PSNCRSLN,PSNCRLAB,PSNCRNAM,PSNCROCT,PSNCRFN1,PSNCRFN2,PSNCRFN3,PSNCRFN4,PSNCRFN5,PSNCRPAS
 F PSNCRSL1=PSNVRBEG:0 S PSNCRSL1=$O(^DIA(PSNCRS2,"C",PSNCRSL1)) Q:'PSNCRSL1!(PSNVREND'>PSNCRSL1)  D
 .F PSNCRSL2=0:0 S PSNCRSL2=$O(^DIA(PSNCRS2,"C",PSNCRSL1,PSNCRSL2)) Q:'PSNCRSL2  D
 ..S PSNCRSLN=$G(^DIA(PSNCRS2,PSNCRSL2,0)),PSNCRPAS=1
 ..S PSNCRSLI=+$P(PSNCRSLN,"^"),PSNCRSLF=$P(PSNCRSLN,"^",3) Q:'PSNCRSLI  I 'PSNCRSLF S PSNCRPAS=0
 ..I PSNCRPAS D 
 ...S PSNCRFN1=$P(PSNCRSLF,","),PSNCRFN2=$P(PSNCRSLF,",",2) D
 ....S PSNCRFN3=0 I 'PSNCRFN2,$D(PSNVRAR(PSNCRS2,PSNCRFN1)) S PSNCRFN3=PSNVRAR(PSNCRS2,PSNCRFN1) Q
 ....I 'PSNCRFN2 Q
 ....S PSNCRFN3=$G(PSNVRAR(PSNCRS2,PSNCRFN1,PSNCRFN2))
 ..I PSNCRPAS,'PSNCRFN3 Q
 ..I PSNCRPAS S PSNCRFN4=$S(PSNCRFN2:PSNCRFN3,1:PSNCRS2),PSNCRFN5=$S(PSNCRFN2:PSNCRFN2,1:PSNCRFN1)
 ..I PSNCRPAS,'PSNCRFN2 S PSNCRLAB=$$GET1^DID(PSNCRS2,PSNCRFN1,,"LABEL") I PSNCRLAB="" S PSNCRPAS=0
 ..I PSNCRPAS,PSNCRFN2 S PSNCRLAB=$$GET1^DID(PSNCRFN3,PSNCRFN2,,"LABEL") I PSNCRLAB="" S PSNCRPAS=0
 ..I 'PSNCRPAS S PSNCRFN4=9999999,PSNCRFN5=9999999,PSNCRLAB="UNKNOWN"
 ..S PSNCRNAM=$$GET1^DIQ(PSNCRS2,PSNCRSLI,.01) I PSNCRNAM="" S PSNCRNAM="ZZZZMISSING_("_PSNCRSLI_") File entry missing"
 ..S (PSNCRLC2(PSNCRS2,PSNCRSLI,PSNCRFN4,PSNCRFN5),PSNCROCT)=+$G(PSNCRLC2(PSNCRS2,PSNCRSLI,PSNCRFN4,PSNCRFN5))+1
 ..S ^TMP("PSNFFILE",$J,PSNCRNAM,PSNCRSLI,PSNCRLAB,PSNCRFN5,PSNCRFN4,PSNCROCT)=$P($G(^DIA(PSNCRS2,PSNCRSL2,2)),"^")_"^"_$P($G(^DIA(PSNCRS2,PSNCRSL2,3)),"^")
 ;
 Q
 ;
 ;
SUM(PSNCRS6) ;Print Audit File summary changes
 ;PSNCRS7=Total records changed per file
 ;^TMP("PSNSFILE",$J,IEN)=""   Used to indicate this record has already been added to the PSNCRS7 array
 ;PSNCRS8=Total number of Fields changed
 ;^TMP("PSNTFILE",$J,IEN)=""    indicates already added to PSNCRS9 array, for missing PSN file entry
 ;PSNCRSM9=Total number of Fields changes for a missing entry
 N PSNCRSL1,PSNCRSL2,PSNCRSLF,PSNCRSLI,PSNCRSLN,PSNCRM1,PSNCRM2
 F PSNCRSL1=PSNVRBEG:0 S PSNCRSL1=$O(^DIA(PSNCRS6,"C",PSNCRSL1)) Q:'PSNCRSL1!(PSNVREND'>PSNCRSL1)  D
 .F PSNCRSL2=0:0 S PSNCRSL2=$O(^DIA(PSNCRS6,"C",PSNCRSL1,PSNCRSL2)) Q:'PSNCRSL2  D
 ..S PSNCRSLN=$G(^DIA(PSNCRS6,PSNCRSL2,0))
 ..S PSNCRSLI=+$P(PSNCRSLN,"^"),PSNCRSLF=$P(PSNCRSLN,"^",3) Q:'PSNCRSLI!('PSNCRSLF)
 ..S PSNCRM1=$P(PSNCRSLF,","),PSNCRM2=$P(PSNCRSLF,",",2)
 ..I 'PSNCRM2,'$D(PSNVRAR(PSNCRS6,PSNCRSLF)) Q
 ..I PSNCRM2,'$D(PSNVRAR(PSNCRS6,PSNCRM1,PSNCRM2)) Q
 ..I $$GET1^DIQ(PSNCRS6,PSNCRSLI,.01)="" D  Q
 ...S PSNCRS9=PSNCRS9+1
 ...I '$D(^TMP("PSNTFILE",$J,PSNCRSLI)) S ^TMP("PSNTFILE",$J,PSNCRSLI)="",PSNCRSM9=PSNCRSM9+1
 ..S PSNCRS8=PSNCRS8+1
 ..I '$D(^TMP("PSNSFILE",$J,PSNCRSLI)) S ^TMP("PSNSFILE",$J,PSNCRSLI)="",PSNCRS7=PSNCRS7+1
 Q
 ;
 ;
PSUM(PSNCRFDN,PSNCRFTR) ;Print summary values
 I 'PSNFON D  Q
 .W !,PSNCRFDN_"^"_PSNCRFTR_"^"_PSNCRS7_"^"_PSNCRS8
 .I PSNCRS9 W !,PSNCRFDN_" MISSING ENTRIES^"_PSNCRFTR_"^"_PSNCRSM9_"^"_PSNCRS9
 I 'PSNCRS7,'PSNCRS9 D  D KL Q 
 .W !?5,"No Change"
 .I ($Y+5)>IOSL D HD
 I PSNCRS7 D 
 .W !?5,"Records Changed: "_PSNCRS7
 .I ($Y+5)>IOSL D HD I PSNCROUT D KL Q
 .W !?5,"Fields/Sub-fields Changed: "_PSNCRS8
 I PSNCRS9 D
 .W !,PSNCRFDN_" file MISSING ENTRIES:"
 .W !?5,"Records Changed: "_PSNCRSM9
 .I ($Y+5)>IOSL D HD I PSNCROUT D KL Q
 .W !?5,"Fields/Sub-fields Changed: "_PSNCRS9
 D KL
 I ($Y+5)>IOSL D HD
 Q
 ;
 ;
PFUL(PSNPRHLA,PSNPRHLB) ;Print full values
 ;When printing, if 'File or Subfile#' changes within same field name, redisplay Field name because that means
 ;you have the same Field name for a top level and multiple field, and same for .01 name
 N PSNPR1,PSNPR2,PSNPR3,PSNPR4,PSNPR5,PSNPR6,PSNPR7,PSNPRHLD,PSNPRHLC,PSNPRHLN,PSNPRHLM,PSNPRHLO,PSNPRHL1,PSNPRHLH,PSNPRNDC,PSNPRNDM,PSNPRMS1,PSNPRMS2
 S PSNPRNDC=$S(PSNPRHLA="NDC/UPN":0,1:1) K PSNPRNDM
 I 'PSNFON W !,PSNPRHLA_"^Records - "_PSNPRHLB
 I '$D(^TMP("PSNFFILE",$J)) D  Q
 .I PSNFON W !?5,"No Change" D:($Y+5)>IOSL HD Q
 .W !,PSNPRHLA_"^***No Changes***"
 S PSNPRHLD="",PSNPRHL1=0
 S PSNPR1="" F  S PSNPR1=$O(^TMP("PSNFFILE",$J,PSNPR1)) Q:PSNPR1=""!(PSNCROUT)  S PSNPRHLD="" D
 .I 'PSNPRNDC S PSNPRNDM=$S($P($G(^PSNDF(50.67,PSNPR1,0)),"^",2)'="":$P($G(^PSNDF(50.67,PSNPR1,0)),"^",2),1:"Missing NDC")
 .K PSNPRMS2 S PSNPRMS1=0 I $E(PSNPR1,1,11)="ZZZZMISSING" S PSNPRMS1=1,PSNPRMS2=$E(PSNPR1,12,$L(PSNPR1))
 .S PSNPRHLC=0 I PSNFON W !!,$S(PSNPRNDC:PSNPR1,PSNPRMS1:PSNPRMS2,1:PSNPRNDM) I ($Y+5)>IOSL D HD I PSNCROUT Q
 .I 'PSNFON S PSNPRHLH=PSNPRHLA_"^"_$S(PSNPRNDC:PSNPR1,PSNPRMS1:PSNPRMS2,1:PSNPRNDM)
 .F PSNPR2=0:0 S PSNPR2=$O(^TMP("PSNFFILE",$J,PSNPR1,PSNPR2)) D:PSNPRHLD'=""&(PSNPRHL1)&(PSNPR2)&(PSNPRHLD=PSNPR1)&(PSNPRHL1'=PSNPR2) CH1 S PSNPRHLD=PSNPR1,PSNPRHL1=PSNPR2 Q:'PSNPR2!(PSNCROUT)  D
 ..S PSNPR3="" F  S PSNPR3=$O(^TMP("PSNFFILE",$J,PSNPR1,PSNPR2,PSNPR3)) Q:PSNPR3=""!(PSNCROUT)  S PSNPRHLN=0,PSNPRHLM="" D
 ...F PSNPR4=0:0 S PSNPR4=$O(^TMP("PSNFFILE",$J,PSNPR1,PSNPR2,PSNPR3,PSNPR4)) Q:'PSNPR4!(PSNCROUT)  D
 ....F PSNPR5=0:0 S PSNPR5=$O(^TMP("PSNFFILE",$J,PSNPR1,PSNPR2,PSNPR3,PSNPR4,PSNPR5)) D CH2 Q:'PSNPR5!(PSNCROUT)  D
 .....I PSNFON,($Y+5)>IOSL D HD I PSNCROUT Q
 .....F PSNPR6=0:0 S PSNPR6=$O(^TMP("PSNFFILE",$J,PSNPR1,PSNPR2,PSNPR3,PSNPR4,PSNPR5,PSNPR6)) Q:'PSNPR6!(PSNCROUT)  D
 ......S PSNPR7=$G(^TMP("PSNFFILE",$J,PSNPR1,PSNPR2,PSNPR3,PSNPR4,PSNPR5,PSNPR6))
 ......I 'PSNFON S PSNPRHLH=PSNPRHLH_"^"_$P(PSNPR7,"^")_"^"_$P(PSNPR7,"^",2) Q
 ......W !?5,"Old Value: "_$P(PSNPR7,"^") I ($Y+5)>IOSL D HD I PSNCROUT Q
 ......W !?5,"New Value: "_$P(PSNPR7,"^",2) I ($Y+5)>IOSL D HD I PSNCROUT Q
 .....I 'PSNFON W !,PSNPRHLH S PSNPRHLH=$P(PSNPRHLH,"^")_"^"_$P(PSNPRHLH,"^",2)
 Q
 ;
 ;
CH1 ;IEN change of the same name
 Q:PSNCROUT
 S PSNPRHLC=PSNPRHLC+1
 I PSNFON W !!,PSNPR1_" (Duplicate Name #"_PSNPRHLC_")" D:($Y+5)>IOSL HD Q
 S PSNPRHLH=PSNPRHLA_"^"_PSNPR1_" (Duplicate Name #"_PSNPRHLC_")"
 Q
 ;
 ;
CH2 ;Subfile change of the same field name name
 Q:PSNCROUT!('PSNPR5)
 S:'PSNPRHLN PSNPRHLM=PSNPR4_"^"_PSNPR5
 I 'PSNPRHLN,'PSNFON S PSNPRHLH=PSNPRHLH_"^"_PSNPR3_"^"_PSNPR4 S PSNPRHLN=1 Q
 I 'PSNPRHLN W !!?5,PSNPR3_" ("_PSNPR4_")" S PSNPRHLN=PSNPRHLN+1 D:($Y+5)>IOSL HD Q
 S PSNPRHLO=PSNPR4_"^"_PSNPR5 I PSNPRHLO'=PSNPRHLM D  S PSNPRHLM=PSNPRHLO,PSNPRHLN=1 Q
 .I PSNFON W !!?5,PSNPR3_" ("_PSNPR4_")"_" (Duplicate Field.  SubFile #"_$P(PSNPRHLO,"^",2)_")" D:($Y+5)>IOSL HD Q
 .S PSNPRHLH=PSNPRHLH_"^"_PSNPR3_" (SubFile #"_$P(PSNPRHLO,"^",2)_")^"_PSNPR4
 Q
 ;
 ;
KL ;Kill TMP global
 K ^TMP("PSNSFILE",$J),^TMP("PSNTFILE",$J) S (PSNCRS7,PSNCRS8,PSNCRS9,PSNCRSM9)=0
 Q
 ;
 ;
KLF ;Kill TMP global
 K ^TMP("PSNFFILE",$J),PSNCRLC2
 Q