DVBAPOST ;ALBANY-ISC/GTS-AMIE 2.6 POST-INIT RTN ;1/15/93
 ;;2.7;AMIE;;Apr 10, 1995
 ;
EN D SET1^DVBAUTL1
 K ^TMP("DVBA",$J)
 W !,"Setting up List Manager Templates",!
 D ^DVBAL ;set up templates used by List Manager screens
 D ^DVBAONIT ;calls the onits to set up the List Manager screens/actions
 D REINDAC^DVBAPST1
 D REINDAF^DVBAPST1
 D REINDAE^DVBAPST1
EN12 D ^DVBAPOPU ;populates various global information
EN14 D ^DVBAPOP2 ;populates the pointer field of 396.6
EN11 D EN^DVBAPADD ;adds new disability conditions
EN10 D ^DVBAORPH ;adds orphan exams.
EN1 K STOP
 D CHECK ; checks if pre init ran ok.
 I $D(STOP) D SE G MAIL ;stops if pre init did not run ok.
EN2 D EN^DVBAPLNG ;updates the long description of file 31.
EN3 K STOP
 D EN^DVBAPLL ;updates the local lookup file with file 31.
 I $D(STOP) D SE1 G MAIL ;stops if problems adding to Local Lookup file.
 D ORPHAN^DVBAPCXR
EN4 ;;;D EN^DVBAPSHT ;enters the short cuts into the MTLU files. (DVBAPH1-99)
EN5 D EN^DVBAPKY ;enters the keywords into the MTLU files. (DVBAPK1-99)
EN13 D EN^DVBAPOKY ;enters the orphan keywords into the MTLU files. (DVBAPOK1)
EN6 D EN^DVBAPSYN ;enters the synonyms into the MTLU files. (DVBAPS1-99)
EN7 D EN^DVBAPBDY ;enters the disability codes into the body system file. (DVBAPB1-99)
EN8 D EN^DVBAPWKS ;enters the disability codes into the AMIE worksheets. (DVBAPW1-99)
 D FINISHED ;prints out a completed message
MAIL S V3=$$MAL($J) ;builds and sends the mail message from the post init running
 D EXIT^DVBAUTL1
 Q
 ;
FINISHED ;
 N VAR
 S VAR="The Post-Init has completed."
 W *7,!!!,VAR
 D BUMP(VAR)
 Q
 ;
CHECK ;checks for the 'post' node to see if the pre init ran ok.
 I '$D(^DVB(396.1,1,"POST")) S STOP=1 Q
 I ^DVB(396.1,1,"POST")']"" S STOP=1 Q
 Q
MAL(V2) ;builds a mail message and sends to the DUZ defined.  v2 must be the
 ;$J from the job of the post init.
 ;
 N LNE,LNCNT
 S XMDUZ="AMIE POST INIT"
 S XMSUB="AMIE v2.7 install results"
 D XMZ^XMA2 ;** Get message number
 I XMZ'>0 DO
 .W !!,"Mail Message containing Error Log has failed!",!
 .W "Errors contained in ^TMP(""DVBA"","_V2_") global.",!
 .W "Investigate this global to determine any existing problems."
 .W !!
 I XMZ>0 DO
 .F LNE=0:0 S LNE=$O(^TMP("DVBA",V2,LNE)) Q:'LNE  DO
 ..S ^XMB(3.9,XMZ,2,LNE,0)=(^TMP("DVBA",V2,LNE)),LNCNT=LNE
 .S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LNCNT_"^"_LNCNT_"^"_DT
 .K XMDUN
 .S (XMY(DUZ),XMY(.5))=""
 .D ENT1^XMD
 .W !!,"Mail message containing Error Log has been sent.",!
 .W "Check your mail to see this log.",!!
 .K ^TMP("DVBA",V2)
 Q 1
 ;
SET ;set necessary local variables
 S CNT=1
 Q
 ;
SE S VAR="The pre-init found a problem in the version of MTLU and KERNEL."
 W !!,VAR D BUMPBLK,BUMP(VAR)
 S VAR="Please review and correct.  See install guide for further details."
 W !,VAR D BUMP(VAR)
 S VAR="No updates have occurred to the following files:"
 W !,VAR D BUMP(VAR)
 S VAR="      Local Lookup"
 W !,VAR D BUMP(VAR)
 S VAR="      Local keyword"
 W !,VAR D BUMP(VAR)
 S VAR="      Local Synonym"
 W !,VAR D BUMP(VAR)
 ;;;S VAR="      Local Shortcut"
 ;;;W !,VAR D BUMP(VAR)
 S VAR="      2507 Body System"
 W !,VAR D BUMP(VAR)
 S VAR="      AMIE Exam file."
 W !,VAR D BUMP(VAR)
 S VAR="      Long Descriptions of the Disability Condition file."
 W !,VAR D BUMP(VAR)
 Q
 ;
SE1 ;
 S VAR="The post init could not add to the Local Lookup file."
 W !!,VAR D BUMPBLK,BUMP(VAR)
 S VAR="No updates have occurred to the following files:"
 W !,VAR D BUMP(VAR)
 S VAR="      Local keyword"
 W !,VAR D BUMP(VAR)
 S VAR="      Local Synonym"
 W !,VAR D BUMP(VAR)
 S VAR="      Local Shortcut"
 W !,VAR D BUMP(VAR)
 S VAR="      2507 Body System"
 W !,VAR D BUMP(VAR)
 S VAR="      AMIE Exam file."
 W !,VAR D BUMP(VAR)
 Q
 ;
BUMP(V1) ;adds the entry and bumps the general counter.
 S ^TMP("DVBA",$J,CNT)=V1
 S CNT=CNT+1
 Q
 ;
BUMPBLK ;adds a blank line to the array
 S ^TMP("DVBA",$J,CNT)=""
 S CNT=CNT+1
 Q
 ;
OPEN F LP3=1:1 S LP4=$T(OPT+LP3) Q:LP4'[";;"  S LP4=$P(LP4,";;",2) DO
 .S DIC="^DIC(19,",DIC(0)="MZ",X=LP4
 .D ^DIC
 .K DIC
 .I Y<0 D ERR Q
 .I Y>0 DO
 ..S DIE="^DIC(19,",DIC(0)="MZ",DA=+Y,DR="2///@"
 ..D ^DIE
 ..W !,LP4," Now in order!"
 ..K DIE,DIC,VAR,DR
 ..Q
 .K Y
 .Q
 K DIC,DIE,X,Y,DA,DR
 S DIC="^ORD(101,",DIC(0)="MZ",X="DVBA C&P SCHD EVENT"
 D ^DIC
 K DIC
 I Y<0 D ERR
 I Y>0 DO
 .S DIE="^ORD(101,",DIC(0)="MZ",DA=+Y,DR="2///@"
 .D ^DIE
 .W !,"DVBA C&P SCHD EVENT Now in order!"
 K DIC,DIE,X,Y,LP3,LP4,DA,DR
 Q
 ;
ERR ;
 W "Could not find menu option ",X," NOT opened!"
 Q
 ;
OPT ;
 ;;DVBA MEDICAL ADM 7131 MENU
 ;;DVBA REGIONAL OFFICE MENU
 ;;DVBA C PROCESS MAIL MESSAGE
 ;;DVBA C PHYSICIANS GUIDE
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBAPOST   4760     printed  Sep 23, 2025@19:17:49                                                                                                                                                                                                    Page 2
DVBAPOST  ;ALBANY-ISC/GTS-AMIE 2.6 POST-INIT RTN ;1/15/93
 +1       ;;2.7;AMIE;;Apr 10, 1995
 +2       ;
EN         DO SET1^DVBAUTL1
 +1        KILL ^TMP("DVBA",$JOB)
 +2        WRITE !,"Setting up List Manager Templates",!
 +3       ;set up templates used by List Manager screens
           DO ^DVBAL
 +4       ;calls the onits to set up the List Manager screens/actions
           DO ^DVBAONIT
 +5        DO REINDAC^DVBAPST1
 +6        DO REINDAF^DVBAPST1
 +7        DO REINDAE^DVBAPST1
EN12      ;populates various global information
           DO ^DVBAPOPU
EN14      ;populates the pointer field of 396.6
           DO ^DVBAPOP2
EN11      ;adds new disability conditions
           DO EN^DVBAPADD
EN10      ;adds orphan exams.
           DO ^DVBAORPH
EN1        KILL STOP
 +1       ; checks if pre init ran ok.
           DO CHECK
 +2       ;stops if pre init did not run ok.
           IF $DATA(STOP)
               DO SE
               GOTO MAIL
EN2       ;updates the long description of file 31.
           DO EN^DVBAPLNG
EN3        KILL STOP
 +1       ;updates the local lookup file with file 31.
           DO EN^DVBAPLL
 +2       ;stops if problems adding to Local Lookup file.
           IF $DATA(STOP)
               DO SE1
               GOTO MAIL
 +3        DO ORPHAN^DVBAPCXR
EN4       ;;;D EN^DVBAPSHT ;enters the short cuts into the MTLU files. (DVBAPH1-99)
EN5       ;enters the keywords into the MTLU files. (DVBAPK1-99)
           DO EN^DVBAPKY
EN13      ;enters the orphan keywords into the MTLU files. (DVBAPOK1)
           DO EN^DVBAPOKY
EN6       ;enters the synonyms into the MTLU files. (DVBAPS1-99)
           DO EN^DVBAPSYN
EN7       ;enters the disability codes into the body system file. (DVBAPB1-99)
           DO EN^DVBAPBDY
EN8       ;enters the disability codes into the AMIE worksheets. (DVBAPW1-99)
           DO EN^DVBAPWKS
 +1       ;prints out a completed message
           DO FINISHED
MAIL      ;builds and sends the mail message from the post init running
           SET V3=$$MAL($JOB)
 +1        DO EXIT^DVBAUTL1
 +2        QUIT 
 +3       ;
FINISHED  ;
 +1        NEW VAR
 +2        SET VAR="The Post-Init has completed."
 +3        WRITE *7,!!!,VAR
 +4        DO BUMP(VAR)
 +5        QUIT 
 +6       ;
CHECK     ;checks for the 'post' node to see if the pre init ran ok.
 +1        IF '$DATA(^DVB(396.1,1,"POST"))
               SET STOP=1
               QUIT 
 +2        IF ^DVB(396.1,1,"POST")']""
               SET STOP=1
               QUIT 
 +3        QUIT 
MAL(V2)   ;builds a mail message and sends to the DUZ defined.  v2 must be the
 +1       ;$J from the job of the post init.
 +2       ;
 +3        NEW LNE,LNCNT
 +4        SET XMDUZ="AMIE POST INIT"
 +5        SET XMSUB="AMIE v2.7 install results"
 +6       ;** Get message number
           DO XMZ^XMA2
 +7        IF XMZ'>0
               Begin DoDot:1
 +8                WRITE !!,"Mail Message containing Error Log has failed!",!
 +9                WRITE "Errors contained in ^TMP(""DVBA"","_V2_") global.",!
 +10               WRITE "Investigate this global to determine any existing problems."
 +11               WRITE !!
               End DoDot:1
 +12       IF XMZ>0
               Begin DoDot:1
 +13               FOR LNE=0:0
                       SET LNE=$ORDER(^TMP("DVBA",V2,LNE))
                       if 'LNE
                           QUIT 
                       Begin DoDot:2
 +14                       SET ^XMB(3.9,XMZ,2,LNE,0)=(^TMP("DVBA",V2,LNE))
                           SET LNCNT=LNE
                       End DoDot:2
 +15               SET ^XMB(3.9,XMZ,2,0)="^3.92A^"_LNCNT_"^"_LNCNT_"^"_DT
 +16               KILL XMDUN
 +17               SET (XMY(DUZ),XMY(.5))=""
 +18               DO ENT1^XMD
 +19               WRITE !!,"Mail message containing Error Log has been sent.",!
 +20               WRITE "Check your mail to see this log.",!!
 +21               KILL ^TMP("DVBA",V2)
               End DoDot:1
 +22       QUIT 1
 +23      ;
SET       ;set necessary local variables
 +1        SET CNT=1
 +2        QUIT 
 +3       ;
SE         SET VAR="The pre-init found a problem in the version of MTLU and KERNEL."
 +1        WRITE !!,VAR
           DO BUMPBLK
           DO BUMP(VAR)
 +2        SET VAR="Please review and correct.  See install guide for further details."
 +3        WRITE !,VAR
           DO BUMP(VAR)
 +4        SET VAR="No updates have occurred to the following files:"
 +5        WRITE !,VAR
           DO BUMP(VAR)
 +6        SET VAR="      Local Lookup"
 +7        WRITE !,VAR
           DO BUMP(VAR)
 +8        SET VAR="      Local keyword"
 +9        WRITE !,VAR
           DO BUMP(VAR)
 +10       SET VAR="      Local Synonym"
 +11       WRITE !,VAR
           DO BUMP(VAR)
 +12      ;;;S VAR="      Local Shortcut"
 +13      ;;;W !,VAR D BUMP(VAR)
 +14       SET VAR="      2507 Body System"
 +15       WRITE !,VAR
           DO BUMP(VAR)
 +16       SET VAR="      AMIE Exam file."
 +17       WRITE !,VAR
           DO BUMP(VAR)
 +18       SET VAR="      Long Descriptions of the Disability Condition file."
 +19       WRITE !,VAR
           DO BUMP(VAR)
 +20       QUIT 
 +21      ;
SE1       ;
 +1        SET VAR="The post init could not add to the Local Lookup file."
 +2        WRITE !!,VAR
           DO BUMPBLK
           DO BUMP(VAR)
 +3        SET VAR="No updates have occurred to the following files:"
 +4        WRITE !,VAR
           DO BUMP(VAR)
 +5        SET VAR="      Local keyword"
 +6        WRITE !,VAR
           DO BUMP(VAR)
 +7        SET VAR="      Local Synonym"
 +8        WRITE !,VAR
           DO BUMP(VAR)
 +9        SET VAR="      Local Shortcut"
 +10       WRITE !,VAR
           DO BUMP(VAR)
 +11       SET VAR="      2507 Body System"
 +12       WRITE !,VAR
           DO BUMP(VAR)
 +13       SET VAR="      AMIE Exam file."
 +14       WRITE !,VAR
           DO BUMP(VAR)
 +15       QUIT 
 +16      ;
BUMP(V1)  ;adds the entry and bumps the general counter.
 +1        SET ^TMP("DVBA",$JOB,CNT)=V1
 +2        SET CNT=CNT+1
 +3        QUIT 
 +4       ;
BUMPBLK   ;adds a blank line to the array
 +1        SET ^TMP("DVBA",$JOB,CNT)=""
 +2        SET CNT=CNT+1
 +3        QUIT 
 +4       ;
OPEN       FOR LP3=1:1
               SET LP4=$TEXT(OPT+LP3)
               if LP4'[";;"
                   QUIT 
               SET LP4=$PIECE(LP4,";;",2)
               Begin DoDot:1
 +1                SET DIC="^DIC(19,"
                   SET DIC(0)="MZ"
                   SET X=LP4
 +2                DO ^DIC
 +3                KILL DIC
 +4                IF Y<0
                       DO ERR
                       QUIT 
 +5                IF Y>0
                       Begin DoDot:2
 +6                        SET DIE="^DIC(19,"
                           SET DIC(0)="MZ"
                           SET DA=+Y
                           SET DR="2///@"
 +7                        DO ^DIE
 +8                        WRITE !,LP4," Now in order!"
 +9                        KILL DIE,DIC,VAR,DR
 +10                       QUIT 
                       End DoDot:2
 +11               KILL Y
 +12               QUIT 
               End DoDot:1
 +13       KILL DIC,DIE,X,Y,DA,DR
 +14       SET DIC="^ORD(101,"
           SET DIC(0)="MZ"
           SET X="DVBA C&P SCHD EVENT"
 +15       DO ^DIC
 +16       KILL DIC
 +17       IF Y<0
               DO ERR
 +18       IF Y>0
               Begin DoDot:1
 +19               SET DIE="^ORD(101,"
                   SET DIC(0)="MZ"
                   SET DA=+Y
                   SET DR="2///@"
 +20               DO ^DIE
 +21               WRITE !,"DVBA C&P SCHD EVENT Now in order!"
               End DoDot:1
 +22       KILL DIC,DIE,X,Y,LP3,LP4,DA,DR
 +23       QUIT 
 +24      ;
ERR       ;
 +1        WRITE "Could not find menu option ",X," NOT opened!"
 +2        QUIT 
 +3       ;
OPT       ;
 +1       ;;DVBA MEDICAL ADM 7131 MENU
 +2       ;;DVBA REGIONAL OFFICE MENU
 +3       ;;DVBA C PROCESS MAIL MESSAGE
 +4       ;;DVBA C PHYSICIANS GUIDE
 +5       ;