DDS01 ;SFISC/MLH,MKO-PROCESS BLOCK ;19OCT2012
;;22.0;VA FileMan;**8,39,167**;Mar 30, 1999;Build 20
;Per VHA Directive 2004-038, this routine should not be modified.
;***BE CAREFUL PUTTING TAGS INTO THIS IMPORTANT ROUTINE! $T LOOKS FOR A NON-EXISTENCE OF A TAG!****
;
F D IN,CHK Q:"^Q^NB^NP^"[(U_DDACT_U)
Q
;
IN K DDSBR,DDSFLD,DDSO,DDSU,DIR
S:$D(@DDSREFS@(DDSPG,$S(DDO:DDSBK,1:0),DDO,"N"))#2 DDSU("N")=^("N")
;
I DDM,'$G(DDSKM) D CLRMSG^DDS
G:'DDO COM^DDSCOM
;
S DDSOSV=0
F DDSI=0,1,2,4,7,10:1:14,20 D ;MOVE FIELD DEFINITION INTO DDSO ARRAY
. S:$D(^DIST(.404,DDSBK,40,DDO,DDSI))#2 DDSO(DDSI)=^(DDSI)
K DDSI
;
S DDSFLD=$G(DDSO(1)) K DDSO(1)
I $P($G(DDSO(0)),U,3)=2 N DDP S DDP=0,DDSFLD=DDO_","_DDSBK
;
I DDSFLD]"",DDSDA]"" M DDSU=@DDSREFT@("F"_DDP,DDSDA,DDSFLD) ;Restore field's specs & value from ^TMP
;
I '$D(DDSREP)!DDSDA,$$UNED($G(DDSU("A")),$G(DDSO(4)),$G(DDSU("N"))) D Q
. I $D(DDSACT)#2 S DDACT=DDSACT K DDSACT
. S:DDACT="U" DDACT="L"
. S:DDACT="D" DDACT="R"
. D CURSOR Q:$D(DDSBR)#2
. S DDSCHKQ=1
K DDSACT
;
S (X,DDSOLD)=$G(DDSU("D")),DDSEXT=$G(DDSU("X"),X)
;
X:$G(DDSO(11))'?."^" DDSO(11) ;PRE-ACTION
I $D(DDSBR)#2 D BR^DDS2 Q:$D(DDSBR)#2
I DDACT]"",$T(@DDACT)]"" D @DDACT S DDSCHKQ=1 Q
;
S DIR0N=1 Q:DDSFLD=""
;
S:$G(^DD(DDP,DDSFLD,0))'?."^" DDSU("DD")=^(0)
I $D(DDSU("N"))[0 S DDACT="N" Q
Q:$D(DDSO(2))[0
;
D:$G(@DDSREFT@("HLP"))>0 HLP^DDSMSG()
K DDSKM,DDQ
;
S DIR0=$P(@DDSREFS@(DDSPG,DDSBK,DDO,"D"),U,1,3)
S:$P(@DDSREFS@(DDSPG,DDSBK,DDO,"D"),U,10) $P(DIR0,U,6)=1
S:$P($G(DDSREP),U,3)>1 $P(DIR0,U)=$P(DIR0,U)+$P(DDSREP,U,3)-1
;
I $D(DDSREP),'DDSDA,$P(DDSO(0),U,3)'=2 K DDSU("DD") G SEL^DDSM
I $D(DDSU("M"))#2 S DDSGL=U_$P(DDSU("M"),U,2) G:'DDSU("M") WP^DDSWP
S DIR("B")=$G(DDSU("X"),DDSOLD)
;
I $D(DDSU("M"))#2 D SEL^DDS5 G:X'=DDSOLD&(DDACT="N") EXT
I $P($G(DDSO(0)),U,3)'=2 S DIR(0)=DDP_","_DDSFLD_"O" ;IT'S A FIELD-TYPE READ
E D DIR^DDSFO
D ^DIR K DIR,DUOUT,DIRUT,DIROUT ;DO THE READ!
I DIR0N S (X,Y)=DDSOLD Q
;
EXT I $E(X)=U!$D(DTOUT) S DIR0N=1 Q
G EXT^DDS02
;
CHK Q:$D(DDSBR)#2
I $G(DDSCHKQ)=1 K DDSCHKQ Q
G:$D(DTOUT) TO^DDS3
G:$E(X)=U UPA^DDS2
I $G(DDSFLD)=.01,X="",$G(DA) G ^DDS6
;
I $P($G(DDSU("DD")),U,2)["I",$G(DDSOLD)]"" D I %]"",X'=% S DDSNOED=1 ;UNEDITABLE FIELD ALREADY HAS A VALUE
.N DIERR S %=$$GET1^DIQ(DDSFILE,DDSDA,DDSFLD)
E I $P($G(DDSU("DD")),U,5,99)["DINUM" S DDSNOED=1
E S DDSNOED=$S($P($G(DDSU("A")),U,4)="":$P($G(DDSO(4)),U,4),1:$P($G(DDSU("A")),U,4)) ;FIELD 6.4 ('DISABLE EDITING) IN THE FIELD MULTIPLE
I 'DIR0N,$G(DDSFLD),$D(DDSU("M"))[0,$G(DDSCHKQ)'=2,DDSNOED K DDSNOED G UNED^DDS02
;
K DDSCHKQ,DDSNOED
;
I $G(DDSFLD)=.01,$G(DDSPTB)]"",$G(DDSREP)<2,'DIR0N D RPF^DDS7(DDP,DDSPTB,DDSDA,.DA)
X:$G(DDSO(12))'?."^" DDSO(12)
;
I 'DIR0N,DDO,$G(DDSFLD)]"" D
. I $P($G(DDSO(0)),U,3)=2 N DDP S DDP=0
. S DDSCHG=1
. I DDSDA!'$D(DDSREP),+$G(DDSU("F"))'=1 S $P(@DDSREFT@("F"_DDP,DDSDA,DDSFLD,"F"),U)=1
. X:$G(DDSO(13))'?."^" DDSO(13)
. D:$D(@DDSREFS@("PT",DDP,DDSFLD)) RPB^DDS7(DDP,DDSFLD,DDSPG)
. D:$D(@DDSREFS@("COMP",DDP,DDSFLD,DDSPG)) RPCF^DDSCOMP(DDSPG)
;
I $D(DDSBR)#2 D BR^DDS2 Q:$D(DDSBR)#2
I $T(@DDACT)]"" G @DDACT
I 'DDO G:X]"" ^DDS3 S DDSO(0)=0
;
G:"^U^D^R^L^"[(U_DDACT_U) CURSOR
G:$D(DDSU("M"))[0 NF
G:DDSU("M") ^DDS5
D EDIT^DDSWP,R^DDSR
;
NF I 'DDO,DDSOSV S DDO=DDSOSV Q
;
I DDO,$S($D(DDSREP):DDSDA,1:1) D
. D:'$D(DDSU("M"))
.. I $G(@DDSREFS@("ASUB",DDSPG,DDSBK,DDO))]"" S DDSSTACK="`"_^(DDO)
.. E I $P($G(DDSO(7)),U,2)]"" S DDSSTACK=$P(DDSO(7),U,2)
. X:$G(DDSO(10))'?."^" DDSO(10)
;
I $D(DDSSTACK) D ^DDSSTK,R^DDS3 K DDSU
I $D(DDSBR)#2 D BR^DDS2 Q:$D(DDSBR)#2
S DDACT="N"
;
CURSOR N ACT,B,BLK,BLK0,FND,N,REP
K DDSACT
S:$D(DDSU("N"))[0 DDSU("N")=$G(@DDSREFS@(DDSPG,DDSBK,DDO,"N"))
S FND=0
I $D(DDSREP),DDO D MNAV^DDSM(.FND) Q:FND
;
S B=U,(BLK,BLK0)=DDSBK,N=DDSU("N"),ACT=$S(DDO&$G(DDSDN):"N",1:DDACT)
F D Q:FND!$D(REP)
. S DDO=$P(N,U,$L($P("U^D^R^L^N",ACT),U))
. I 'DDO S (DDO,DDSBK)=0,FND=1 Q
. ;
. S DDSBK=$P(DDO,",",2),DDO=+DDO
. I DDSBK D Q:$D(REP)
.. I $P($G(@DDSREFS@(DDSPG,DDSBK)),U,4) D
... S DDO=$P($G(@DDSREFS@(DDSPG,DDSBK)),U,9),ACT="N"
.. E S ACT=DDACT
.. I '$P($G(@DDSREFT@(DDSPG,DDSBK)),U),DDSDAORG S B=B_DDSBK_U
.. E I $P(@DDSREFS@(DDSPG,DDSBK),U,7)>1 S REP=1,DDACT="NB",DDSBR=""
. E S DDSBK=BLK
. ;
. I B'[(U_DDSBK_U) S FND=1 S:DDSBK'=BLK0 DDACT="NB",DDSBR="",DDSACT=ACT
. ;
. S:'FND N=$G(@DDSREFS@(DDSPG,DDSBK,+DDO,"N")),BLK=DDSBK
Q
;
NP ;;
G:$D(DDSREP)&DDO PGDN^DDSM
S:DDSNP]"" DDSPG=DDSNP
S:DDSNP="" DDACT="N"
Q
PP ;;
G:$D(DDSREP)&DDO PGUP^DDSM
S DDSPG=$$PP^DDS5(.Y)
S DDACT=$S(Y=1:"NP",1:"N")
Q
NB ;;
S DDSBK=$$NB^DDS5(.Y),DDACT=$S(Y=1:"NB",1:"N")
Q
SEL ;;
I $G(DDSSEL) W $C(7) Q
S DDACT="N" G PG^DDSRSEL
SV ;;
G SV^DDS02
QT ;;
G QT^DDS3
EX ;;
G EX^DDS3
CL ;;
G CL^DDS3
RF ;;
S DDACT="N"
G R^DDSR
;
UNED(ATT,DEF,N) ;
Q $S(N="":1,$P(ATT,U,4)="":$P(DEF,U,4)=1,1:$P(ATT,U,4)=1)&'$P(N,U,11)
DDS01 ;SFISC/MLH,MKO-PROCESS BLOCK ;19OCT2012
+1 ;;22.0;VA FileMan;**8,39,167**;Mar 30, 1999;Build 20
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;***BE CAREFUL PUTTING TAGS INTO THIS IMPORTANT ROUTINE! $T LOOKS FOR A NON-EXISTENCE OF A TAG!****
+4 ;
+5 FOR
DO IN
DO CHK
IF "^Q^NB^NP^"[(U_DDACT_U)
QUIT
+6 QUIT
+7 ;
IN KILL DDSBR,DDSFLD,DDSO,DDSU,DIR
+1 IF $DATA(@DDSREFS@(DDSPG,$SELECT(DDO
SET DDSU("N")=^("N")
+2 ;
+3 IF DDM
IF '$GET(DDSKM)
DO CLRMSG^DDS
+4 IF 'DDO
GOTO COM^DDSCOM
+5 ;
+6 SET DDSOSV=0
+7 ;MOVE FIELD DEFINITION INTO DDSO ARRAY
FOR DDSI=0,1,2,4,7,10:1:14,20
Begin DoDot:1
+8 IF $DATA(^DIST(.404,DDSBK,40,DDO,DDSI))#2
SET DDSO(DDSI)=^(DDSI)
End DoDot:1
+9 KILL DDSI
+10 ;
+11 SET DDSFLD=$GET(DDSO(1))
KILL DDSO(1)
+12 IF $PIECE($GET(DDSO(0)),U,3)=2
NEW DDP
SET DDP=0
SET DDSFLD=DDO_","_DDSBK
+13 ;
+14 ;Restore field's specs & value from ^TMP
IF DDSFLD]""
IF DDSDA]""
MERGE DDSU=@DDSREFT@("F"_DDP,DDSDA,DDSFLD)
+15 ;
+16 IF '$DATA(DDSREP)!DDSDA
IF $$UNED($GET(DDSU("A")),$GET(DDSO(4)),$GET(DDSU("N")))
Begin DoDot:1
+17 IF $DATA(DDSACT)#2
SET DDACT=DDSACT
KILL DDSACT
+18 IF DDACT="U"
SET DDACT="L"
+19 IF DDACT="D"
SET DDACT="R"
+20 DO CURSOR
IF $DATA(DDSBR)#2
QUIT
+21 SET DDSCHKQ=1
End DoDot:1
QUIT
+22 KILL DDSACT
+23 ;
+24 SET (X,DDSOLD)=$GET(DDSU("D"))
SET DDSEXT=$GET(DDSU("X"),X)
+25 ;
+26 ;PRE-ACTION
IF $GET(DDSO(11))'?."^"
XECUTE DDSO(11)
+27 IF $DATA(DDSBR)#2
DO BR^DDS2
IF $DATA(DDSBR)#2
QUIT
+28 IF DDACT]""
IF $TEXT(@DDACT)]""
DO @DDACT
SET DDSCHKQ=1
QUIT
+29 ;
+30 SET DIR0N=1
IF DDSFLD=""
QUIT
+31 ;
+32 IF $GET(^DD(DDP,DDSFLD,0))'?."^"
SET DDSU("DD")=^(0)
+33 IF $DATA(DDSU("N"))[0
SET DDACT="N"
QUIT
+34 IF $DATA(DDSO(2))[0
QUIT
+35 ;
+36 IF $GET(@DDSREFT@("HLP"))>0
DO HLP^DDSMSG()
+37 KILL DDSKM,DDQ
+38 ;
+39 SET DIR0=$PIECE(@DDSREFS@(DDSPG,DDSBK,DDO,"D"),U,1,3)
+40 IF $PIECE(@DDSREFS@(DDSPG,DDSBK,DDO,"D"),U,10)
SET $PIECE(DIR0,U,6)=1
+41 IF $PIECE($GET(DDSREP),U,3)>1
SET $PIECE(DIR0,U)=$PIECE(DIR0,U)+$PIECE(DDSREP,U,3)-1
+42 ;
+43 IF $DATA(DDSREP)
IF 'DDSDA
IF $PIECE(DDSO(0),U,3)'=2
KILL DDSU("DD")
GOTO SEL^DDSM
+44 IF $DATA(DDSU("M"))#2
SET DDSGL=U_$PIECE(DDSU("M"),U,2)
IF 'DDSU("M")
GOTO WP^DDSWP
+45 SET DIR("B")=$GET(DDSU("X"),DDSOLD)
+46 ;
+47 IF $DATA(DDSU("M"))#2
DO SEL^DDS5
IF X'=DDSOLD&(DDACT="N")
GOTO EXT
+48 ;IT'S A FIELD-TYPE READ
IF $PIECE($GET(DDSO(0)),U,3)'=2
SET DIR(0)=DDP_","_DDSFLD_"O"
+49 IF '$TEST
DO DIR^DDSFO
+50 ;DO THE READ!
DO ^DIR
KILL DIR,DUOUT,DIRUT,DIROUT
+51 IF DIR0N
SET (X,Y)=DDSOLD
QUIT
+52 ;
EXT IF $EXTRACT(X)=U!$DATA(DTOUT)
SET DIR0N=1
QUIT
+1 GOTO EXT^DDS02
+2 ;
CHK IF $DATA(DDSBR)#2
QUIT
+1 IF $GET(DDSCHKQ)=1
KILL DDSCHKQ
QUIT
+2 IF $DATA(DTOUT)
GOTO TO^DDS3
+3 IF $EXTRACT(X)=U
GOTO UPA^DDS2
+4 IF $GET(DDSFLD)=.01
IF X=""
IF $GET(DA)
GOTO ^DDS6
+5 ;
+6 ;UNEDITABLE FIELD ALREADY HAS A VALUE
IF $PIECE($GET(DDSU("DD")),U,2)["I"
IF $GET(DDSOLD)]""
Begin DoDot:1
+7 NEW DIERR
SET %=$$GET1^DIQ(DDSFILE,DDSDA,DDSFLD)
End DoDot:1
IF %]""
IF X'=%
SET DDSNOED=1
+8 IF '$TEST
IF $PIECE($GET(DDSU("DD")),U,5,99)["DINUM"
SET DDSNOED=1
+9 ;FIELD 6.4 ('DISABLE EDITING) IN THE FIELD MULTIPLE
IF '$TEST
SET DDSNOED=$SELECT($PIECE($GET(DDSU("A")),U,4)="":$PIECE($GET(DDSO(4)),U,4),1:$PIECE($GET(DDSU("A")),U,4))
+10 IF 'DIR0N
IF $GET(DDSFLD)
IF $DATA(DDSU("M"))[0
IF $GET(DDSCHKQ)'=2
IF DDSNOED
KILL DDSNOED
GOTO UNED^DDS02
+11 ;
+12 KILL DDSCHKQ,DDSNOED
+13 ;
+14 IF $GET(DDSFLD)=.01
IF $GET(DDSPTB)]""
IF $GET(DDSREP)<2
IF 'DIR0N
DO RPF^DDS7(DDP,DDSPTB,DDSDA,.DA)
+15 IF $GET(DDSO(12))'?."^"
XECUTE DDSO(12)
+16 ;
+17 IF 'DIR0N
IF DDO
IF $GET(DDSFLD)]""
Begin DoDot:1
+18 IF $PIECE($GET(DDSO(0)),U,3)=2
NEW DDP
SET DDP=0
+19 SET DDSCHG=1
+20 IF DDSDA!'$DATA(DDSREP)
IF +$GET(DDSU("F"))'=1
SET $PIECE(@DDSREFT@("F"_DDP,DDSDA,DDSFLD,"F"),U)=1
+21 IF $GET(DDSO(13))'?."^"
XECUTE DDSO(13)
+22 IF $DATA(@DDSREFS@("PT",DDP,DDSFLD))
DO RPB^DDS7(DDP,DDSFLD,DDSPG)
+23 IF $DATA(@DDSREFS@("COMP",DDP,DDSFLD,DDSPG))
DO RPCF^DDSCOMP(DDSPG)
End DoDot:1
+24 ;
+25 IF $DATA(DDSBR)#2
DO BR^DDS2
IF $DATA(DDSBR)#2
QUIT
+26 IF $TEXT(@DDACT)]""
GOTO @DDACT
+27 IF 'DDO
IF X]""
GOTO ^DDS3
SET DDSO(0)=0
+28 ;
+29 IF "^U^D^R^L^"[(U_DDACT_U)
GOTO CURSOR
+30 IF $DATA(DDSU("M"))[0
GOTO NF
+31 IF DDSU("M")
GOTO ^DDS5
+32 DO EDIT^DDSWP
DO R^DDSR
+33 ;
NF IF 'DDO
IF DDSOSV
SET DDO=DDSOSV
QUIT
+1 ;
+2 IF DDO
IF $SELECT($DATA(DDSREP):DDSDA,1:1)
Begin DoDot:1
+3 IF '$DATA(DDSU("M"))
Begin DoDot:2
+4 IF $GET(@DDSREFS@("ASUB",DDSPG,DDSBK,DDO))]""
SET DDSSTACK="`"_^(DDO)
+5 IF '$TEST
IF $PIECE($GET(DDSO(7)),U,2)]""
SET DDSSTACK=$PIECE(DDSO(7),U,2)
End DoDot:2
+6 IF $GET(DDSO(10))'?."^"
XECUTE DDSO(10)
End DoDot:1
+7 ;
+8 IF $DATA(DDSSTACK)
DO ^DDSSTK
DO R^DDS3
KILL DDSU
+9 IF $DATA(DDSBR)#2
DO BR^DDS2
IF $DATA(DDSBR)#2
QUIT
+10 SET DDACT="N"
+11 ;
CURSOR NEW ACT,B,BLK,BLK0,FND,N,REP
+1 KILL DDSACT
+2 IF $DATA(DDSU("N"))[0
SET DDSU("N")=$GET(@DDSREFS@(DDSPG,DDSBK,DDO,"N"))
+3 SET FND=0
+4 IF $DATA(DDSREP)
IF DDO
DO MNAV^DDSM(.FND)
IF FND
QUIT
+5 ;
+6 SET B=U
SET (BLK,BLK0)=DDSBK
SET N=DDSU("N")
SET ACT=$SELECT(DDO&$GET(DDSDN):"N",1:DDACT)
+7 FOR
Begin DoDot:1
+8 SET DDO=$PIECE(N,U,$LENGTH($PIECE("U^D^R^L^N",ACT),U))
+9 IF 'DDO
SET (DDO,DDSBK)=0
SET FND=1
QUIT
+10 ;
+11 SET DDSBK=$PIECE(DDO,",",2)
SET DDO=+DDO
+12 IF DDSBK
Begin DoDot:2
+13 IF $PIECE($GET(@DDSREFS@(DDSPG,DDSBK)),U,4)
Begin DoDot:3
+14 SET DDO=$PIECE($GET(@DDSREFS@(DDSPG,DDSBK)),U,9)
SET ACT="N"
End DoDot:3
+15 IF '$TEST
SET ACT=DDACT
+16 IF '$PIECE($GET(@DDSREFT@(DDSPG,DDSBK)),U)
IF DDSDAORG
SET B=B_DDSBK_U
+17 IF '$TEST
IF $PIECE(@DDSREFS@(DDSPG,DDSBK),U,7)>1
SET REP=1
SET DDACT="NB"
SET DDSBR=""
End DoDot:2
IF $DATA(REP)
QUIT
+18 IF '$TEST
SET DDSBK=BLK
+19 ;
+20 IF B'[(U_DDSBK_U)
SET FND=1
IF DDSBK'=BLK0
SET DDACT="NB"
SET DDSBR=""
SET DDSACT=ACT
+21 ;
+22 IF 'FND
SET N=$GET(@DDSREFS@(DDSPG,DDSBK,+DDO,"N"))
SET BLK=DDSBK
End DoDot:1
IF FND!$DATA(REP)
QUIT
+23 QUIT
+24 ;
NP ;;
+1 IF $DATA(DDSREP)&DDO
GOTO PGDN^DDSM
+2 IF DDSNP]""
SET DDSPG=DDSNP
+3 IF DDSNP=""
SET DDACT="N"
+4 QUIT
PP ;;
+1 IF $DATA(DDSREP)&DDO
GOTO PGUP^DDSM
+2 SET DDSPG=$$PP^DDS5(.Y)
+3 SET DDACT=$SELECT(Y=1:"NP",1:"N")
+4 QUIT
NB ;;
+1 SET DDSBK=$$NB^DDS5(.Y)
SET DDACT=$SELECT(Y=1:"NB",1:"N")
+2 QUIT
SEL ;;
+1 IF $GET(DDSSEL)
WRITE $CHAR(7)
QUIT
+2 SET DDACT="N"
GOTO PG^DDSRSEL
SV ;;
+1 GOTO SV^DDS02
QT ;;
+1 GOTO QT^DDS3
EX ;;
+1 GOTO EX^DDS3
CL ;;
+1 GOTO CL^DDS3
RF ;;
+1 SET DDACT="N"
+2 GOTO R^DDSR
+3 ;
UNED(ATT,DEF,N) ;
+1 QUIT $SELECT(N="":1,$PIECE(ATT,U,4)="":$PIECE(DEF,U,4)=1,1:$PIECE(ATT,U,4)=1)&'$PIECE(N,U,11)