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

LEXXII2.m

Go to the documentation of this file.
  1. LEXXII2 ;ISL/KER - Lexicon Status (Data Status) ;04/21/2014
  1. ;;2.0;LEXICON UTILITY;**59,80**;Sep 23, 1996;Build 10
  1. ;
  1. ; Global Variables
  1. ; ^LEXM( N/A
  1. ; ^LEXM(0) N/A
  1. ; ^TMP("LEXVER") SACC 2.3.2.5.1
  1. ;
  1. ; External References
  1. ; ^DIM ICR 10016
  1. ;
  1. ; Variables NEWed or KILLed Elsewhere
  1. ; LEXSUB NEWed by LEXXII and LEXXFI sending message
  1. ;
  1. Q
  1. RESULTS(X) ; Get Results of Install
  1. D SETUP^LEXXII2 N LEXR S LEXR=$$CHK S X="" S:$L($P(LEXR,"^",2)) X=$P(LEXR,"^",2) K ^TMP("LEXVER",$J)
  1. Q X
  1. SETUP ; Last Set/Kills (Negation)
  1. Q:'$D(^LEXM) Q:+($O(^LEXM(0)))'>0 K ^TMP("LEXVER",$J) N LEXC1,LEXC2,LEXCK,LEXCS,LEXCT,LEXEC,LEXFI,LEXIEN,LEXKK,LEXLK,LEXLS,LEXOK,LEXSAB,LEXSK,LEXSS,LEXT,LEXTT,X
  1. S LEXFI=9999.999 F S LEXFI=$O(^LEXM(LEXFI),-1) Q:+LEXFI=0 D LLF(LEXFI)
  1. S LEXFI=0 F S LEXFI=$O(^LEXM(LEXFI)) Q:+LEXFI'>0 D FIR(LEXFI) Q:$L($G(LEXSK("FIR","SK")))
  1. D VERC
  1. Q
  1. LLF(X) ; Last Set/Last Kill for File X
  1. N LEXFI,LEXIEN,LEXLK,LEXLS,LEXSAB S LEXFI=$G(X),(LEXLS,LEXLK)="" Q:$O(^LEXM(LEXFI,0))'>0
  1. S LEXSAB=$S(+($G(LEXFI))=80:"ICD",+($G(LEXFI))=80.1:"ICP",+($G(LEXFI))=81:"CPT",+($G(LEXFI))=81.3:"CPM",$E(+($G(LEXFI)),1,3)="757"&($E(+($G(LEXFI)),1,5)'="757.9"):"LEX",1:"")
  1. Q:'$L(LEXSAB) Q:$L($G(LEXSK(LEXSAB,"LS")))&($L($G(LEXSK(LEXSAB,"LK")))) S LEXIEN=+($O(^LEXM(LEXFI," "),-1))+1
  1. F S LEXIEN=$O(^LEXM(LEXFI,LEXIEN),-1) Q:+LEXIEN=0 D Q:$L(LEXLS)&($L(LEXLK))
  1. . Q:$G(^LEXM(LEXFI,LEXIEN))["^DD(" Q:+LEXIEN=0
  1. . I $E($G(^LEXM(LEXFI,LEXIEN)),1,3)="S ^",'$L(LEXLS),'$L($G(LEXSK(LEXSAB,"LS"))) D
  1. . . S LEXLS=$G(^LEXM(LEXFI,LEXIEN)) S:'$D(LEXSK(LEXSAB,"LS")) LEXSK(LEXSAB,"LS")=$G(^LEXM(LEXFI,LEXIEN))
  1. . I $E($G(^LEXM(LEXFI,LEXIEN)),1,3)="K ^",'$L(LEXLK),'$L($G(LEXSK(LEXSAB,"LK"))) D
  1. . . S LEXLK=$G(^LEXM(LEXFI,LEXIEN)) S:'$D(LEXSK(LEXSAB,"LK")) LEXSK(LEXSAB,"LK")=$G(^LEXM(LEXFI,LEXIEN))
  1. Q
  1. FIR(X) ; First Set/Kill
  1. N LEXFI,LEXIEN,LEXLK,LEXLS,LEXSAB S LEXFI=$G(X),(LEXLS,LEXLK)="" Q:$O(^LEXM(LEXFI,0))'>0 S LEXSAB="FIR"
  1. Q:$L($G(LEXSK(LEXSAB,"SK"))) S LEXIEN=0 F S LEXIEN=$O(^LEXM(LEXFI,LEXIEN)) Q:+LEXIEN'>0 D Q:$L($G(LEXSK(LEXSAB,"SK")))
  1. . Q:$L($G(LEXSK(LEXSAB,"SK"))) Q:$G(^LEXM(LEXFI,LEXIEN))["^DD("
  1. . I $E($G(^LEXM(LEXFI,LEXIEN)),1,3)="S ^" S:'$D(LEXSK(LEXSAB,"SK")) LEXSK(LEXSAB,"SK")=$G(^LEXM(LEXFI,LEXIEN)) Q
  1. . I $E($G(^LEXM(LEXFI,LEXIEN)),1,3)="K ^" S:'$D(LEXSK(LEXSAB,"SK")) LEXSK(LEXSAB,"SK")=$G(^LEXM(LEXFI,LEXIEN)) Q
  1. Q
  1. VERC ; Verification Check for file
  1. N LEXCK,LEXCS,LEXCT,LEXKK,LEXSS,LEXTT,LEXSAB
  1. N LEXSAB F LEXSAB="LEX","ICD","CPT","CPM","FIR" D
  1. . S (LEXCS,LEXCK,LEXCT)="" S LEXSS=$G(LEXSK(LEXSAB,"LS")),LEXCS=$P(LEXSS,"=",1),LEXCS=$P(LEXCS," ",2,299)
  1. . S LEXKK=$G(LEXSK(LEXSAB,"LK")),LEXCK=$P(LEXKK,"=",1),LEXCK=$P(LEXCK," ",2,299)
  1. . S LEXTT=$G(LEXSK(LEXSAB,"SK")),LEXCT=$P(LEXTT,"=",1),LEXCT=$P(LEXCT," ",2,299)
  1. . D:$L(LEXCS)!($L(LEXCK))!($L(LEXCT)) VERS
  1. Q
  1. VERS ; Verification Strings
  1. Q:'$L(LEXSAB) I $G(LEXSAB)="FIR" D Q
  1. . Q:'$L($G(LEXTT)) Q:'$L($G(LEXCT)) S (LEXC1,LEXC2)="" I $E(LEXTT,1,3)="S ^",LEXTT[LEXCT D
  1. . . S LEXC1="S:"_"$D("_LEXCT_")"_" LEXOK(""FIR"",1)=1" S X=LEXC1 D ^DIM S:'$D(X) LEXC1=""
  1. . . S LEXC2="S:"_"'$D("_LEXCT_")"_" LEXOK(""FIR"",1)=0" S X=LEXC2 D ^DIM S:'$D(X) LEXC2=""
  1. . I $E(LEXTT,1,3)="K ^",LEXTT[LEXCT D
  1. . . S LEXC1="S:"_"'$D("_LEXCT_")"_" LEXOK(""FIR"",1)=1" S X=LEXC1 D ^DIM S:'$D(X) LEXC1=""
  1. . . S LEXC2="S:"_"$D("_LEXCT_")"_" LEXOK(""FIR"")1)=0" S X=LEXC2 D ^DIM S:'$D(X) LEXC2=""
  1. . S:$L(LEXSAB)&($L(LEXC1)) ^TMP("LEXVER",$J,LEXSAB,1)=LEXC1 S:$L(LEXSAB)&($L(LEXC2)) ^TMP("LEXVER",$J,LEXSAB,2)=LEXC2
  1. N LEXC1,LEXC2 S (LEXC1,LEXC2)="" S:$L(LEXCS) LEXC1="$D("_LEXCS_")" S:$L(LEXCK) LEXC2="'$D("_LEXCK_")" Q:'$L(LEXC1)&('$L(LEXC2))
  1. I $L(LEXCS)&($L(LEXCK)) D
  1. . S LEXC1="S:"_"$D("_LEXCS_")"_"&("_"'$D("_LEXCK_")"_") LEXOK("""_LEXSAB_""",2)=1" S X=LEXC1 D ^DIM S:'$D(X) LEXC1=""
  1. . S LEXC2="S:"_"'$D("_LEXCS_")"_"!("_"$D("_LEXCK_")"_") LEXOK("""_LEXSAB_""",3)=0" S X=LEXC2 D ^DIM S:'$D(X) LEXC2=""
  1. I $L(LEXCS)&('$L(LEXCK)) D
  1. . S LEXC1="S:"_"$D("_LEXCS_")"_" LEXOK("""_LEXSAB_""",2)=1" S X=LEXC1 D ^DIM S:'$D(X) LEXC1=""
  1. . S LEXC2="S:"_"'$D("_LEXCS_")"_" LEXOK("""_LEXSAB_""",3)=0" S X=LEXC2 D ^DIM S:'$D(X) LEXC2=""
  1. I '$L(LEXCS)&($L(LEXCK)) D
  1. . S LEXC1="S:"_"'$D("_LEXCK_")"_" LEXOK("""_LEXSAB_""",2)=1" S X=LEXC1 D ^DIM S:'$D(X) LEXC1=""
  1. . S LEXC2="S:"_"$D("_LEXCK_")"_" LEXOK("""_LEXSAB_""",3)=0" S X=LEXC2 D ^DIM S:'$D(X) LEXC2=""
  1. S:$L(LEXSAB)&($L(LEXC1)) ^TMP("LEXVER",$J,LEXSAB,1)=LEXC1 S:$L(LEXSAB)&($L(LEXC2)) ^TMP("LEXVER",$J,LEXSAB,2)=LEXC2
  1. Q
  1. ;
  1. CHECK ; Check if Data is installed
  1. N LEXC,LEXEC,LEXFN,LEXOK,LEXSAB,LEXST,LEXT,X S LEXC=$$CHK K ^TMP("LEXVER",$J) Q:'$L($P(LEXC,"^",2))
  1. S LEXT=" Data: "_$P(LEXC,"^",2) D TL(LEXT)
  1. Q
  1. CHK(X) ; Check if Data is Fully Installed
  1. Q:'$D(^TMP("LEXVER",$J)) "" N LEXEC,LEXFN,LEXOK,LEXSAB,LEXST,LEXT S LEXST=0,LEXFN=1,LEXOK("FIR",1)=0 F LEXSAB="LEX","ICD","CPT","CPM" D
  1. . Q:'$D(^TMP("LEXVER",$J,LEXSAB)) S LEXOK(LEXSAB,2)=0,LEXOK(LEXSAB,3)=1
  1. F LEXSAB="FIR","LEX","ICD","CPT","CPM" D
  1. . Q:'$D(^TMP("LEXVER",$J,LEXSAB)) S (LEXEC,X)=$G(^TMP("LEXVER",$J,LEXSAB,1)) D ^DIM X:$D(X) LEXEC
  1. . S (LEXEC,X)=$G(^TMP("LEXVER",$J,LEXSAB,2)) D ^DIM X:$D(X) LEXEC
  1. . Q:LEXSAB="FIR" S:+($G(LEXOK(LEXSAB,2)))'>0 LEXFN=0
  1. S:+($G(LEXOK("FIR",1)))>0 LEXST=1
  1. S:+($G(LEXST))>0&(+($G(LEXFN))>0) X="1^Installation of data completed successfully"
  1. S:+($G(LEXST))>0&(+($G(LEXFN))'>0) X="0^Installation of data started but did not finish (incomplete)"
  1. S:+($G(LEXST))'>0 X="0^Installation of data not started (incomplete)"
  1. S:'$D(^TMP("LEXVER",$J)) X=0
  1. Q X
  1. ;
  1. ; Miscellaneous
  1. BL ; Blank Line
  1. D TL("") Q
  1. TL(X) ; Text Line
  1. W !,$G(X) Q
  1. S LEXSUB=$G(LEXSUB) S:'$L(LEXSUB) LEXSUB="LEXXII"
  1. I '$D(^TMP(LEXSUB,$J,1)) S ^TMP(LEXSUB,$J,1)=" ",^TMP(LEXSUB,$J,0)=1
  1. N LEXNX S LEXNX=$O(^TMP(LEXSUB,$J," "),-1),LEXNX=LEXNX+1
  1. S ^TMP(LEXSUB,$J,LEXNX)=" "_$G(X),^TMP(LEXSUB,$J,0)=LEXNX
  1. Q