ENPOST ;(WASH ISC)/DH-PostInitialization Routine ;8-16-93
;;7.0;ENGINEERING;;Aug 17, 1993
;
EN I '$D(ENDATE) S %DT="",X="T" D ^%DT X ^DD("DD") S ENDATE=Y
S ENX=$S($D(^%ZOSF("VOL")):^%ZOSF("VOL"),1:"ENG"),^ENG("VERSION",7.0,ENX,"DD")=ENDATE
I $D(^ENG("VERSION"))#10=0 G EXIT
;Convert CMR official to pointer
F DA=0:0 S DA=$O(^ENG(6914.1,DA)) Q:DA'>0 S X=$P(^ENG(6914.1,DA,0),U,2) I X]"",$D(^VA(200,"B",X)) S X=$O(^VA(200,"B",X,0)) S:X>0 $P(^ENG(6914.1,DA,0),U,2)=X
S DIK="^ENG(""SP"",",DIK(1)=".01^AF" D ENALL^DIK K DIK
I $E(^ENG("VERSION"))=7 G EXIT
K ^ENG("WO","C"),^ENG("WO","E"),^ENG("WO","F"),^ENG("WO","G")
K ^ENG("WO","H"),^ENG("WO","X")
W !!,"Now re-building your Work Order File."
F DA=0:0 S DA=$O(^ENG("WO",DA)) Q:DA'>0 D
. Q:'$D(^ENG("WO",DA,0)) I $E(^ENG("WO",DA,0))="*" Q
. I $D(^ENG("WO",DA,5)) S ENX=$P(^(5),U) I ENX>0 S $P(^(5),U)="" I $D(^ENG("ACT",ENX)) S ^ENG("WO",DA,8,0)="^6920.035PA^1^1",ENX(0)=$P(^ENG("ACT",ENX,0),U,2),^ENG("WO",DA,8,1,0)=ENX(0)
. S %X="^ENG(""WO"",DA,",%Y="^ENG(6920,DA," D %XY^%RCR K ^ENG("WO",DA) W:'(DA#20) "."
K ^ENG("WO")
W !,"Now re-indexing Work Order File. This could take awhile..."
S DIU(0)=""
S DIK="^ENG(6920," D IXALL^DIK
K DIK
LOC ;Convert LOCATIONS from free text into pointers
W !!,"Now converting LOCATIONS in your Equipment File"
F DA=0:0 S DA=$O(^ENG(6914,DA)) Q:DA'>0 W:'(DA#30) "." D
. I $D(^ENG(6914,DA,3)) S ENX=$P(^(3),U,5) I ENX]"" D
.. S ENX1=$O(^ENG("SP","B",ENX,0)) I ENX1>0 D
... S $P(^ENG(6914,DA,3),U,5)=ENX1
... K ^ENG(6914,"D",ENX,DA)
... S ^ENG(6914,"D",ENX1,DA)=""
W !!,"Now converting Work Order LOCATIONS"
F DA=0:0 S DA=$O(^ENG(6920,DA)) Q:DA'>0 W:'(DA#30) "." D
. Q:'$D(^ENG(6920,DA,0)) S ENX=$P(^(0),U,4) I ENX]"",ENX'=" " D
.. S ENX1=$O(^ENG("SP","B",ENX,0)) I ENX1>0 D
... S $P(^ENG(6920,DA,0),U,4)=ENX1
... K ^ENG(6920,"C",ENX,DA)
... S ^ENG(6920,"C",ENX1,DA)=""
PROJ ;Convert data in File 6925
W !!,"Now converting a few data elements in your existing construction projects."
W !,"This shouldn't take very long."
F DA=0:0 S DA=$O(^ENG("PROJ",DA)) Q:DA'>0 D W:'(DA#20) "."
. N STATION Q:'$D(^ENG("PROJ",DA,0)) S STATION=$P(^(0),"-") D:STATION]""
.. S ENX=$O(^DIC(4,"D",STATION,0)) I ENX>0 S $P(^ENG("PROJ",DA,0),U,4)=ENX
. I $D(^ENG("PROJ",DA,1)) S EN=^(1) D
.. S EN1=$P(EN,U,3) I EN1]"" D
... S EN1(0)=$S(EN1="A/E":8,EN1="PP":9,EN1="WD":11,EN1="AA":13,EN1="CO":15,1:"")
... I EN1(0)'="" S $P(EN,U,3)=EN1(0)
.. S EN2=$P(EN,U,4) I EN2]"" D
... S EN2(0)=$S(EN2="HCF":3,EN2="A/E":1,EN2="O/F":1,1:"")
... I EN2(0)'="" S $P(EN,U,4)=EN2(0)
.. S EN3=$P(EN,U,5) I EN3]"" D
... S EN3(0)=$S(EN3="CONTR":1,EN3="P&H":2,EN3="8(a)":4,EN3="HCF":3,1:"")
... I EN3(0)'="" S $P(EN,U,5)=EN3(0)
.. S $P(EN,U,9)=$P(EN,U,6),$P(EN,U,6)=""
.. S ^ENG("PROJ",DA,1)=EN
. I $D(^ENG("PROJ",DA,2)) D
.. S $P(^ENG("PROJ",DA,50),U,2)=$P(^(2),U,2),$P(^(2),U,2)=""
.. S $P(^ENG("PROJ",DA,50),U,3)=$P(^(2),U,3),$P(^(2),U,3)=""
. I $D(^ENG("PROJ",DA,3)) D
.. S $P(^ENG("PROJ",DA,50),U,17)=$P(^(3),U),$P(^(3),U)=""
.. S $P(^ENG("PROJ",DA,50),U,18)=$P(^(3),U,2),$P(^(3),U,2)=""
. I $D(^ENG("PROJ",DA,4)) S EN=^(4) D S ^ENG("PROJ",DA,4)=EN
.. S $P(EN,U,14)=$P(EN,U,5),$P(EN,U,5)=""
.. S $P(EN,U,15)=$P(EN,U,6),$P(EN,U,6)=""
W !,"Now re-indexing"
S DIK="^ENG(""PROJ""," D IXALL^DIK
EXIT ;
S ^ENG("VERSION")=7.0
S %DT="T",X="N" D ^%DT,DD^%DT W !!,"Finished at ",Y,"."
L K ENDATE,ENX,ENX1,DA,%X,%Y,DIK,DIU
K EN,EN1,EN2,EN3
Q
;ENPOST
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENPOST 3527 printed Dec 13, 2024@01:55:19 Page 2
ENPOST ;(WASH ISC)/DH-PostInitialization Routine ;8-16-93
+1 ;;7.0;ENGINEERING;;Aug 17, 1993
+2 ;
EN IF '$DATA(ENDATE)
SET %DT=""
SET X="T"
DO ^%DT
XECUTE ^DD("DD")
SET ENDATE=Y
+1 SET ENX=$SELECT($DATA(^%ZOSF("VOL")):^%ZOSF("VOL"),1:"ENG")
SET ^ENG("VERSION",7.0,ENX,"DD")=ENDATE
+2 IF $DATA(^ENG("VERSION"))#10=0
GOTO EXIT
+3 ;Convert CMR official to pointer
+4 FOR DA=0:0
SET DA=$ORDER(^ENG(6914.1,DA))
if DA'>0
QUIT
SET X=$PIECE(^ENG(6914.1,DA,0),U,2)
IF X]""
IF $DATA(^VA(200,"B",X))
SET X=$ORDER(^VA(200,"B",X,0))
if X>0
SET $PIECE(^ENG(6914.1,DA,0),U,2)=X
+5 SET DIK="^ENG(""SP"","
SET DIK(1)=".01^AF"
DO ENALL^DIK
KILL DIK
+6 IF $EXTRACT(^ENG("VERSION"))=7
GOTO EXIT
+7 KILL ^ENG("WO","C"),^ENG("WO","E"),^ENG("WO","F"),^ENG("WO","G")
+8 KILL ^ENG("WO","H"),^ENG("WO","X")
+9 WRITE !!,"Now re-building your Work Order File."
+10 FOR DA=0:0
SET DA=$ORDER(^ENG("WO",DA))
if DA'>0
QUIT
Begin DoDot:1
+11 if '$DATA(^ENG("WO",DA,0))
QUIT
IF $EXTRACT(^ENG("WO",DA,0))="*"
QUIT
+12 IF $DATA(^ENG("WO",DA,5))
SET ENX=$PIECE(^(5),U)
IF ENX>0
SET $PIECE(^(5),U)=""
IF $DATA(^ENG("ACT",ENX))
SET ^ENG("WO",DA,8,0)="^6920.035PA^1^1"
SET ENX(0)=$PIECE(^ENG("ACT",ENX,0),U,2)
SET ^ENG("WO",DA,8,1,0)=ENX(0)
+13 SET %X="^ENG(""WO"",DA,"
SET %Y="^ENG(6920,DA,"
DO %XY^%RCR
KILL ^ENG("WO",DA)
if '(DA#20)
WRITE "."
End DoDot:1
+14 KILL ^ENG("WO")
+15 WRITE !,"Now re-indexing Work Order File. This could take awhile..."
+16 SET DIU(0)=""
+17 SET DIK="^ENG(6920,"
DO IXALL^DIK
+18 KILL DIK
LOC ;Convert LOCATIONS from free text into pointers
+1 WRITE !!,"Now converting LOCATIONS in your Equipment File"
+2 FOR DA=0:0
SET DA=$ORDER(^ENG(6914,DA))
if DA'>0
QUIT
if '(DA#30)
WRITE "."
Begin DoDot:1
+3 IF $DATA(^ENG(6914,DA,3))
SET ENX=$PIECE(^(3),U,5)
IF ENX]""
Begin DoDot:2
+4 SET ENX1=$ORDER(^ENG("SP","B",ENX,0))
IF ENX1>0
Begin DoDot:3
+5 SET $PIECE(^ENG(6914,DA,3),U,5)=ENX1
+6 KILL ^ENG(6914,"D",ENX,DA)
+7 SET ^ENG(6914,"D",ENX1,DA)=""
End DoDot:3
End DoDot:2
End DoDot:1
+8 WRITE !!,"Now converting Work Order LOCATIONS"
+9 FOR DA=0:0
SET DA=$ORDER(^ENG(6920,DA))
if DA'>0
QUIT
if '(DA#30)
WRITE "."
Begin DoDot:1
+10 if '$DATA(^ENG(6920,DA,0))
QUIT
SET ENX=$PIECE(^(0),U,4)
IF ENX]""
IF ENX'=" "
Begin DoDot:2
+11 SET ENX1=$ORDER(^ENG("SP","B",ENX,0))
IF ENX1>0
Begin DoDot:3
+12 SET $PIECE(^ENG(6920,DA,0),U,4)=ENX1
+13 KILL ^ENG(6920,"C",ENX,DA)
+14 SET ^ENG(6920,"C",ENX1,DA)=""
End DoDot:3
End DoDot:2
End DoDot:1
PROJ ;Convert data in File 6925
+1 WRITE !!,"Now converting a few data elements in your existing construction projects."
+2 WRITE !,"This shouldn't take very long."
+3 FOR DA=0:0
SET DA=$ORDER(^ENG("PROJ",DA))
if DA'>0
QUIT
Begin DoDot:1
+4 NEW STATION
if '$DATA(^ENG("PROJ",DA,0))
QUIT
SET STATION=$PIECE(^(0),"-")
if STATION]""
Begin DoDot:2
+5 SET ENX=$ORDER(^DIC(4,"D",STATION,0))
IF ENX>0
SET $PIECE(^ENG("PROJ",DA,0),U,4)=ENX
End DoDot:2
+6 IF $DATA(^ENG("PROJ",DA,1))
SET EN=^(1)
Begin DoDot:2
+7 SET EN1=$PIECE(EN,U,3)
IF EN1]""
Begin DoDot:3
+8 SET EN1(0)=$SELECT(EN1="A/E":8,EN1="PP":9,EN1="WD":11,EN1="AA":13,EN1="CO":15,1:"")
+9 IF EN1(0)'=""
SET $PIECE(EN,U,3)=EN1(0)
End DoDot:3
+10 SET EN2=$PIECE(EN,U,4)
IF EN2]""
Begin DoDot:3
+11 SET EN2(0)=$SELECT(EN2="HCF":3,EN2="A/E":1,EN2="O/F":1,1:"")
+12 IF EN2(0)'=""
SET $PIECE(EN,U,4)=EN2(0)
End DoDot:3
+13 SET EN3=$PIECE(EN,U,5)
IF EN3]""
Begin DoDot:3
+14 SET EN3(0)=$SELECT(EN3="CONTR":1,EN3="P&H":2,EN3="8(a)":4,EN3="HCF":3,1:"")
+15 IF EN3(0)'=""
SET $PIECE(EN,U,5)=EN3(0)
End DoDot:3
+16 SET $PIECE(EN,U,9)=$PIECE(EN,U,6)
SET $PIECE(EN,U,6)=""
+17 SET ^ENG("PROJ",DA,1)=EN
End DoDot:2
+18 IF $DATA(^ENG("PROJ",DA,2))
Begin DoDot:2
+19 SET $PIECE(^ENG("PROJ",DA,50),U,2)=$PIECE(^(2),U,2)
SET $PIECE(^(2),U,2)=""
+20 SET $PIECE(^ENG("PROJ",DA,50),U,3)=$PIECE(^(2),U,3)
SET $PIECE(^(2),U,3)=""
End DoDot:2
+21 IF $DATA(^ENG("PROJ",DA,3))
Begin DoDot:2
+22 SET $PIECE(^ENG("PROJ",DA,50),U,17)=$PIECE(^(3),U)
SET $PIECE(^(3),U)=""
+23 SET $PIECE(^ENG("PROJ",DA,50),U,18)=$PIECE(^(3),U,2)
SET $PIECE(^(3),U,2)=""
End DoDot:2
+24 IF $DATA(^ENG("PROJ",DA,4))
SET EN=^(4)
Begin DoDot:2
+25 SET $PIECE(EN,U,14)=$PIECE(EN,U,5)
SET $PIECE(EN,U,5)=""
+26 SET $PIECE(EN,U,15)=$PIECE(EN,U,6)
SET $PIECE(EN,U,6)=""
End DoDot:2
SET ^ENG("PROJ",DA,4)=EN
End DoDot:1
if '(DA#20)
WRITE "."
+27 WRITE !,"Now re-indexing"
+28 SET DIK="^ENG(""PROJ"","
DO IXALL^DIK
EXIT ;
+1 SET ^ENG("VERSION")=7.0
+2 SET %DT="T"
SET X="N"
DO ^%DT
DO DD^%DT
WRITE !!,"Finished at ",Y,"."
+3 LOCK
KILL ENDATE,ENX,ENX1,DA,%X,%Y,DIK,DIU
+4 KILL EN,EN1,EN2,EN3
+5 QUIT
+6 ;ENPOST