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

ACPTENVC.m

Go to the documentation of this file.
  1. ACPTENVC ; IHS/SD/SDR - Environment checker for ACPT V2.10 ;4/21/08 14:11
  1. ;;2.10;CPT FILES;;DEC 18, 2009
  1. ;
  1. I '$G(DUZ) W !,"DUZ UNDEFINED OR 0." D SORRY(2) Q
  1. ;
  1. I '$L($G(DUZ(0))) W !,"DUZ(0) UNDEFINED OR NULL." D SORRY(2) Q
  1. ;
  1. S X=$P(^VA(200,DUZ,0),U)
  1. W !!,$$CJ^XLFSTR("Hello, "_$P(X,",",2)_" "_$P(X,","),IOM)
  1. W !!,$$CJ^XLFSTR("Checking Environment for "_$P($T(+2),";",4)_" V "_$P($T(+2),";",3)_" Patch "_$P($T(+2),";",5)_".",IOM),!
  1. ;
  1. S XPDQUIT=0,ACPTQUIT=0
  1. I '$$VCHK("XU","8",2)
  1. I '$$VCHK("XT","7.3",2)
  1. I '$$VCHK("DI","21",2)
  1. I '$$VCHK("ACPT","2.09",2) S XPDQUIT=2
  1. ;
  1. NEW DA,DIC
  1. S X="ACPT",DIC="^DIC(9.4,",DIC(0)="",D="C"
  1. D IX^DIC
  1. I Y<0,$D(^DIC(9.4,"C","ACPT")) D S XPDQUIT=2
  1. . W !!,*7,*7,$$CJ^XLFSTR("You Have More Than One Entry In The",IOM),!,$$CJ^XLFSTR("PACKAGE File with an ""ACPT"" prefix.",IOM)
  1. . W !,$$CJ^XLFSTR("One entry needs to be deleted.",IOM)
  1. . W !,$$CJ^XLFSTR("FIX IT! Before Proceeding.",IOM),!!,*7,*7,*7
  1. .Q
  1. ;
  1. I XPDQUIT D SORRY(XPDQUIT) Q
  1. ;
  1. W !!,$$CJ^XLFSTR("ENVIRONMENT OK.",IOM)
  1. ;
  1. I '$$DIR^XBDIR("E","","","","","",1) D SORRY(2) Q
  1. Q
  1. ;
  1. SORRY(X) ;
  1. KILL DIFQ
  1. S XPDQUIT=X
  1. W:'$D(ZTQUEUED) *7,!,$$CJ^XLFSTR("Sorry....",IOM),$$DIR^XBDIR("E","Press RETURN")
  1. Q
  1. ;
  1. VCHK(ACPTPRE,ACPTVER,ACPTQUIT) ; Check versions needed.
  1. ;
  1. NEW ACPTV
  1. S ACPTV=$$VERSION^XPDUTL(ACPTPRE)
  1. W !,$$CJ^XLFSTR("Need at least "_ACPTPRE_" v "_ACPTVER_"....."_ACPTPRE_" v "_ACPTV_" Present",IOM)
  1. I ACPTV<ACPTVER S XPDQUIT=ACPTQUIT W *7,!,$$CJ^XLFSTR("^^^^**NEEDS FIXED**^^^^",IOM) Q 0
  1. Q 1
  1. ;
  1. INSTALLD(ACPTINST) ;EP - Determine if patch ACPTINST was installed, where ACPTINST is
  1. ; the name of the INSTALL. E.g "AG*6.0*10".
  1. ;;^DIC(9.4,D0,22,D1,PAH,D2,0)=
  1. ;;(#.01) PATCH APPLICATION HISTORY [1F] ^ (#.02)DATE APPLIED [2D] ^ (#.03) APPLIED BY [3P] ^
  1. NEW DIC,X,Y
  1. S X=$P(ACPTINST,"*",1)
  1. S DIC="^DIC(9.4,",DIC(0)="FM",D="C"
  1. D IX^DIC
  1. I Y<1 Q 0
  1. S DIC=DIC_+Y_",22,",X=$P(ACPTINST,"*",2)
  1. D ^DIC
  1. I Y<1 Q 0
  1. S DIC=DIC_+Y_",""PAH"",",X=$P(ACPTINST,"*",3)
  1. D ^DIC
  1. Q $S(Y<1:0,1:1)
  1. ;
  1. LAST(PKG,VER) ;EP - returns last patch applied for a Package, PATCH^DATE
  1. ; Patch includes Seq # if Released
  1. N PKGIEN,VERIEN,LATEST,PATCH,SUBIEN
  1. I $G(VER)="" S VER=$$VERSION^XPDUTL(PKG) Q:'VER -1
  1. S PKGIEN=$O(^DIC(9.4,"B",PKG,"")) Q:'PKGIEN -1
  1. S VERIEN=$O(^DIC(9.4,PKGIEN,22,"B",VER,"")) Q:'VERIEN -1
  1. S LATEST=-1,PATCH=-1,SUBIEN=0
  1. F S SUBIEN=$O(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN)) Q:SUBIEN'>0 D
  1. . I $P(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)>LATEST S LATEST=$P(^(0),U,2),PATCH=$P(^(0),U)
  1. . I $P(^DIC(9.4,PKGIEN,22,VERIEN,"PAH",SUBIEN,0),U,2)=LATEST,$P(^(0),U)>PATCH S PATCH=$P(^(0),U)
  1. Q PATCH_U_LATEST
  1. ;
  1. POST1(ACPTDIR) ; input transform for KIDS question POST1
  1. ;
  1. ; .ACPTDIR, passed by reference, is X from the Fileman Reader, the
  1. ; input to this input transform.
  1. ;
  1. I $ZV["UNIX" D ; if unix, ensure proper syntax for unix
  1. .S ACPTDIR=$TR(ACPTDIR,"\","/") ; forward slash should delimit
  1. .S:$E(ACPTDIR)'="/" ACPTDIR="/"_ACPTDIR ; start with root (/)
  1. .S:$E(ACPTDIR,$L(ACPTDIR))'="/" ACPTDIR=ACPTDIR_"/" ; ensure trailing /
  1. ;
  1. E D ; otherwise, ensure proper syntax for other operating systems
  1. .S ACPTDIR=$TR(ACPTDIR,"/","\") ; back slash should delimit
  1. .I $E(ACPTDIR)'="\",ACPTDIR'[":" D
  1. ..S ACPTDIR="\"_ACPTDIR ; start with \ if not using : (?)
  1. .S:$E(ACPTDIR,$L(ACPTDIR))'="\" ACPTDIR=ACPTDIR_"\" ; ensure trailing \
  1. ;
  1. W !!,"Checking directory ",ACPTDIR,"..."
  1. ;
  1. N ACPTFIND S ACPTFIND=0 ; do we find our files in that directory?
  1. D ; find out whether that directory contains those files
  1. .N ACPTFILE
  1. .S ACPTFILE("acpt2010.9l")=""
  1. .S ACPTFILE("acpt2010.9h")=""
  1. .S ACPTFILE("acpt2010.9d")=""
  1. .S ACPTFILE("acpt2010.l")=""
  1. .S ACPTFILE("acpt2010.d")=""
  1. .N Y S Y=$$LIST^%ZISH(ACPTDIR,"ACPTFILE","ACPTFIND")
  1. .D Q:ACPTFIND ; format for most platforms:
  1. ..K ACPTQUIT
  1. ..I ($$VERSION^XPDUTL("BCSV")>0) D Q:($G(ACPTQUIT)=1)
  1. ...I ('$D(ACPTFIND("acpt2010.9l"))&('$D(ACPTFIND(ACPTDIR_"acpt2010.9l")))) S ACPTQUIT=1
  1. ...I ('$D(ACPTFIND("acpt2010.9h"))&('$D(ACPTFIND(ACPTDIR_"acpt2010.9h")))) S ACPTQUIT=1
  1. ...I ('$D(ACPTFIND("acpt2010.9d"))&('$D(ACPTFIND(ACPTDIR_"acpt2010.9d")))) S ACPTQUIT=1
  1. ...I ('$D(ACPTFIND("acpt2010.l"))&('$D(ACPTFIND(ACPTDIR_"acpt2010.l")))) S ACPTQUIT=1
  1. ...I ('$D(ACPTFIND("acpt2010.d"))&('$D(ACPTFIND(ACPTDIR_"acpt2010.d")))) S ACPTQUIT=1
  1. ..I ($$VERSION^XPDUTL("BCSV")<1) D Q:($G(ACPTQUIT)=1)
  1. ..I ('$D(ACPTFIND("acpt2010.l"))&('$D(ACPTFIND(ACPTDIR_"acpt2010.l")))) S ACPTQUIT=1
  1. ..I ('$D(ACPTFIND("acpt2010.d"))&('$D(ACPTFIND(ACPTDIR_"acpt2010.d")))) S ACPTQUIT=1
  1. ..I $G(ACPTQUIT)'=1 S ACPTFIND=1
  1. .;D ; format for Cache on UNIX
  1. ..;Q:('$D(ACPTFIND("acpt2010.9l"))!'$D(ACPTFIND("acpt2010.9h"))!'$D(ACPTFIND("acpt2010.9d"))!'$D(ACPTFIND("acpt2010.l"))!'$D(ACPTFIND("acpt2010.d")))&($$VERSION^XPDUTL("BCSV")>0)
  1. ..;Q:('$D(ACPTFIND("acpt2010.l"))!'$D(ACPTFIND("acpt2010.d")))&($$VERSION^XPDUTL("BCSV")<1)
  1. ..;S ACPTFIND=1
  1. ;
  1. I $$VERSION^XPDUTL("BCSV")>0 D
  1. .I $D(ACPTFIND("acpt2010.9l"))!$D(ACPTFIND(ACPTDIR_"acpt2010.9l")) D
  1. ..W !,"CPT Description file acpt2010.9l found."
  1. .I $D(ACPTFIND("acpt2010.9d"))!$D(ACPTFIND(ACPTDIR_"acpt2010.9d")) D
  1. ..W !,"CPT delete file acpt2010.9d found."
  1. .I $D(ACPTFIND("acpt2010.9h"))!$D(ACPTFIND(ACPTDIR_"acpt2010.9h")) D
  1. ..W !,"HCPCS file acpt2010.9h found."
  1. ;
  1. I $D(ACPTFIND("acpt2010.l"))!$D(ACPTFIND(ACPTDIR_"acpt2010.l")) D
  1. .W !,"CPT Description file acpt2010.l found."
  1. I $D(ACPTFIND("acpt2010.d"))!$D(ACPTFIND(ACPTDIR_"acpt2010.d")) D
  1. .W !,"CPT delete file acpt2010.d found."
  1. ;
  1. I ACPTFIND D Q ; if they picked a valid directory
  1. .W !!,"Thank you. The file is in that directory."
  1. .W !,"Proceeding with the install of ACPT*2.10."
  1. ;
  1. I 'ACPTFIND D
  1. .W !!,"I'm sorry, but that cannot be correct."
  1. .W !,"Directory ",ACPTDIR," does not contain that file."
  1. .;
  1. .D
  1. ..N ACPTFILE S ACPTFILE("*")=""
  1. ..N ACPTLIST
  1. ..N Y S Y=$$LIST^%ZISH(ACPTDIR,"ACPTFILE","ACPTLIST")
  1. ..W !!,"Directory ",ACPTDIR," contains the following file:"
  1. ..N ACPTF S ACPTF="" F S ACPTF=$O(ACPTLIST(ACPTF)) Q:ACPTF="" D
  1. ...W !?5,ACPTF
  1. .;
  1. .W !!,"Please select a directory that contains the CPT file."
  1. .K ACPTDIR
  1. ;
  1. Q