ONCOENV ;WASH ISC/SRR,MLH-PACKAGE ENVIRONMENT CHECK VERSION 2.11
 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
 ;
 ;    Just a reminder - if variables are defined here for the post init,
 ;    don't NEW them in this routine or they'll be clobbered.
 I '$D(IOF) S IOP="HOME" D ^%ZIS ;    set up environment
 ;
PRE ;    PRE INIT - Check user and device
 I $G(DUZ)<1 W !!!?15,"YOU ARE NOT IDENTIFIED AS A USER!!",!!?17,"TERMINATING this Installation!",!!! K DIFQ
 E  D CK
 D EX ;    clean up
 QUIT
 ;
CK ;Check if installed
 ;  7/14/94 MLH added NEW to next line to cause version to be
 ;          correctly identified
NN N VR,V S VR=$P($T(ONCOENV+1),";",3),V=$G(^ONCO(169.99,0,"NVR")) ;    version number
 IF V=VR D  ;    already installed - bail out?
 .  N I,Y
 .  S I=$P(^ONCO(169.99,0),U,3) ;    site number
 .  S Y=$P(^ONCO(169.99,I,0),U,4) ;    installation date
 .  D DD^%DT
 .  W !!,*7,*7,?10,"INSTALLATION "_V_" Completed: "_Y_"."
 .  I '$$GOAHEAD K DIFQ ;    let user bail out
 .  Q
 ;END IF
 ;
 I $D(DIFQ) D START ;    didn't bail out
 I $D(DIFQ),'OFST D RSTSET ;    set up for restaging
 ;
 ;   7/12/94 MLH REMOVED logic to check proceeding w/o restaging
 ;               to entry point ONCOENA
 ;
 I $D(DIFQ),$G(ONCOI1ST)'>0 D QNORSTG^ONCOENA ;    they don't want to restage - do they want to quit?
 Q
 ;
START S XIU="T",OFST=0,NM="ONCOLOGY TUMOR REGISTRY"
 S %H=$H D YX^%DTC S (ONCOBEG,ONCOST)=Y D DD^%DT
 D LOGO^ONCODIS,V W !!
 IF '$O(^ONCO(160,0)) D  ;    virgin install
 .  S OFST=1
 .  D CV
 .  Q
 ELSE  D  ;    non-virgin
 .  D CI
 .  Q
 ;END IF
 ;
EX ;Exit conversion
 K DIK,DIR,DIU,ER,RR,I,J,K,L,LTD,MC,N,N1,NAC,NF,NFM,NXT,REM,S,T,TC,XDD,XIU F I="T","N","M" K ^UTILITY($J,I)
 Q
 ;
CI ;CHECK INSTALLATION VERSION
 S INS=$G(^ONCO(169.99,0,"INS"))
 IF INS'="",'$D(^DD(160)) D  ;    previously aborted in the middle?
 .  W !!?10,"Appears installation was started, not completed"
 .  W !?10,"- no other information available, will continue..."
 .  S V=$G(^ONCO(169.99,0,"OVR"))
 .  Q
 ELSE  D
 .  IF INS'="" D  ;    previously aborted in the middle?
 ..    S VX=$P(INS,U),ST=$P(INS,U,2),Y=ST D DD^%DT
 ..    W !!?10,"Appears installation of V"_VX_" on "_Y
 ..    W !?10,"began, but did not complete - will continue installation..."
 ..    Q
 .  ;END IF
 .  ;
 .  D CV ;    get version number
 .  Q
 ;END IF
 ;
CN W !!,"I am going to clean out DD's (national fields only)."
 W !,"I will also purge the static files, except for FOLLOW-UP FORM LETTER."
 D AB ;    do they want to abort?
 I Y'=1 ;    yes, user bailed out
 E  I V=""!(V>1.79) ;    no, and no need to do ICDO conv
 E  W !!,"Please convert to Version 2.0 before proceeding.",!! K DIFQ ;    no, but version too old - must do ICDO conv
 ;END IF
 ;
 Q
 ;
V W !!!?25,"INSTALLATION: VERSION ",VR,!?25,Y Q
 ;
AB K DIR S DIR("A")="       CONTINUE with Installation: ",DIR("B")="Yes",DIR(0)="Y" D ^DIR Q:Y=1  D ABORT Q
ABORT W !!?7,"Installation aborted - you may DO ^ONCOINIT at any time." K DIFQ
 Q
 ;
GOAHEAD() ;    does user want to go ahead with installation?
 N DIR
 S DIR("A")="Do you want to proceed",DIR("B")="No",DIR(0)="Y"
 S DIR("?",1)="It appears that you have already installed this version successfully."
 S DIR("?",2)="Unless your ISC has requested that you reinstall, you can stop here"
 S DIR("?",2.5)="and no changes will have been made to the package."
 IF $T(+2)["2.1;" D  ;    following message applies only to released version
 .  S DIR("?",2.9)=""
 .  S DIR("?",3)="Remember that if you proceed with installation, you must re-apply"
 .  S DIR("?",4)="all patches to this package before allowing users to log back in"
 .  S DIR("?",5)="to the system."
 .  S DIR("?",5.9)=""
 .  S DIR("?",6)="If you need further help, answer No here and contact your ISC."
 .  Q
 ;END IF
 ;
 D ^DIR
 Q Y
 ;
CV S VRN=$G(^ONCO(169.99,0,"NVR")),V=$P(VRN,U),VND=$P(VRN,U,3),V=$S('V:"NONE",1:V),VX=$S(V["T":"Alpha Test",V["V":"Beta Test/Verification",1:"Released")_" Version",^ONCO(169.99,0,"OVR")=V
 I 'OFST W !?20,"VERSION "_V_" currently installed",!?32,VX
 E  I '$D(^ONCO(160)) W !,?20,"This is a VIRGIN Installation",!!
 Q
 ;
RSTSET ;JAH 01FEB95; Set up for restaging - called by CK
 W !!,"The post-initialization can automatically recompute"
 W !,"the AJCC staging of entries on your primary file with"
 W !,"a DIAGNOSIS DATE on or after a date you specify."
 W !!,"Answer YES to restage."
 S DIR(0)="Y",DIR("B")="NO",DIR("A")="Do you want to RESTAGE"
 S DIR("?")="Answer Yes or No to the restaging question."
 S DIR("?",1)="The Oncology Registrar may be best suited to help answer the restaging questions"
 D ^DIR
 I $D(DTOUT)!$D(DUOUT)!(Y=0) S ONCOI1ST=-1
 E  S ONCOI1ST=$$RSTGASK^ONCOU55A ;    get the date
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCOENV   4805     printed  Sep 23, 2025@20:01:04                                                                                                                                                                                                     Page 2
ONCOENV   ;WASH ISC/SRR,MLH-PACKAGE ENVIRONMENT CHECK VERSION 2.11
 +1       ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
 +2       ;
 +3       ;    Just a reminder - if variables are defined here for the post init,
 +4       ;    don't NEW them in this routine or they'll be clobbered.
 +5       ;    set up environment
           IF '$DATA(IOF)
               SET IOP="HOME"
               DO ^%ZIS
 +6       ;
PRE       ;    PRE INIT - Check user and device
 +1        IF $GET(DUZ)<1
               WRITE !!!?15,"YOU ARE NOT IDENTIFIED AS A USER!!",!!?17,"TERMINATING this Installation!",!!!
               KILL DIFQ
 +2       IF '$TEST
               DO CK
 +3       ;    clean up
           DO EX
 +4        QUIT 
 +5       ;
CK        ;Check if installed
 +1       ;  7/14/94 MLH added NEW to next line to cause version to be
 +2       ;          correctly identified
NN        ;    version number
           NEW VR,V
           SET VR=$PIECE($TEXT(ONCOENV+1),";",3)
           SET V=$GET(^ONCO(169.99,0,"NVR"))
 +1       ;    already installed - bail out?
           IF V=VR
               Begin DoDot:1
 +2                NEW I,Y
 +3       ;    site number
                   SET I=$PIECE(^ONCO(169.99,0),U,3)
 +4       ;    installation date
                   SET Y=$PIECE(^ONCO(169.99,I,0),U,4)
 +5                DO DD^%DT
 +6                WRITE !!,*7,*7,?10,"INSTALLATION "_V_" Completed: "_Y_"."
 +7       ;    let user bail out
                   IF '$$GOAHEAD
                       KILL DIFQ
 +8                QUIT 
               End DoDot:1
 +9       ;END IF
 +10      ;
 +11      ;    didn't bail out
           IF $DATA(DIFQ)
               DO START
 +12      ;    set up for restaging
           IF $DATA(DIFQ)
               IF 'OFST
                   DO RSTSET
 +13      ;
 +14      ;   7/12/94 MLH REMOVED logic to check proceeding w/o restaging
 +15      ;               to entry point ONCOENA
 +16      ;
 +17      ;    they don't want to restage - do they want to quit?
           IF $DATA(DIFQ)
               IF $GET(ONCOI1ST)'>0
                   DO QNORSTG^ONCOENA
 +18       QUIT 
 +19      ;
START      SET XIU="T"
           SET OFST=0
           SET NM="ONCOLOGY TUMOR REGISTRY"
 +1        SET %H=$HOROLOG
           DO YX^%DTC
           SET (ONCOBEG,ONCOST)=Y
           DO DD^%DT
 +2        DO LOGO^ONCODIS
           DO V
           WRITE !!
 +3       ;    virgin install
           IF '$ORDER(^ONCO(160,0))
               Begin DoDot:1
 +4                SET OFST=1
 +5                DO CV
 +6                QUIT 
               End DoDot:1
 +7       ;    non-virgin
          IF '$TEST
               Begin DoDot:1
 +8                DO CI
 +9                QUIT 
               End DoDot:1
 +10      ;END IF
 +11      ;
EX        ;Exit conversion
 +1        KILL DIK,DIR,DIU,ER,RR,I,J,K,L,LTD,MC,N,N1,NAC,NF,NFM,NXT,REM,S,T,TC,XDD,XIU
           FOR I="T","N","M"
               KILL ^UTILITY($JOB,I)
 +2        QUIT 
 +3       ;
CI        ;CHECK INSTALLATION VERSION
 +1        SET INS=$GET(^ONCO(169.99,0,"INS"))
 +2       ;    previously aborted in the middle?
           IF INS'=""
               IF '$DATA(^DD(160))
                   Begin DoDot:1
 +3                    WRITE !!?10,"Appears installation was started, not completed"
 +4                    WRITE !?10,"- no other information available, will continue..."
 +5                    SET V=$GET(^ONCO(169.99,0,"OVR"))
 +6                    QUIT 
                   End DoDot:1
 +7       IF '$TEST
               Begin DoDot:1
 +8       ;    previously aborted in the middle?
                   IF INS'=""
                       Begin DoDot:2
 +9                        SET VX=$PIECE(INS,U)
                           SET ST=$PIECE(INS,U,2)
                           SET Y=ST
                           DO DD^%DT
 +10                       WRITE !!?10,"Appears installation of V"_VX_" on "_Y
 +11                       WRITE !?10,"began, but did not complete - will continue installation..."
 +12                       QUIT 
                       End DoDot:2
 +13      ;END IF
 +14      ;
 +15      ;    get version number
                   DO CV
 +16               QUIT 
               End DoDot:1
 +17      ;END IF
 +18      ;
CN         WRITE !!,"I am going to clean out DD's (national fields only)."
 +1        WRITE !,"I will also purge the static files, except for FOLLOW-UP FORM LETTER."
 +2       ;    do they want to abort?
           DO AB
 +3       ;    yes, user bailed out
           IF Y'=1
 +4       ;    no, and no need to do ICDO conv
          IF '$TEST
               IF V=""!(V>1.79)
 +5       ;    no, but version too old - must do ICDO conv
          IF '$TEST
               WRITE !!,"Please convert to Version 2.0 before proceeding.",!!
               KILL DIFQ
 +6       ;END IF
 +7       ;
 +8        QUIT 
 +9       ;
V          WRITE !!!?25,"INSTALLATION: VERSION ",VR,!?25,Y
           QUIT 
 +1       ;
AB         KILL DIR
           SET DIR("A")="       CONTINUE with Installation: "
           SET DIR("B")="Yes"
           SET DIR(0)="Y"
           DO ^DIR
           if Y=1
               QUIT 
           DO ABORT
           QUIT 
ABORT      WRITE !!?7,"Installation aborted - you may DO ^ONCOINIT at any time."
           KILL DIFQ
 +1        QUIT 
 +2       ;
GOAHEAD() ;    does user want to go ahead with installation?
 +1        NEW DIR
 +2        SET DIR("A")="Do you want to proceed"
           SET DIR("B")="No"
           SET DIR(0)="Y"
 +3        SET DIR("?",1)="It appears that you have already installed this version successfully."
 +4        SET DIR("?",2)="Unless your ISC has requested that you reinstall, you can stop here"
 +5        SET DIR("?",2.5)="and no changes will have been made to the package."
 +6       ;    following message applies only to released version
           IF $TEXT(+2)["2.1;"
               Begin DoDot:1
 +7                SET DIR("?",2.9)=""
 +8                SET DIR("?",3)="Remember that if you proceed with installation, you must re-apply"
 +9                SET DIR("?",4)="all patches to this package before allowing users to log back in"
 +10               SET DIR("?",5)="to the system."
 +11               SET DIR("?",5.9)=""
 +12               SET DIR("?",6)="If you need further help, answer No here and contact your ISC."
 +13               QUIT 
               End DoDot:1
 +14      ;END IF
 +15      ;
 +16       DO ^DIR
 +17       QUIT Y
 +18      ;
CV         SET VRN=$GET(^ONCO(169.99,0,"NVR"))
           SET V=$PIECE(VRN,U)
           SET VND=$PIECE(VRN,U,3)
           SET V=$SELECT('V:"NONE",1:V)
           SET VX=$SELECT(V["T":"Alpha Test",V["V":"Beta Test/Verification",1:"Released")_" Version"
           SET ^ONCO(169.99,0,"OVR")=V
 +1        IF 'OFST
               WRITE !?20,"VERSION "_V_" currently installed",!?32,VX
 +2       IF '$TEST
               IF '$DATA(^ONCO(160))
                   WRITE !,?20,"This is a VIRGIN Installation",!!
 +3        QUIT 
 +4       ;
RSTSET    ;JAH 01FEB95; Set up for restaging - called by CK
 +1        WRITE !!,"The post-initialization can automatically recompute"
 +2        WRITE !,"the AJCC staging of entries on your primary file with"
 +3        WRITE !,"a DIAGNOSIS DATE on or after a date you specify."
 +4        WRITE !!,"Answer YES to restage."
 +5        SET DIR(0)="Y"
           SET DIR("B")="NO"
           SET DIR("A")="Do you want to RESTAGE"
 +6        SET DIR("?")="Answer Yes or No to the restaging question."
 +7        SET DIR("?",1)="The Oncology Registrar may be best suited to help answer the restaging questions"
 +8        DO ^DIR
 +9        IF $DATA(DTOUT)!$DATA(DUOUT)!(Y=0)
               SET ONCOI1ST=-1
 +10      ;    get the date
          IF '$TEST
               SET ONCOI1ST=$$RSTGASK^ONCOU55A
 +11       QUIT