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

XOBUENV.m

Go to the documentation of this file.
  1. XOBUENV ;; ld/alb - VistaLink Environment Check ; 08/08/2003 08:44
  1. ;;1.5;Foundations;;Sep 09, 2005
  1. ;;Foundations Toolbox Release v1.5 [Build: 1.5.0.026]
  1. ;
  1. ;
  1. EN ;- entry point
  1. ;
  1. ;- programmer variables check
  1. DO PROG IF $GET(XPDABORT) GOTO ENQ
  1. ;
  1. ;- operating system check
  1. DO OSCHK IF $GET(XPDABORT) GOTO ENQ
  1. ;
  1. ;- check for presence of obsolete SYSTEM file (#18)
  1. DO FILE18
  1. ;
  1. ;- passed load check
  1. IF '$GET(XPDENV),'$GET(XPDABORT) WRITE !!?1,">>> VistALink environment check completed for KIDS Load a Distribution option.",!
  1. ;
  1. ;- passed install check
  1. IF $GET(XPDENV)=1,'$GET(XPDABORT) WRITE !!?1,">>> VistALink environment check completed for KIDS Install Package option.",!
  1. ;
  1. ENQ QUIT
  1. ;
  1. PROG ;- check enviroment for programmer variables
  1. ;
  1. WRITE !?1,">>> Checking environment...",!
  1. IF +$GET(DUZ)'>0!($GET(DUZ(0))'="@") DO
  1. . SET XPDABORT=1
  1. . WRITE !," You must first initialize programmer environment by running ^XUP.",!
  1. QUIT
  1. ;
  1. OSCHK ;- check enviroment for operating system (DSM or OpenM)
  1. ;
  1. NEW XOBOS
  1. SET XOBOS=$PIECE($GET(^%ZOSF("OS")),"^")
  1. IF XOBOS'["DSM"&(XOBOS'["OpenM") DO
  1. . SET XPDABORT=1
  1. . DO PRNTXT("OSMSG")
  1. QUIT
  1. ;
  1. FILE18 ;- check for obsolete Kernel file #18 which is in VistALink's numberspace
  1. ;
  1. NEW I,LINE,XOBABORT,XOBASK
  1. ;
  1. ;- file #18 not found
  1. IF '$$FILECHK() GOTO FILE18Q
  1. ;
  1. ;- file found; display user msg
  1. DO PRNTXT("INTRO")
  1. ;
  1. ;- if load, ask if they want file deletion instructions
  1. IF 'XPDENV DO GOTO FILE18Q
  1. . DO:$$ASKINSTR()>0 TOP,PRNTXT("INSTR1"),PAUSE,PRNTXT("INSTR2"),PAUSE
  1. ;
  1. ;- if install, ask if user wants to abort install
  1. ;- if yes, ask if they want file deletion instructions
  1. SET XOBABORT=$$ASKINSTL()
  1. IF XOBABORT DO QUIT
  1. . IF XOBABORT=1 DO:$$ASKINSTR()>0 TOP,PRNTXT("INSTR1"),PAUSE,PRNTXT("INSTR2"),PAUSE
  1. . SET XPDABORT=2
  1. ;
  1. ;- if user wants to continue install, ask again to be sure
  1. IF XOBABORT=0 DO
  1. . SET XOBASK=$$REASK()
  1. . IF XOBASK<1 DO
  1. .. IF XOBASK=0 DO:$$ASKINSTR()>0 TOP,PRNTXT("INSTR1"),PAUSE,PRNTXT("INSTR2"),PAUSE
  1. .. SET XPDABORT=2
  1. FILE18Q QUIT
  1. ;
  1. ASKINSTL() ;- ask if user wants to abort install
  1. ;
  1. NEW XOB0,XOBA,XOBARR,XOBB
  1. SET XOB0="YAO"
  1. SET XOBA=" Do you want to abort the installation now? "
  1. SET XOBB="YES"
  1. SET XOBARR(1)=" NOTE:"
  1. SET XOBARR(2)=" If you choose to abort the installation, please do a global listing"
  1. SET XOBARR(3)=" of file ^DIC(18, and ^DD(18, after deleting the file to ensure that"
  1. SET XOBARR(4)=" the SYSTEM file (#18) is completely deleted from your system before"
  1. SET XOBARR(5)=" reinstalling the VistALink package. If you need additional help"
  1. SET XOBARR(6)=" deleting the file, please contact National VistA Support (NVS)."
  1. SET XOBARR(7)=" "
  1. QUIT $$ANSWER(XOB0,XOBA,XOBB,.XOBARR)
  1. ;
  1. REASK() ;- ask user again if they want to continue with install (pre-init will
  1. ; delete file #18)
  1. ;
  1. NEW XOB0,XOBA,XOBARR,XOBB
  1. SET XOB0="YAO"
  1. SET XOBA=" Are you sure you want to continue? "
  1. SET XOBB="NO"
  1. SET XOBARR(1)=" "
  1. SET XOBARR(2)=" NOTE:"
  1. SET XOBARR(3)=" Continuing with the installation will delete the SYSTEM file (#18)"
  1. SET XOBARR(4)=" using the FileMan Data Dictionary Deletion call (EN^DIU2)."
  1. SET XOBARR(5)=" "
  1. QUIT $$ANSWER(XOB0,XOBA,XOBB,.XOBARR)
  1. ;
  1. ASKINSTR() ;- ask if user wants file deletion instructions
  1. ;
  1. NEW XOB0,XOBA,XOBARR,XOBB
  1. SET XOB0="YAO"
  1. SET XOBA=" Would you like instructions on how to delete SYSTEM file (#18)? "
  1. SET XOBB="YES"
  1. SET XOBARR(1)=" "
  1. QUIT $$ANSWER(XOB0,XOBA,XOBB,.XOBARR)
  1. ;
  1. ANSWER(XOB0,XOBA,XOBB,XOBARR) ;wrap FileMan DIR Reader call
  1. ;
  1. ; Input:
  1. ; XOB0 - DIR(0) string
  1. ; XOBA - DIR("A") string
  1. ; XOBB - DIR("B") string
  1. ; XOBARR - DIR("A",x) string
  1. ;
  1. ; Output:
  1. ; Function Value - Internal value returned from ^DIR (0 for No, 1 for
  1. ; YES) or -1 if user up-arrows or the read times out.
  1. ;
  1. NEW DIR,DIRUT,X,Y ; ^DIR variables
  1. ;
  1. SET DIR(0)=XOB0
  1. SET DIR("A")=$GET(XOBA)
  1. IF $DATA(XOBARR)>1 MERGE DIR("A")=XOBARR
  1. IF $GET(XOBB)'="" SET DIR("B")=XOBB
  1. DO ^DIR KILL DIR
  1. QUIT $SELECT($DATA(DIRUT):-1,1:$PIECE(Y,U))
  1. ;
  1. FILECHK() ;- Check for file 18
  1. ;
  1. NEW XOBA,XOBFIL
  1. SET XOBA=0
  1. DO FILE^DID(18,"","NAME","XOBFIL")
  1. IF $GET(XOBFIL("NAME"))="SYSTEM",($$VFILE^DILFD(18)) SET XOBA=1
  1. IF $DATA(^DIC(18))!$DATA(^DD(18)) SET XOBA=1
  1. QUIT XOBA
  1. ;
  1. PRNTXT(TEXT) ;- display user text
  1. ;
  1. QUIT:$GET(TEXT)=""
  1. NEW I,LINE
  1. FOR I=1:1 SET LINE=$PIECE($TEXT(@TEXT+I),";;",2) QUIT:LINE="$END" WRITE !,LINE
  1. QUIT
  1. ;
  1. TOP ;- top of screen
  1. ;
  1. QUIT:$EXTRACT(IOST,1,2)'="C-"
  1. IF $Y>1 WRITE @IOF
  1. QUIT
  1. ;
  1. PAUSE ;- enhance readability of text
  1. ;
  1. QUIT:$EXTRACT(IOST,1,2)'="C-"
  1. WRITE ! SET DIR(0)="E",DIR("A")="Press return to continue" DO ^DIR KILL DIR WRITE !
  1. QUIT
  1. ;
  1. INTRO ;- display message to user explaining file #18
  1. ;; >>>>>>>>>> ATTENTION: File SYSTEM (#18) was found on your system. <<<<<<<<<<
  1. ;;
  1. ;; SYSTEM file #18 was the precursor to the KERNEL SYSTEMS PARAMETER
  1. ;; file and is obsolete. The SYSTEM file uses the same numberspace
  1. ;; that VistALink is assigned and must be deleted before VistALink
  1. ;; can be installed. You may wish to manually backup and manually
  1. ;; delete file #18.
  1. ;;
  1. ;; If you do not manually delete file #18 and it is still on your system
  1. ;; during the installation phase, you will be prompted with a series of
  1. ;; questions. The questions will allow you to abort the installation or
  1. ;; allow the installation to safely delete the SYSTEM file for you.
  1. ;;
  1. ;;$END
  1. ;
  1. INSTR1 ;- user instructions to delete file #18
  1. ;;
  1. ;;
  1. ;; ******** How to delete the SYSTEM file (#18) ********
  1. ;;
  1. ;;
  1. ;; 1) From the programmer prompt, go to the FileMan main menu
  1. ;;
  1. ;; 2) Choose option 6, UTILITY FUNCTIONS
  1. ;;
  1. ;; 3) Choose option 6, EDIT FILE
  1. ;;
  1. ;; 4) MODIFY WHAT FILE: // 18 SYSTEM
  1. ;;
  1. ;; 5) Do you want to use the screen-mode version? YES// YES
  1. ;; (recommend using screen-mode because you can exit out without
  1. ;; saving your changes if necessary)
  1. ;;
  1. ;; 6) At the FILE NAME: prompt (which should have the name SYSTEM
  1. ;; in it), type @
  1. ;;$END
  1. ;
  1. INSTR2 ;- user instructions to delete file #18 (continued)
  1. ;;
  1. ;;
  1. ;; 7) It will then ask the following questions:
  1. ;; DO YOU WANT JUST TO DELETE THE FILE CONTENTS,
  1. ;; & KEEP THE FILE DEFINITION? No// No (No)
  1. ;; IS IT OK TO DELETE THE '^DIC(18)' GLOBAL? Yes// Yes (Yes)
  1. ;; SURE YOU WANT TO DELETE THE ENTIRE FILE? No// Yes (Yes)
  1. ;; Deleting the DATA DICTIONARY...
  1. ;; Deleting the INPUT TEMPLATES....
  1. ;; Deleting the PRINT TEMPLATES...
  1. ;; Deleting the SORT TEMPLATES...
  1. ;; Deleting the FORMS...
  1. ;;
  1. ;; 8) The last step is a global listing to check that file #18 and its DD
  1. ;; have been deleted. Here's an example:
  1. ;; cor> D ^%G
  1. ;; Global ^DIC(18,
  1. ;; DIC(18,
  1. ;; Global ^DD(18,
  1. ;; DD(18,
  1. ;; Global ^
  1. ;;$END
  1. ;
  1. OSMSG ;- Message to user if operating system is not Cache or DSM
  1. ;;
  1. ;; VistALink has been tested on Cache and DSM. It has not been tested
  1. ;; or programmed to be compatible yet on other M implementations,
  1. ;; therefore installation will abort.
  1. ;;
  1. ;;$END
  1. ;