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

BJMDECKF.m

Go to the documentation of this file.
  1. BJMDECKF ;VNGT/HS/AM-Pre Install ENVIRONMENT CHECK for BFMC; 18 Nov 2009 12:51 PM
  1. ;;1.0;CDA/C32;**1**;May 27, 2011
  1. ;
  1. ; Run pre-install checks
  1. ;W !,"Build Name XPDNM = ",XPDNM
  1. N EXEC,ROLES,FAC,STAT,NS,OBJ,C32DEST,DEFDEST,EDEST,DIR,METMS,METCS
  1. N METFS,METDFS,LIST,MET,TSC,DEFEDEST,OK,FS,ES,VERSION
  1. ;
  1. ; Verify Version
  1. ;
  1. S VERSION=$$VERSION^%ZOSV
  1. I VERSION<2009!($E(VERSION,1,4)>2010)!(VERSION?1"2010.1.".E) D
  1. . W !,"Ensemble 2009.1 or 2010.2 is required!"
  1. . S XPDQUIT=2
  1. ;
  1. ; Verify that installer has proper roles
  1. ;
  1. S EXEC="S ROLES=$roles" X EXEC
  1. S ROLES=","_ROLES_",",U="^"
  1. I ROLES'[",%All," D
  1. . W !,"Your Ensemble account MUST have ""%All"" role to proceed!" S XPDQUIT=2
  1. S EXEC="S OK=($SYSTEM.SYS.MaxLocalLength()>3600000)"
  1. X EXEC
  1. I 'OK D S XPDQUIT=2
  1. . W !,"Long Strings must be enabled in the System Management Portal!"
  1. K LIST
  1. S EXEC="S NS=$SYSTEM.SYS.NameSpace()" X EXEC
  1. S EXEC="SET OBJ=##class(%ResultSet).%New(""%SYS.Namespace:List"") d OBJ.Execute()" X EXEC
  1. S EXEC="while (OBJ.Next()) { s LIST(OBJ.Data(""Nsp""))=1 }" X EXEC
  1. ;
  1. ; Check that Ensemble globals are mapped to the default namespace of ENSLIB
  1. ;
  1. S EXEC="S DEFEDEST=##class(%SYS.Namespace).GetGlobalDest(""ENSLIB"")" X EXEC
  1. S EXEC="S EDEST=##class(%SYS.Namespace).GetGlobalDest(NS,""^EnsDICOM.Dictionary"")" X EXEC
  1. I EDEST'=DEFEDEST W !,"Ensemble is not properly mapped in ",NS S XPDQUIT=2
  1. ;
  1. ; check if enough space (only for the BFMC load and only if classes are not there already)
  1. ;
  1. S EXEC="S TSC=$SYSTEM.OBJ.GetPackageList(.BFMC,""BFMC"")" X EXEC
  1. I $O(BFMC(""))'="" G Q
  1. S EXEC="S NS=$SYSTEM.SYS.NameSpace()" X EXEC
  1. S EXEC="S DIR=##class(%SYS.Namespace).GetGlobalDest(NS),DIR=$P(DIR,""^"",2,99)" X EXEC
  1. S EXEC="Set MET=##class(%Monitor.System.Freespace).%New()" X EXEC
  1. S EXEC="S TSC=MET.Initialize()" X EXEC
  1. I $G(TSC)'=1 W !,"Space check monitor failed to initialize" S XPDQUIT=2 G Q
  1. ;
  1. S METMS=0,METCS=0,METFS=0,METDFS=0,METDS=0
  1. S EXEC="F S TSC=MET.GetSample() Q:'TSC S:MET.DBName=""CACHESYS"" METDFS=MET.DiskFreeSpace I MET.Directory=DIR S:METCS=0 METMS=MET.MaxSize,METCS=MET.CurSize,METFS=MET.FreeSpace,METDS=MET.DiskFreeSpace" X EXEC
  1. I METCS=0 W !,"Space check monitor failed to find Cache Namespace with directory ",DIR S XPDQUIT=2
  1. I METDFS<2000 W !,"Disk space for CACHESYS is too low (",METDFS,"MB available, 2GB needed)" S XPDQUIT=2 G Q
  1. S OK=0
  1. ;
  1. ; if unlimited cache.dat, then limit is FreeDiskSpace + FreeSpaceInCurrent_cache.dat
  1. I METMS=-1 S FS=METDS+METFS I FS>5000 S OK=1
  1. ; if limited cache.dat, then ExpansionSpace is smaller of FreeDiskSpace and (MaxSpace-CurrentSpace)
  1. ; then limit is Expansion Space+FreeSpaceInCurrentFile
  1. I METMS'=-1 S ES=METMS-METCS S:METDS<ES ES=METDS S FS=ES+METFS I FS>5000 S OK=1
  1. ; if not enough space and BFMC package is not loaded, then abort lest FILEFULL error occurs
  1. I 'OK W !,"Available space is ",FS,"MB, less than required 5 GB" S XPDQUIT=2
  1. Q ;
  1. I $G(MET)'="" S EXEC="S TSC=MET.Shutdown()" X EXEC
  1. K BFMC
  1. Q
  1. DTCK(DT) ;
  1. S %DT="FT",X=DT
  1. D ^%DT
  1. I Y=-1 Q 0
  1. S ZTDTH=Y
  1. Q 1