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

XPDANLYZ4.m

Go to the documentation of this file.
XPDANLYZ4 ;OAK/RSF- BUILD ANALYZER ;10/28/22
 ;;8.0;KERNEL;**782**;Jul 10, 1995;Build 4
 ;;Per VHA Directive 2004-038, this routine should not be modified.
 ;
FCHK(BNUM,XPD) ;FILE CHECK
 ; BNUM = build number
 I $P(^XPD(9.6,BNUM,4,XPD,222),"^",3)="f" D FSEQ(XPD) Q
 N FXX,XP1 S XP1=0 F  S XP1=$O(^XPD(9.6,BNUM,4,XPD,2,XP1)) Q:'$G(XP1)  S FXX=XP1 D
 . N J,FLDNUM S (FLDNUM,J)=0 F  S J=$O(^XPD(9.6,BNUM,4,XPD,2,XP1,J)) Q:'$G(J)  F  S FLDNUM=$O(^XPD(9.6,BNUM,4,XPD,2,XP1,J,FLDNUM)) Q:'(FLDNUM)  D SDES
 Q
FSEQ(FXX) ;
 ;Get basic file info
 N XPDFARR
 D FILE^DID(FXX,"","NAME;GLOBAL NAME;DESCRIPTION;DISTRIBUTION PACKAGE","XPDFARR")
 ;check if name is in capitals:
 N CAPS S CAPS=0
 I XPDFARR("NAME")'=$$UP^XLFSTR(XPDFARR("NAME")) S CAPS=1 ; if caps=1 not capitalized
 S XPDARR("FILE",FXX,"NAME")=XPDFARR("NAME")
 S:CAPS XPDARR("FILE",FXX,"WARNING","ANAME")="FILE NAME must be in UPPERCASE."    ;XPDFARR("NAME")_" ("_FXX_") must be in UPPERCASE."
 ;check global
 I XPDFARR("GLOBAL NAME")["^DIC" S XPDARR("FILE",FXX,"WARNING","ADIC")=XPDFARR("GLOBAL NAME")
 I XPDFARR("GLOBAL NAME")["^DIZ" S XPDARR("FILE",FXX,"WARNING","ADIZ")=XPDFARR("GLOBAL NAME")
 ;check file description
 N XT S XT=$O(XPDFARR("DESCRIPTION"," "),-1) S:'$G(XT) XT=0
 N JJ S JJ=0 F  S JJ=$O(XPDFARR("DESCRIPTION",JJ)) Q:'JJ  S XPDARR("FILE",FXX,"DESCRIPTION",JJ)=XPDFARR("DESCRIPTION",JJ)
 I XT=0 S XPDARR("FILE",FXX,"WARNING","DESCRIPTION")="File DESCRIPTION missing.",XPDARR("FILE",FXX,"DESCRIPT")="No"
 S:XT=1 XPDARR("FILE",FXX,"WARNING","DESCRIPTION")="File has minimal File description."
 S:XT>0 XPDARR("FILE",FXX,"DESCRIPT")="Yes"
 I $G(XPDFARR("DISTRIBUTION PACKAGE"))]"" S XPDARR("FILE",FXX,"PKG")=XPDFARR("DISTRIBUTION PACKAGE")
 I $G(XPDFARR("DISTRIBUTION PACKAGE"))']"" S XPDARR("FILE",FXX,"WARNING","PACKAGE")="DISTRIBUTION PACKAGE is not defined for this file."
 ;ZW XPDARR
 ;check fields for help prompt, description, name
 N FCNT,ICNT S (FCNT,ICNT)=0
 N FNM1,FLD1 S FLD1=0,FNM1="" F  S FNM1=$O(^DD(FXX,"B",FNM1)) Q:FNM1']""  F  S FLD1=$O(^DD(FXX,"B",FNM1,FLD1)) Q:'FLD1  D
 . N XPFF1 D FIELD^DID(FXX,FLD1,"","LABEL;HELP-PROMPT;DESCRIPTION","XPFF1") Q:'$D(XPFF1)
 . N FNN S FNN=FNM1_" (#"_FLD1_")"
 . S XPDARR("FILE",FXX,"FIELD",FNN,"AA",0)=" Field - "_FNN_":"
 . I '$D(XPFF1("DESCRIPTION")) S XPDARR("FILE",FXX,"FIELD",FNN,"DESCRIPTION",0)=" Description missing."
 . I $D(XPFF1("DESCRIPTION")) S XPDARR("FILE",FXX,"FIELD",FNN,"DESCRIPTION",0)=" Description:" D
 .. N JJ S JJ=0 F  S JJ=$O(XPFF1("DESCRIPTION",JJ)) Q:'JJ  S XPDARR("FILE",FXX,"FIELD",FNN,"DESCRIPTION",JJ)=$J(" ",5)_XPFF1("DESCRIPTION",JJ)
 . I '$D(XPFF1("HELP-PROMPT")) S XPDARR("FILE",FXX,"FIELD",FNN,"HELP-PROMPT",0)=" Help-Prompt: missing."
 . I $D(XPFF1("HELP-PROMPT")) S XPDARR("FILE",FXX,"FIELD",FNN,"HELP-PROMPT",0)=" Help-Prompt:" D
 .. N HTXT S HTXT=XPFF1("HELP-PROMPT") I $L(HTXT)<75 S XPDARR("FILE",FXX,"FIELD",FNN,"HELP-PROMPT",1)=$J(" ",5)_HTXT
 .. I $L(HTXT)>74 N HPARR D CUTL(74,HTXT) I $D(HPARR) S XPDARR("FILE",FXX,"FIELD",FNN,"HELP-PROMPT",1)=$J(" ",5)_HPARR(1),XPDARR("FILE",FXX,"FIELD",FNN,"HELP-PROMPT",2)=$J(" ",5)_HPARR(2)
 ; xref check
 D XREF^XPDANLYZ2
 ;SUBFILE CHECK
 N XPDSARR,XPDSUB S XPDSUB=0 I $D(^DD(FXX,"SB"))  F  S XPDSUB=$O(^DD(FXX,"SB",XPDSUB)) Q:'XPDSUB  D
 . S XPDSARR($O(^DD(FXX,"SB",XPDSUB,0)))=XPDSUB
 . N FLDNUM,FLDARR S FLDNUM=0 F  S FLDNUM=$O(^DD(XPDSUB,FLDNUM)) Q:'FLDNUM  D
 .. D FIELD^DID(XPDSUB,FLDNUM,"","LABEL;HELP-PROMPT;DESCRIPTION;EXECUTABLE HELP","FLDARR") Q:'$D(FLDARR)
 .. S FCNT=FCNT+1,CAPS=0
 .. N FNAME S FNAME=FLDARR("LABEL") I FNAME'=$$UP^XLFSTR(FNAME) S CAPS=1
 .. S:CAPS XPDARR("FILE",FXX,FLDNUM,"WARNING","NAME")=FNAME_" (# "_FLDNUM_") should be UPPERCASE."
 .. S:FLDARR("HELP-PROMPT")']"" XPDARR("FILE",FXX,FLDNUM,"WARNING","HELP-PROMPT")=FNAME_" (#"_FLDNUM_") - Help Prompt missing.",XPDARR("FILE",FXX,"FIELD",FNAME,"HELP-PROMPT",0)=" Help Prompt missing."
 .. S:FLDARR("DESCRIPTION")']"" XPDARR("FILE",FXX,FLDNUM,"WARNING","DESCRIPTION")=FNAME_" (#"_FLDNUM_") - Field Description missing.",XPDARR("FILE",FXX,"FIELD",FNAME,"DESCRIPTION",0)=" Description missing."
 .. S XPDARR("FILE",FXX,"FIELD",FNAME,"AA",0)=" "_FNAME_" (#"_FLDNUM_"):"
 .. I FLDARR("HELP-PROMPT")]"" S XPDARR("FILE",FXX,"FIELD",FNAME,"HELP-PROMPT",0)=" Help Prompt:" D
 ... N HTXT S HTXT=FLDARR("HELP-PROMPT") I $L(HTXT)<75 S XPDARR("FILE",FXX,"FIELD",FNAME,"HELP-PROMPT",1)=$J(" ",5)_HTXT
 ... I $L(HTXT)>74 N HPARR D CUTL(74,HTXT) I $D(HPARR) S XPDARR("FILE",FXX,"FIELD",FNAME,"HELP-PROMPT",1)=$J(" ",5)_HPARR(1),XPDARR("FILE",FXX,"FIELD",FNAME,"HELP-PROMPT",2)=$J(" ",5)_HPARR(2)
 .. I FLDARR("DESCRIPTION")]"" S XPDARR("FILE",FXX,"FIELD",FNAME,"DESCRIPTION",0)=" Field Description:" D
 ... N JJ S JJ=0 F  S JJ=$O(FLDARR("DESCRIPTION",JJ)) Q:'JJ  S XPDARR("FILE",FXX,"FIELD",FNAME,"DESCRIPTION",JJ)=$J(" ",5)_FLDARR("DESCRIPTION",JJ)
 .. I FLDARR("HELP-PROMPT")]"",FLDARR("DESCRIPTION")]"" D
 ... N SHP,SDES S SHP=$TR(FLDARR("HELP-PROMPT")," ",""),SDES=" "
 ... N KK S KK=0 F  S KK=$O(FLDARR("DESCRIPTION",KK)) Q:'KK  S SDES=SDES_" "_FLDARR("DESCRIPTION",KK)
 ... S SDES=$TR(SDES," ","")
 ... I SDES=SHP S XPDARR("FILE",FXX,FLDNUM,"WARNING","Duplicate")=FNAME_" (#"_FLDNUM_") - Help and Description are identical"
 .. I $D(XPDARR("FILE",FXX,FLDNUM)) S ICNT=ICNT+1
 . I $D(XPDARR("FILE",FXX,FLDNUM)) S ICNT=ICNT+1
 I ICNT>0 S XPDARR("FILE",FXX,"FIELD-WARNING")=""
 K FXX
 Q
 ; 
SDES ;gets build description
 N XPDFLD,FXX1 S XPDFLD=0  ;
TA K XPDFARR D FILE^DID(FXX,"","NAME","XPDFARR")
 I '$D(XPDFARR) S FXX1=FXX,FXX=^DD(FXX,0,"UP"),XPDFLD=XPDFLD+1 Q:$G(XPDFLD)>1  G TA
 S XPDARR("FILE",FXX,"NAME")=XPDFARR("NAME")
 I '$G(FXX1) S FXX1=FXX
 K FLDARR D FIELD^DID(FXX1,FLDNUM,"","*","FLDARR")  ;D FIELD^DID(FXX,FLDNUM,"","LABEL;HELP-PROMPT;DESCRIPTION","FLDARR")
 Q:'$D(FLDARR)
 N CAPS S CAPS=0  ;FCNT=FCNT+1,
 N FNAME,FNN S FNAME=FLDARR("LABEL"),FNN=FNAME_" (#"_FLDNUM_")" I FNAME'=$$UP^XLFSTR(FNAME) S CAPS=1
 S:CAPS XPDARR("FILE",FXX,FLDNUM,"WARNING","NAME")="NAME (#.01)  should be UPPERCASE."  ;FNAME_" (# "_FLDNUM_") should be UPPERCASE."
 S:FLDARR("HELP-PROMPT")']"" XPDARR("FILE",FXX,FLDNUM,"WARNING","HELP-PROMPT")=FNN_" - Help Prompt missing.",XPDARR("FILE",FXX,"FIELD-WARNING")=""
 S:FLDARR("DESCRIPTION")']"" XPDARR("FILE",FXX,FLDNUM,"WARNING","DESCRIPTION")=FNN_" - Field Description missing.",XPDARR("FILE",FXX,"DESCRIPT")="No",XPDARR("FILE",FXX,"FIELD-WARNING")=""
 I FLDARR("HELP-PROMPT")]"",FLDARR("DESCRIPTION")]"" D
 . N SHP,SDES S SHP=$TR(FLDARR("HELP-PROMPT")," ",""),SDES=" "
 . N KK S KK=0 F  S KK=$O(FLDARR("DESCRIPTION",KK)) Q:'KK  S SDES=SDES_" "_FLDARR("DESCRIPTION",KK)
 . S SDES=$TR(SDES," ","")
 . I SDES=SHP S XPDARR("FILE",FXX,FLDNUM,"WARNING","Duplicate")=FNN_" - Help and Description are identical"
 I FLDARR("DESCRIPTION")]"" D
 . S XPDARR("FILE",FXX,"DESCRIPT")="Yes"
 . S XPDARR("FILE",FXX,FLDNUM,"DESCRIPTION",.1)=""
 . N XTXT S XTXT="FIELD: " S:FXX'=FXX1 XTXT="SUBFILE "_FXX1_"; FIELD: "
 . S XPDARR("FILE",FXX,FLDNUM,"DESCRIPTION",.5)=XTXT_FLDNUM_": "_FLDARR("LABEL"),XPDARR("FILE",FXX,"DESCRIPT")="Yes"
 . N JJ S JJ=0 F  S JJ=$O(FLDARR("DESCRIPTION",JJ)) Q:'JJ  S XPDARR("FILE",FXX,FLDNUM,"DESCRIPTION",JJ)=FLDARR("DESCRIPTION",JJ)
 ;ADDING HELP-PROMPT AND TECH DESCRIPTION UNDER DESCRIPTION FOR SPELL CHECK FUNCTION
 N XXP S XXP=$O(XPDARR("FILE",FXX,FLDNUM,"DESCRIPTION",999),-1) I '$G(XXP) S XXP=0
 I FLDARR("HELP-PROMPT")']"" S XXP=XXP+1,XPDARR("FILE",FXX,FLDNUM,"DESCRIPTION",XXP)="HELP-PROMPT: missing."
 I FLDARR("HELP-PROMPT")]"" D
 . S XXP=XXP+1,XPDARR("FILE",FXX,FLDNUM,"DESCRIPTION",XXP)="HELP-PROMPT:",XXP=XXP+1,XPDARR("FILE",FXX,FLDNUM,"DESCRIPTION",XXP)=FLDARR("HELP-PROMPT")
 I XXP>0 S XPDARR("FILE",FXX,"FIELD DESCRIPTIONS")=""
 I FLDARR("TECHNICAL DESCRIPTION")]"" D
 . S XXP=XXP+1,XPDARR("FILE",FXX,FLDNUM,"DESCRIPTION",XXP)="TECHNICAL DESCRIPTION:" D
 .. N JJ S JJ=0 S JJ=$O(FLDARR("DESCRIPTION",JJ)) Q:'JJ  S XXP=XXP+JJ,XPDARR("FILE",FXX,FLDNUM,"DESCRIPTION",XXP)=FLDARR("TECHNICAL DESCRIPTION",JJ)
 K FLDARR
 Q
 ;File Analysis FILENUM is called from START^XPDANLYZ1 with file as the choice
FILENUM ; ;get a file number (either from a BUILD check, or from a file range or from an individual file check)
 W ! N DIRUT K DIR S DIR(0)="LCA^2:9999999.99:2",DIR("A")="Enter file number(s) separated by commas, or a range like 130-139.99:  "
 D ^DIR I $D(DIRUT) S END=1 Q
 N FNUM S FNUM=$$TRIM^XLFSTR(Y,"R",",") ;DIR adds a comma at the end of the string
 I '+$G(FNUM) S END=1 Q
 N FARR,FSTRL S FSTRL=$L(FNUM,",") N K F K=1:1:FSTRL S:$P(FNUM,",",K)'["-" FARR("S",K)=$P(FNUM,",",K) S:$P(FNUM,",",K)["-" FARR("R",K)=$P(FNUM,",",K)
 N FF,J F K="S","R" I $D(FARR(K)) S FF=0 F  S FF=$O(FARR(K,FF)) Q:'FF  D FILECHK(FARR(K,FF),K)
 K DIR ;S XTFS=FSTRL
 Q
FILECHK(FIEN,INX) ;INX=s is single file number, = R is a range of files
 I INX="S" D FSEQ(+FIEN)
 I INX="R" N FSTART,FEND S FSTART=$P(FIEN,"-")-.1,FEND=$P(FIEN,"-",2) I +$G(FSTART),+$G(FEND) D
 . F  S FSTART=$O(^DIC(FSTART)) Q:('+FSTART)!(FSTART>FEND)  D FSEQ(FSTART)
 Q
CUTL(LEN,XLINE) ;LEN IS LENGTH TO CUT NEAR, XLINE IS THE LINE TO CUT
 N T1,T2 S T1="",T2=""
 N I F I=LEN:-1:(LEN-20) D  Q:T1]""
 . I $E(XLINE,I)?1P S T1=$E(XLINE,1,I),T2=$E(XLINE,(I+1),9999) Q
 . Q:T1]""
 Q:T1']""
 S HPARR(1)=T1,HPARR(2)=T2
 Q