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

GMPLSLI1.m

Go to the documentation of this file.
GMPLSLI1 ;ISP/TC - Problem Selection List Import Utility ;04/13/2020
 ;;2.0;Problem List;**49,55**;Aug 25, 1994;Build 1
 ;
 ; External References:
 ;   ICR  2053   FILE/UPDATE^DIE
 ;   ICR  2320   $$PWD/$$LIST/$$FTG^%ZISH
 ;   ICR  2607   BROWSE^DDBR
 ;   ICR  5553   $$GETURL^XTHC10
 ;   ICR  10103  $$DT^XLFDT
 ;   ICR  10104  $$LJ/$$LOW/$$REPEAT^XLFSTR
 ;   ICR  10026  ^DIR
 ;   ICR  10142  EN^DDIOL
 ;
IMP ; Import categories & diagnoses into a selection list
 N DIR,Y,GMPLLDOK,GMPLOPT
 ;Present the menu of import choices.
 S DIR(0)="S^HF:CSV host file;"
 S DIR(0)=DIR(0)_"WEB:CSV file from a web site"
 S DIR("A")="Select the import method"
 D ^DIR
 S GMPLOPT=Y
 I GMPLOPT="HF" D
 . S GMPLLDOK=$$LOADHF("GMPLSLIM")
 . I GMPLLDOK D IMPCSV("GMPLSLIM")
 I GMPLOPT="WEB" D
 . S GMPLLDOK=$$LOADWEB("GMPLSLIM")
 . I GMPLLDOK D IMPCSV("GMPLSLIM")
 Q
 ;============================================
IMPCSV(GMPLNODE) ;Import comma separated data into the Problem Selection List & Category files
 ; Flag indicators: '#' - Add/edit, '@' - Delete
 ;
 ; The expected format is:
 ;     #/@, Selection List Name, List Class, Category Class
 ;     #/@, Category Sequence, Category Name, Subheader
 ;     #/@, Problem Sequence, Display Text, ICD code, SCT code, SCT designation
 ;
 I '$D(^TMP($J,GMPLNODE)) Q 0
 N GMPLI,GMPLABRT,GMPLTMP,GMPLFLAG,GMPLIMPT,GMPLRNDE
 S (GMPLI,GMPLABRT)=0,GMPLIMPT=1,GMPLRNDE="GMPLIRPT"
 D EN^DDIOL("Starting the import process ... ","","!!")
 W !
 F  S GMPLI=$O(^TMP($J,GMPLNODE,GMPLI)) Q:GMPLI=""  D
 . S GMPLTMP=^TMP($J,GMPLNODE,GMPLI,1)
 . I '$$ISCSV^GMPLSLI2(GMPLTMP) Q
 . S GMPLFLAG=$P(GMPLTMP,",",1)
 . ; Retrieve/validate selection list name & class
 . I GMPLI=1 D
 . . S GMPLABRT=$$VALSLST(GMPLTMP,GMPLFLAG,GMPLIMPT,GMPLRNDE,GMPLABRT)
 . ; Retrieve/validate category information
 . I GMPLFLAG'>0,(GMPLI>1),('$L($$STRIP^XLFSTR($P(GMPLTMP,",",5),""_$C(13)_""))) D
 . . S GMPLABRT=$$VALCAT(GMPLTMP,GMPLFLAG,GMPLIMPT,GMPLRNDE,GMPLABRT)
 . ; Check for valid Problem sequence numbers
 . I GMPLI>2,($L($$STRIP^XLFSTR($P(GMPLTMP,",",5),""_$C(13)_""))) D
 . . I '+$$VSEQ^GMPLINTR(GMPLFLAG,"Problem") S GMPLABRT=1
 . ; Retrieve/validate category problems
 . I GMPLFLAG>0 D
 . . S GMPLABRT=$$VALCPROB(GMPLTMP,GMPLRNDE,GMPLABRT)
 I GMPLABRT D EN^DDIOL("Import process aborted due to validation errors.","","!!") G IMPCSVQT
 D MSGHNDL(GMPLNODE,GMPLRNDE)
 K ^TMP($J,GMPLNODE),^TMP($J,GMPLRNDE)
IMPCSVQT W ! D PAUSE^GMPLX
 Q
 ;============================================
LOADHF(GMPLNOUT) ;Load the CSV host file into ^TMP.
 ;The name of the host file should have a ".CSV" extension.
 N GMPLFILE,GMPLGBL,GMPLLHF,GMPLPATH,GMPLTMP
 S GMPLTMP=$$GETEHF^GMPLUTL4("CSV")
 I GMPLTMP="" Q 0
 S GMPLPATH=$P(GMPLTMP,U,1),GMPLFILE=$P(GMPLTMP,U,2)
 ;Load the host file into ^TMP.
 K ^TMP($J,GMPLNOUT),^TMP($J,"GMPLHCSV")
 S GMPLGBL="^TMP($J,""GMPLHCSV"",1)"
 S GMPLGBL=$NA(@GMPLGBL)
 ;Load the file contents into ^TMP.
 S GMPLLHF=$$FTG^%ZISH(GMPLPATH,GMPLFILE,GMPLGBL,3)
 I GMPLLHF=0 D EN^DDIOL("The host file load failed") H 2 K ^TMP($J,"GMPLHCSV") Q 0
 D RBLCKHF^GMPLSLI2("GMPLHCSV",GMPLNOUT)
 K ^TMP($J,"GMPLHCSV")
 Q 1
 ;============================================
LOADWEB(GMPLNOUT) ;Load the CSV file from a web site into ^TMP
 N DIR,GMPLHDR,GMPLRSLT,GMPLTXT,GMPLURL,Y
 S DIR(0)="F^10:245"
 S DIR("A")="Input the URL for the CSV file"
 D ^DIR
 I (Y="")!(Y=U) Q 0
 S GMPLURL=Y
 S Y=$$LOW^XLFSTR(Y)
 ;Load the file contents into ^TMP.
 K ^TMP($J,GMPLNOUT),^TMP($J,"GMPLWCSV")
 ;DBIA #5553
 S GMPLRSLT=$$GETURL^XTHC10(GMPLURL,10,"^TMP($J,""GMPLWCSV"")",.GMPLHDR)
 I $P(GMPLRSLT,U,1)'=200 D  Q 0
 . S GMPLTXT="Could not load the csv file: "
 . S GMPLTXT=GMPLTXT_"Error "_$P(GMPLRSLT,U,1)_" "_$P(GMPLRSLT,U,2)
 . D EN^DDIOL(.GMPLTXT) H 2
 . K ^TMP($J,"GMPLWCSV")
 D RBLCKWEB^GMPLSLI2("GMPLWCSV",GMPLNOUT)
 K ^TMP($J,"GMPLWCSV")
 Q 1
 ;============================================
MSGHNDL(GMPLNODE,GMPLRNDE) ; Message prompt and handling
 N GMPLANS,GMPLSVOK,GMPLPUOK,GMPLMSG
 S GMPLANS=$$ASKYN^GMPLUTL4("Y","Do you want to review the problem selection list contents")
 I GMPLANS D BROWSE^DDBR("^TMP($J,"""_GMPLRNDE_""")","NR","Selection List Contents To Be Imported")
 S GMPLANS=$$ASKYN^GMPLUTL4("N","Do you want to save the imported list contents")
 I GMPLANS D
 . S GMPLSVOK=$$UPDTCNT(GMPLNODE)
 . I GMPLSVOK D
 . . S GMPLPUOK=$$POSTUPDT(GMPLNODE)
 . . I GMPLPUOK D EN^DDIOL("Import process completed successfully.","","!!")
 . . E  D
 . . . S GMPLMSG(1)="Import process partially failed due to the above errors."
 . . . S GMPLMSG(1,"F")="!!"
 . . . S GMPLMSG(2)="Some content may/may not have been saved completely."
 . . . S GMPLMSG(3)="Verify newly imported content w/the import file, correct any errors, & re-import"
 . . . D EN^DDIOL(.GMPLMSG)
 E  D EN^DDIOL("Import process aborted.","","!!")
 Q
 ;============================================
POSTUPDT(GMPLNODE) ; Save the list categories & diagnoses
 N GMPLI,GMPLREC,GMPLFLAG,GMPLLNME,GMPLCCLS
 N GMPLCLS,GMPLCNME,GMPLADDC,GMPLOK
 S (GMPLI,GMPLADDC)=0,GMPLOK=1
 F  S GMPLI=$O(^TMP($J,GMPLNODE,GMPLI)) Q:GMPLI=""  D
 . S GMPLREC=^TMP($J,GMPLNODE,GMPLI,1)
 . I GMPLREC="" Q
 . S GMPLFLAG=$P(GMPLREC,",",1)
 . I GMPLI=1 D
 . . S GMPLLNME=$P(GMPLREC,",",2),GMPLCCLS=$$UP^XLFSTR($P(GMPLREC,",",4))
 . . S GMPLCLS=$S(GMPLCCLS="NATIONAL":"N",GMPLCCLS="LOCAL":"L",GMPLCCLS="VISN":"V",1:"")
 . ; Retrieve & save category info
 . I GMPLFLAG'>0,(GMPLI>1) D  Q
 . . S GMPLCNME=$$UP^XLFSTR($P(GMPLREC,",",3)),GMPLADDC=$S(GMPLFLAG="#":1,1:0)
 . . S GMPLOK=$$SVC12511(GMPLREC,GMPLFLAG,GMPLCLS,GMPLCCLS,GMPLOK)
 . . I GMPLOK S GMPLOK=$$SVC12501(GMPLREC,GMPLFLAG,GMPLLNME,GMPLOK)
 . ; Retrieve & save category problems
 . I GMPLADDC,(GMPLFLAG>0) D
 . . S GMPLOK=$$SVPROB(GMPLREC,GMPLCNME,GMPLOK)
 I $D(^GMPL(125.11,0)) S $P(^GMPL(125.11,0),U,3)=0
 K ^GMPLCIEN(1),^GMPLINRT(1)
 Q GMPLOK
 ;============================================
SVC12501(GMPLREC,GMPLFLAG,GMPLLNME,GMPLOK) ; Save category info into subfile 125.01
 N GMPLLIEN,GMPLDA,GMPLKFDA,GMPLFDA,GMPLIENS
 N GMPLCSEQ,GMPLCNME,GMPLSHDR,GMPLMSG,GMPLTXT
 S GMPLCSEQ=$P(GMPLREC,",",2),GMPLCNME=$$UP^XLFSTR($P(GMPLREC,",",3))
 S GMPLSHDR=$P(GMPLREC,",",4)
 S GMPLLIEN=+$$FIND1^DIC(125,"","K",GMPLLNME,"","","GMPLMSG")
 I GMPLFLAG="@",(GMPLLIEN>0) D  G SVCQT
 . S GMPLDA=+$$FIND1^DIC(125.01,","_GMPLLIEN_",","K",GMPLCNME,"","","GMPLMSG")
 . I GMPLDA>0 D
 . . S GMPLKFDA(125.01,""_GMPLDA_","_GMPLLIEN_",",.01)="@"
 . . D FILE^DIE("K","GMPLKFDA","GMPLMSG")
 I GMPLFLAG="@" G SVCQT
 S GMPLIENS=$S(GMPLLIEN>0:"+2,"_GMPLLIEN_",",1:"+2,+1,")
 S GMPLFDA(125.01,GMPLIENS,.01)=GMPLCNME
 S GMPLFDA(125.01,GMPLIENS,.02)=GMPLCSEQ
 S GMPLFDA(125.01,GMPLIENS,.03)=GMPLSHDR
 S GMPLFDA(125.01,GMPLIENS,.04)="YES"
 D UPDATE^DIE("E","GMPLFDA","","GMPLMSG")
SVCQT I $D(GMPLMSG) D
 . S GMPLTXT(1)="Unable to "_$S(GMPLFLAG="@":"delete",1:"store")
 . S GMPLTXT(1)=GMPLTXT(1)_" category "_GMPLCNME_" under list "_GMPLLNME
 . S GMPLTXT(2)="Error "_GMPLMSG("DIERR",1)_": "_GMPLMSG("DIERR",1,"TEXT",1)
 . D EN^DDIOL(.GMPLTXT) S GMPLOK=0
 Q GMPLOK
 ;============================================
SVC12511(GMPLREC,GMPLFLAG,GMPLCLS,GMPLCCLS,GMPLOK) ; Save category info into file 125.11
 N GMPLCSEQ,GMPLCNME,GMPLSHDR,GMPLKFDA
 N GMPLMSG,GMPLFDA,GMPLTXT
 K ^GMPLCIEN(1),^GMPLINRT(1)
 S GMPLCSEQ=$P(GMPLREC,",",2),GMPLCNME=$$UP^XLFSTR($P(GMPLREC,",",3))
 S GMPLSHDR=$P(GMPLREC,",",4)
 ;If there are any existing entries for this category,
 ;delete them prior to storing the new set.
 S ^GMPLCIEN(1)=+$$FIND1^DIC(125.11,"","K",GMPLCNME,"","","GMPLMSG")
 I $G(^GMPLCIEN(1))>0 D
 . S ^GMPLINRT(1)=^GMPLCIEN(1)
 . S GMPLKFDA(125.11,""_$G(^GMPLCIEN(1))_",",.01)="@"
 . D FILE^DIE("K","GMPLKFDA","GMPLMSG")
 E  S ^GMPLINRT(1)=""
 I GMPLFLAG="@" G SVCQT1
 S GMPLFDA(125.11,"+1,",.01)=GMPLCNME
 S GMPLFDA(125.11,"+1,",.02)=$$DT^XLFDT
 S GMPLFDA(125.11,"+1,",.03)=GMPLCLS
 D UPDATE^DIE("","GMPLFDA","^GMPLINRT","GMPLMSG")
SVCQT1 I $D(GMPLMSG) D  Q
 . S GMPLTXT(1)="Unable to "_$S(GMPLFLAG="@":"delete",1:"store")
 . S GMPLTXT(1)=GMPLTXT(1)_" category "_GMPLCNME_" and class "_GMPLCCLS_" in file #125.11."
 . S GMPLTXT(2)="Error "_GMPLMSG("DIERR",1)_": "_GMPLMSG("DIERR",1,"TEXT",1)
 . D EN^DDIOL(.GMPLTXT) S GMPLOK=0
 Q GMPLOK
 ;============================================
SVPROB(GMPLREC,GMPLCNME,GMPLOK) ; Save category problems into subfile 125.11
 N GMPLDTXT,GMPLPSEQ,GMPLICD,GMPLSCTC,GMPLSCTD
 N GMPLLTRM,GMPLMSG,GMPLTXT,GMPLISTR,GMPLFDA
 I $L(GMPLREC,",")>5 D
 . N GMPLTPC,GMPLDPC,GMPLK
 . S GMPLTPC=$L(GMPLREC,","),GMPLDPC=GMPLTPC-4,GMPLDTXT=""
 . F GMPLK=2:1:(GMPLDPC+1) S GMPLDTXT=GMPLDTXT_$S(GMPLK>2:",",1:"")_$P(GMPLREC,",",GMPLK)
 . S GMPLPSEQ=$$STRIP^XLFSTR($P(GMPLREC,",",1)," "),GMPLDTXT=$$STRIP^XLFSTR(GMPLDTXT,"""")
 . S GMPLICD=$$STRIP^XLFSTR($P(GMPLREC,",",(GMPLDPC+2))," ")
 . S GMPLSCTC=$$STRIP^XLFSTR($$STRIP^XLFSTR($P(GMPLREC,",",(GMPLDPC+3)),"C")," ")
 . S GMPLSCTD=$$STRIP^XLFSTR($$STRIP^XLFSTR($P($P(GMPLREC,",",(GMPLDPC+4)),""_$C(13)_""),"D")," ")
 E  D
 . S GMPLPSEQ=$$STRIP^XLFSTR($P(GMPLREC,",",1)," "),GMPLDTXT=$$STRIP^XLFSTR($P(GMPLREC,",",2),"""")
 . S GMPLICD=$$STRIP^XLFSTR($P(GMPLREC,",",3)," "),GMPLSCTC=$$STRIP^XLFSTR($$STRIP^XLFSTR($P(GMPLREC,",",4),"C")," ")
 . S GMPLSCTD=$$STRIP^XLFSTR($$STRIP^XLFSTR($P($P(GMPLREC,",",5),""_$C(13)_""),"D")," ")
 S GMPLLTRM=$$GETEXIEN^GMPLX(GMPLSCTC,GMPLSCTD)
 I GMPLDTXT["sct" S GMPLDTXT=$P(GMPLDTXT,"(")_"("_$$UP^XLFSTR($P($P(GMPLDTXT,"(",2)," "))_" "_$P($P(GMPLDTXT,"(",2)," ",2)
 I GMPLDTXT'["SCT" S GMPLDTXT=GMPLDTXT_" (SCT "_GMPLSCTC_")"
 I +GMPLLTRM<0 D  Q
 . S GMPLTXT(1)="Unable to save "_GMPLDTXT
 . S GMPLTXT(2)="Error: "_$P(GMPLLTRM,U,2)
 . D EN^DDIOL(.GMPLTXT) S GMPLOK=0
 S GMPLISTR=$S(^GMPLCIEN(1)>0:"+2,"_^GMPLCIEN(1)_",",1:"+2,"_^GMPLINRT(1)_",")
 S GMPLFDA(125.111,GMPLISTR,.01)=GMPLLTRM
 S GMPLFDA(125.111,GMPLISTR,.02)=GMPLPSEQ
 S GMPLFDA(125.111,GMPLISTR,.03)=GMPLDTXT
 S GMPLFDA(125.111,GMPLISTR,.04)=GMPLICD
 S GMPLFDA(125.111,GMPLISTR,.05)=GMPLSCTC
 S GMPLFDA(125.111,GMPLISTR,.06)=GMPLSCTD
 D UPDATE^DIE("","GMPLFDA","","GMPLMSG")
 I $D(GMPLMSG) D
 . S GMPLTXT(1)="Unable to store problem: "_GMPLDTXT_" from category "_GMPLCNME_"."
 . S GMPLTXT(2)="Error "_GMPLMSG("DIERR",1)_": "_GMPLMSG("DIERR",1,"TEXT",1)
 . D EN^DDIOL(.GMPLTXT) S GMPLOK=0
 Q GMPLOK
 ;============================================
UPDTCNT(GMPLNODE) ; Save/delete the list name & class
 ; Flag indicators: # - Add/edit list, @ - Delete list
 N GMPLLST,GMPLFDA,GMPLMSG,GMPLLNME,GMPLLCLS,GMPLCLS
 N GMPLSUC,GMPLTXT,GMPLIEN,GMPLINRT,GMPLFLAG
 S GMPLSUC=1
 S GMPLLST=^TMP($J,GMPLNODE,1,1)
 S GMPLFLAG=$P(GMPLLST,",",1)
 S GMPLLNME=$$UP^XLFSTR($P(GMPLLST,",",2))
 S GMPLLCLS=$$UP^XLFSTR($P(GMPLLST,",",3))
 S GMPLCLS=$S(GMPLLCLS="NATIONAL":"N",GMPLLCLS="LOCAL":"L",GMPLLCLS="VISN":"V",1:"")
 S GMPLIEN=+$$FIND1^DIC(125,"","K",GMPLLNME,"","","GMPLMSG")
 I GMPLIEN>0 D
 . S GMPLINRT(1)=GMPLIEN
 . S GMPLFDA(125,""_GMPLIEN_",",.01)="@"
 . D FILE^DIE("K","GMPLFDA","GMPLMSG")
 I GMPLFLAG="@" G UPQT
 S GMPLFDA(125,"+1,",.01)=GMPLLNME
 S GMPLFDA(125,"+1,",.02)=$$DT^XLFDT
 S GMPLFDA(125,"+1,",.04)=GMPLCLS
 D UPDATE^DIE("","GMPLFDA","GMPLINRT","GMPLMSG")
UPQT I $D(GMPLMSG) D
 . S GMPLTXT(1)="Unable to "_$S(GMPLFLAG="@":"delete",1:"store")
 . S GMPLTXT(1)=GMPLTXT(1)_" list "_GMPLLNME_" and class "_GMPLLCLS_" in file #125."
 . S GMPLTXT(2)="Error: "_GMPLMSG("DIERR",1,"TEXT",1)
 . D EN^DDIOL(.GMPLTXT)
 . S GMPLSUC=0
 ;Reset the 125 0 node so holes are not left.
 I $D(^GMPL(125,0)) S $P(^GMPL(125,0),U,3)=0
 Q GMPLSUC
 ;============================================
VALCAT(GMPLTMP,GMPLFLAG,GMPLIMPT,GMPLRNDE,GMPLABRT) ; Validate category info
 N GMPLCSEQ,GMPLCNME,GMPLSHDR,GMPLHSTR,GMPLSQST,GMPLNL
 S GMPLCSEQ=$P(GMPLTMP,",",2),GMPLCNME=$P(GMPLTMP,",",3)
 S GMPLSHDR=$P(GMPLTMP,",",4),GMPLHSTR="Subheader: "_GMPLSHDR
 S GMPLNL=$G(^TMP($J,GMPLRNDE))
 I '+$$VFLAG^GMPLINTR(GMPLFLAG) S GMPLABRT=1
 I '+$$VSEQ^GMPLINTR(GMPLCSEQ,"Category") S GMPLABRT=1
 E  S GMPLSQST="Category Sequence: "_GMPLCSEQ
 I '+$$VNAME^GMPLINTR(GMPLCNME,GMPLIMPT,"Category") D
 . D EN^DDIOL(" For category sequence #"_GMPLCSEQ_".")
 . S GMPLABRT=1
 I 'GMPLABRT D
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)=""
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)="Category Name: "_GMPLCNME_$S(GMPLFLAG="@":"      ***MARKED FOR DELETION!!!***",1:"")
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)=$$LJ^XLFSTR(GMPLHSTR,47)_$$LJ^XLFSTR(GMPLSQST,33)
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)=""
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)="Prob"_$J("SNOMED CT",10)_$J("SNOMED CT",21)
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)="Seq"_$J("Concept",9)_$J("Designation",25)_$J("ICD Code",18)_$J("SNOMED CT Description",42)
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)=$$REPEAT^XLFSTR("-",150)
 S ^TMP($J,GMPLRNDE)=GMPLNL
 Q GMPLABRT
 ;============================================
VALCPROB(GMPLTMP,GMPLRNDE,GMPLABRT) ; Validate category problems
 N GMPLPSEQ,GMPLDTXT,GMPLICD,GMPLSCTC,GMPLSCTD,GMPLNL
 S GMPLNL=$G(^TMP($J,GMPLRNDE))
 I $L(GMPLTMP,",")>5 D
 . N GMPLTPC,GMPLDPC,GMPLK
 . S GMPLTPC=$L(GMPLTMP,","),GMPLDPC=GMPLTPC-4,GMPLDTXT=""
 . F GMPLK=2:1:(GMPLDPC+1) S GMPLDTXT=GMPLDTXT_$S(GMPLK>2:",",1:"")_$P(GMPLTMP,",",GMPLK)
 . S GMPLPSEQ=$$STRIP^XLFSTR($P(GMPLTMP,",",1)," "),GMPLDTXT=$$STRIP^XLFSTR(GMPLDTXT,"""")
 . S GMPLICD=$$STRIP^XLFSTR($P(GMPLTMP,",",(GMPLDPC+2))," ")
 . S GMPLSCTC=$$STRIP^XLFSTR($$STRIP^XLFSTR($P(GMPLTMP,",",(GMPLDPC+3)),"C")," ")
 . S GMPLSCTD=$$STRIP^XLFSTR($$STRIP^XLFSTR($P($P(GMPLTMP,",",(GMPLDPC+4)),""_$C(13)_""),"D")," ")
 E  D
 . S GMPLPSEQ=$$STRIP^XLFSTR($P(GMPLTMP,",",1)," "),GMPLDTXT=$$STRIP^XLFSTR($P(GMPLTMP,",",2),"""")
 . S GMPLICD=$$STRIP^XLFSTR($P(GMPLTMP,",",3)," "),GMPLSCTC=$$STRIP^XLFSTR($$STRIP^XLFSTR($P(GMPLTMP,",",4),"C")," ")
 . S GMPLSCTD=$$STRIP^XLFSTR($$STRIP^XLFSTR($P($P(GMPLTMP,",",5),""_$C(13)_""),"D")," ")
 I GMPLDTXT["sct" S GMPLDTXT=$P(GMPLDTXT,"(")_"("_$$UP^XLFSTR($P($P(GMPLDTXT,"(",2)," "))_" "_$P($P(GMPLDTXT,"(",2)," ",2)
 I GMPLDTXT'["SCT" S GMPLDTXT=GMPLDTXT_" (SCT "_GMPLSCTC_")"
 I '+$$VICD^GMPLINTR(GMPLICD) S GMPLABRT=1
 I '+$$VSCTCODE^GMPLINTR(GMPLSCTC) S GMPLABRT=1 Q GMPLABRT
 I '+$$VSCTDSGN^GMPLINTR(GMPLSCTC,GMPLSCTD,$P(GMPLDTXT," (SCT")) S GMPLABRT=1
 I 'GMPLABRT D
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)=$$LJ^XLFSTR(GMPLPSEQ,5)_$$LJ^XLFSTR(GMPLSCTC,21)_$$LJ^XLFSTR(GMPLSCTD,21)_$$LJ^XLFSTR(GMPLICD,29)_$$LJ^XLFSTR(GMPLDTXT,80)
 S ^TMP($J,GMPLRNDE)=GMPLNL
 Q GMPLABRT
 ;============================================
VALSLST(GMPLTMP,GMPLFLAG,GMPLIMPT,GMPLRNDE,GMPLABRT) ; Validate selection list & class
 N GMPLLNME,GMPLLCLS,GMPLCCLS,GMPLNL
 S GMPLLNME=$P(GMPLTMP,",",2),GMPLLCLS=$P(GMPLTMP,",",3)
 S GMPLCCLS=$P(GMPLTMP,",",4),GMPLNL=0
 K ^TMP($J,GMPLRNDE)
 I GMPLFLAG="@" S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)="***MARKED FOR DELETION!!!***"
 I '+$$VFLAG^GMPLINTR(GMPLFLAG) S GMPLABRT=1
 I '+$$VNAME^GMPLINTR(GMPLLNME,GMPLIMPT,"List") S GMPLABRT=1
 I '+$$VCLASS^GMPLINTR(GMPLLCLS,GMPLIMPT,"List") S GMPLABRT=1
 I '+$$VCLASS^GMPLINTR(GMPLCCLS,GMPLIMPT,"Category") S GMPLABRT=1
 I 'GMPLABRT D
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)="Selection List Name: "_GMPLLNME
 . S GMPLNL=GMPLNL+1,^TMP($J,GMPLRNDE,GMPLNL)="List Class: "_GMPLLCLS_$J("Category Class: ",34)_GMPLCCLS
 S ^TMP($J,GMPLRNDE)=GMPLNL
 Q GMPLABRT