TIUPS137 ; SLC/MAM - After installing TIU*1*137;6/26/03
;;1.0;Text Integration Utilities;**137**;Jun 20, 1997
; Run this after installing patch 137.
;Use option: TIU137 DDEFS & RULES, ANATPATH
; External References
; DBIA 10140 XREF^XQORM
; DBIA 4119 MAIN^USRPS23
BEGIN ; Create DDEFS
W !!,"This option creates Document Definitions, a User Class, and"
W !,"Business Rules for Laboratory Reports."
W ! K IOP S %ZIS="Q" D ^%ZIS I POP K POP Q
I $D(IO("Q")) K IO("Q") D Q
.S ZTRTN="MAIN^TIUPS137"
.S ZTDESC="Create DDefs, User Class, Rules for Laboratory Reports - TIU*1*137"
.D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued!",1:"Request Canceled!")
.K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
.D HOME^%ZIS
U IO D MAIN,^%ZISC
Q
;
MAIN ; Create DDEFS for Laboratory Reports
; -- Check for dups created after the install but before this option:
K ^XTMP("TIU137","DUPS"),^TMP("TIU137",$J)
D SETXTMP^TIUEN137
N TIUDUPS,TMPCNT,SILENT S TMPCNT=0
S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=""
S TMPCNT=1,^TMP("TIU137",$J,TMPCNT)=" ***** Document Definitions for LABORATORY REPORTS *****"
S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=""
S SILENT=1
D TIUDUPS^TIUEN137(.TIUDUPS,SILENT)
; -- If potential duplicates exist, quit:
I $G(TIUDUPS) D G MAINX
. S ^XTMP("TIU137","DUPS")=1
. S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)="Duplicate problem. See description for patch TIU*1*137,"
. S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)="in the National Patch Module."
; -- Set file data, other data for DDEFS:
D SETDATA^TIU137D
N NUM S NUM=0
F S NUM=$O(^XTMP("TIU137","BASICS",NUM)) Q:'NUM D
. N IEN,YDDEF,TIUDA
. ; -- If DDEF was previously created by this patch,
. ; say so and quit:
. S IEN=+$G(^XTMP("TIU137","BASICS",NUM,"DONE"))
. I IEN D Q
. . S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=^XTMP("TIU137","FILEDATA",NUM,.04)_" "_^XTMP("TIU137","BASICS",NUM,"NAME")
. . S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=" was already created in a previous install."
. . K ^XTMP("TIU137","FILEDATA",NUM)
. . K ^XTMP("TIU137","DATA",NUM)
. ; -- If not, create new DDEF:
. S YDDEF=$$CREATE(NUM)
. I +YDDEF'>0!($P(YDDEF,U,3)'=1) D Q
. . S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)="Couldn't create a "_^XTMP("TIU137","FILEDATA",NUM,.04)_" named "_^XTMP("TIU137","BASICS",NUM,"NAME")_".",TMPCNT=TMPCNT+1
. . S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=" Please contact National VistA Support for help."
. S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=^XTMP("TIU137","FILEDATA",NUM,.04)_" named "_^XTMP("TIU137","BASICS",NUM,"NAME")
. S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=" created successfully."
. S TIUDA=+YDDEF
. ; -- File field data:
. D FILE(NUM,TIUDA,.TMPCNT)
. K ^XTMP("TIU137","FILEDATA",NUM)
. ; -- Add item to parent:
. D ADDITEM(NUM,TIUDA,.TMPCNT)
. K ^XTMP("TIU137","DATA",NUM)
MAINX ;Exit
S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=""
S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=" *************"
I '$G(^XTMP("TIU137","DUPS")) D MAIN^USRPS23
D PRINT
K ^TMP("TIU137",$J),^TMP("USR23",$J)
Q
;
PRINT ; Print out results
N TIUCNT,TIUCONT
I $D(ZTQUEUED) S ZTREQ="@" ; Tell TaskMan to delete Task log entry
I $E(IOST)="C" W @IOF,!
S TIUCNT="",TIUCONT=1
F S TIUCNT=$O(^TMP("TIU137",$J,TIUCNT)) Q:TIUCNT="" D Q:'TIUCONT
. S TIUCONT=$$SETCONT Q:'TIUCONT
. W ^TMP("TIU137",$J,TIUCNT),!
Q:'TIUCONT
S TIUCNT=""
F S TIUCNT=$O(^TMP("USR23",$J,TIUCNT)) Q:TIUCNT="" D Q:'TIUCONT
. S TIUCONT=$$SETCONT Q:'TIUCONT
. W ^TMP("USR23",$J,TIUCNT),!
PRINTX Q
;
STOP() ;on screen paging check
; quits TIUCONT=1 if cont. ELSE quits TIUCONT=0
N DIR,Y,TIUCONT
S DIR(0)="E" D ^DIR
S TIUCONT=Y
I TIUCONT W @IOF,!
Q TIUCONT
;
SETCONT() ; D form feed, Set TIUCONT
N TIUCONT
S TIUCONT=1
I $E(IOST)="C" G SETX:$Y+5<IOSL
I $E(IOST)="C" S TIUCONT=$$STOP G SETX
G:$Y+8<IOSL SETX
W @IOF
SETX Q TIUCONT
;
SERIAL ; Serialize Menu Items of Class Clinical Documents
;since it has a new item under it
N DA,DIE,DR,X,Y,D,D0,DI,DQ
; -- Reset Sequence, Mnemonic for items of Clinical Docs:
N TIUI,TIUFPRIV
S (DA,TIUI)=0,DA(1)=38,TIUFPRIV=1
S DIE="^TIU(8925.1,DA(1),10,"
F S DA=$O(^TIU(8925.1,38,10,DA)) Q:+DA'>0 D
. S TIUI=TIUI+1,DR="2////^S X=TIUI;3////^S X=TIUI" D ^DIE
; -- Re-compile menu for Select CLINICAL DOCUMENTS Type(s),
; under Multiple Patient Documents/Integrated Document Management.
; Updates ^TIU(8925.1,38,99), which triggers ^XUTL update.
N XQORM,X,Y,ORULT
S XQORM="38;TIU(8925.1,"
D XREF^XQORM
Q
;
PARENT(NUM) ; Return IEN of parent new DDEF should be added to
N PIEN,PNUM
; Parent node has form:
; -- PIEN node = IEN of parent if known, or if not,
; PNUM node = DDEF# of parent
;^XTMP("TIU137","DATA",1,"PIEN")=38
S PIEN=$G(^XTMP("TIU137","DATA",NUM,"PIEN"))
; -- If parent IEN is known, we're done:
I +PIEN G PARENTX
; -- If not, get DDEF# of parent
S PNUM=$G(^XTMP("TIU137","DATA",NUM,"PNUM"))
I 'PNUM Q 0
; -- Get Parent IEN from "DONE" node, which was set
; when parent was created:
S PIEN=+$G(^XTMP("TIU137","BASICS",PNUM,"DONE"))
PARENTX Q PIEN
;
ADDITEM(NUM,TIUDA,TMPCNT) ; Add DDEF to Parent; Set item fields
N PIEN,MENUTXT,TIUFPRIV,TIUFISCR
N DIE,DR
S TIUFPRIV=1
S PIEN=$$PARENT(NUM)
I 'PIEN!'$D(^TIU(8925.1,PIEN,0))!'$D(^TIU(8925.1,TIUDA,0)) K PIEN G ADDX
N DA,DIC,DLAYGO,X,Y
N I,DIY
S DA(1)=PIEN
S DIC="^TIU(8925.1,"_DA(1)_",10,",DIC(0)="LX"
S DLAYGO=8925.14
;S X="`"_TIUDA
; -- If TIUDA is say, x, and Parent has x as IFN in Item subfile,
; code finds item x under parent instead of creating a new item,
; so don't use "`"_TIUDA:
S X=^XTMP("TIU137","BASICS",NUM,"NAME")
; -- Make sure the DDEF it adds is TIUDA and not another w same name:
S TIUFISCR=TIUDA ; activates screen on fld 10, Subfld .01 in DD
D ^DIC I Y'>0!($P(Y,U,3)'=1) K PIEN G ADDX
; -- Set Menu Text:
S MENUTXT=$G(^XTMP("TIU137","DATA",NUM,"MENUTXT"))
I $L(MENUTXT) D
. N DA,DIE,DR
. N D,D0,DI,DQ
. S DA(1)=PIEN
. S DA=+Y,DIE=DIC
. S DR="4////^S X=MENUTXT"
. D ^DIE
ADDX ; -- Tell user about adding to parent:
I '$G(PIEN) D
. S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=" Couldn't add entry to parent. Please contact National VistA Support"
. S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=" for help."
E S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=" Entry added to parent."
; -- If just added Class LR LABORATORY REPORTS to CLINICAL
; DOCUMENTS, serialize menu items of CLIN DOC:
I NUM=1 D SERIAL
Q
;
FILE(NUM,TIUDA,TMPCNT) ; File fields for new entry TIUDA
; Files ALL FIELDS set in "FILEDATA" nodes of ^XTMP:
; ^XTMP("TIU137","FILEDATA",NUM,Field#)
N TIUFPRIV,FDA,TIUERR
S TIUFPRIV=1
M FDA(8925.1,TIUDA_",")=^XTMP("TIU137","FILEDATA",NUM)
D FILE^DIE("TE","FDA","TIUERR")
I $D(TIUERR) S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=" Problem filing data for entry. Please contact National VistA Support."
E S TMPCNT=TMPCNT+1,^TMP("TIU137",$J,TMPCNT)=" Data for entry filed successfully."
Q
;
CREATE(NUM) ; Create new DDEF entry
N DIC,DLAYGO,DA,X,Y,TIUFPRIV
S TIUFPRIV=1
;S (DIC,DLAYGO)="^TIU(8925.1,"
;-- CACHE won't take global root for DLAYGO; use file number:
S DIC="^TIU(8925.1,",DLAYGO=8925.1
S DIC(0)="LX",X=^XTMP("TIU137","BASICS",NUM,"NAME")
S DIC("S")="I $P(^(0),U,4)="_""""_^XTMP("TIU137","BASICS",NUM,"INTTYPE")_""""
D ^DIC
; -- If DDEF was just created, set "DONE" node = IEN
I $P(Y,U,3)=1 S ^XTMP("TIU137","BASICS",NUM,"DONE")=+$G(Y)
Q $G(Y)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUPS137 7648 printed Dec 13, 2024@02:44:01 Page 2
TIUPS137 ; SLC/MAM - After installing TIU*1*137;6/26/03
+1 ;;1.0;Text Integration Utilities;**137**;Jun 20, 1997
+2 ; Run this after installing patch 137.
+3 ;Use option: TIU137 DDEFS & RULES, ANATPATH
+4 ; External References
+5 ; DBIA 10140 XREF^XQORM
+6 ; DBIA 4119 MAIN^USRPS23
BEGIN ; Create DDEFS
+1 WRITE !!,"This option creates Document Definitions, a User Class, and"
+2 WRITE !,"Business Rules for Laboratory Reports."
+3 WRITE !
KILL IOP
SET %ZIS="Q"
DO ^%ZIS
IF POP
KILL POP
QUIT
+4 IF $DATA(IO("Q"))
KILL IO("Q")
Begin DoDot:1
+5 SET ZTRTN="MAIN^TIUPS137"
+6 SET ZTDESC="Create DDefs, User Class, Rules for Laboratory Reports - TIU*1*137"
+7 DO ^%ZTLOAD
WRITE !,$SELECT($DATA(ZTSK):"Request Queued!",1:"Request Canceled!")
+8 KILL ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
+9 DO HOME^%ZIS
End DoDot:1
QUIT
+10 USE IO
DO MAIN
DO ^%ZISC
+11 QUIT
+12 ;
MAIN ; Create DDEFS for Laboratory Reports
+1 ; -- Check for dups created after the install but before this option:
+2 KILL ^XTMP("TIU137","DUPS"),^TMP("TIU137",$JOB)
+3 DO SETXTMP^TIUEN137
+4 NEW TIUDUPS,TMPCNT,SILENT
SET TMPCNT=0
+5 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=""
+6 SET TMPCNT=1
SET ^TMP("TIU137",$JOB,TMPCNT)=" ***** Document Definitions for LABORATORY REPORTS *****"
+7 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=""
+8 SET SILENT=1
+9 DO TIUDUPS^TIUEN137(.TIUDUPS,SILENT)
+10 ; -- If potential duplicates exist, quit:
+11 IF $GET(TIUDUPS)
Begin DoDot:1
+12 SET ^XTMP("TIU137","DUPS")=1
+13 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)="Duplicate problem. See description for patch TIU*1*137,"
+14 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)="in the National Patch Module."
End DoDot:1
GOTO MAINX
+15 ; -- Set file data, other data for DDEFS:
+16 DO SETDATA^TIU137D
+17 NEW NUM
SET NUM=0
+18 FOR
SET NUM=$ORDER(^XTMP("TIU137","BASICS",NUM))
if 'NUM
QUIT
Begin DoDot:1
+19 NEW IEN,YDDEF,TIUDA
+20 ; -- If DDEF was previously created by this patch,
+21 ; say so and quit:
+22 SET IEN=+$GET(^XTMP("TIU137","BASICS",NUM,"DONE"))
+23 IF IEN
Begin DoDot:2
+24 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=^XTMP("TIU137","FILEDATA",NUM,.04)_" "_^XTMP("TIU137","BASICS",NUM,"NAME")
+25 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=" was already created in a previous install."
+26 KILL ^XTMP("TIU137","FILEDATA",NUM)
+27 KILL ^XTMP("TIU137","DATA",NUM)
End DoDot:2
QUIT
+28 ; -- If not, create new DDEF:
+29 SET YDDEF=$$CREATE(NUM)
+30 IF +YDDEF'>0!($PIECE(YDDEF,U,3)'=1)
Begin DoDot:2
+31 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)="Couldn't create a "_^XTMP("TIU137","FILEDATA",NUM,.04)_" named "_^XTMP("TIU137","BASICS",NUM,"NAME")_"."
SET TMPCNT=TMPCNT+1
+32 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=" Please contact National VistA Support for help."
End DoDot:2
QUIT
+33 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=^XTMP("TIU137","FILEDATA",NUM,.04)_" named "_^XTMP("TIU137","BASICS",NUM,"NAME")
+34 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=" created successfully."
+35 SET TIUDA=+YDDEF
+36 ; -- File field data:
+37 DO FILE(NUM,TIUDA,.TMPCNT)
+38 KILL ^XTMP("TIU137","FILEDATA",NUM)
+39 ; -- Add item to parent:
+40 DO ADDITEM(NUM,TIUDA,.TMPCNT)
+41 KILL ^XTMP("TIU137","DATA",NUM)
End DoDot:1
MAINX ;Exit
+1 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=""
+2 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=" *************"
+3 IF '$GET(^XTMP("TIU137","DUPS"))
DO MAIN^USRPS23
+4 DO PRINT
+5 KILL ^TMP("TIU137",$JOB),^TMP("USR23",$JOB)
+6 QUIT
+7 ;
PRINT ; Print out results
+1 NEW TIUCNT,TIUCONT
+2 ; Tell TaskMan to delete Task log entry
IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+3 IF $EXTRACT(IOST)="C"
WRITE @IOF,!
+4 SET TIUCNT=""
SET TIUCONT=1
+5 FOR
SET TIUCNT=$ORDER(^TMP("TIU137",$JOB,TIUCNT))
if TIUCNT=""
QUIT
Begin DoDot:1
+6 SET TIUCONT=$$SETCONT
if 'TIUCONT
QUIT
+7 WRITE ^TMP("TIU137",$JOB,TIUCNT),!
End DoDot:1
if 'TIUCONT
QUIT
+8 if 'TIUCONT
QUIT
+9 SET TIUCNT=""
+10 FOR
SET TIUCNT=$ORDER(^TMP("USR23",$JOB,TIUCNT))
if TIUCNT=""
QUIT
Begin DoDot:1
+11 SET TIUCONT=$$SETCONT
if 'TIUCONT
QUIT
+12 WRITE ^TMP("USR23",$JOB,TIUCNT),!
End DoDot:1
if 'TIUCONT
QUIT
PRINTX QUIT
+1 ;
STOP() ;on screen paging check
+1 ; quits TIUCONT=1 if cont. ELSE quits TIUCONT=0
+2 NEW DIR,Y,TIUCONT
+3 SET DIR(0)="E"
DO ^DIR
+4 SET TIUCONT=Y
+5 IF TIUCONT
WRITE @IOF,!
+6 QUIT TIUCONT
+7 ;
SETCONT() ; D form feed, Set TIUCONT
+1 NEW TIUCONT
+2 SET TIUCONT=1
+3 IF $EXTRACT(IOST)="C"
if $Y+5<IOSL
GOTO SETX
+4 IF $EXTRACT(IOST)="C"
SET TIUCONT=$$STOP
GOTO SETX
+5 if $Y+8<IOSL
GOTO SETX
+6 WRITE @IOF
SETX QUIT TIUCONT
+1 ;
SERIAL ; Serialize Menu Items of Class Clinical Documents
+1 ;since it has a new item under it
+2 NEW DA,DIE,DR,X,Y,D,D0,DI,DQ
+3 ; -- Reset Sequence, Mnemonic for items of Clinical Docs:
+4 NEW TIUI,TIUFPRIV
+5 SET (DA,TIUI)=0
SET DA(1)=38
SET TIUFPRIV=1
+6 SET DIE="^TIU(8925.1,DA(1),10,"
+7 FOR
SET DA=$ORDER(^TIU(8925.1,38,10,DA))
if +DA'>0
QUIT
Begin DoDot:1
+8 SET TIUI=TIUI+1
SET DR="2////^S X=TIUI;3////^S X=TIUI"
DO ^DIE
End DoDot:1
+9 ; -- Re-compile menu for Select CLINICAL DOCUMENTS Type(s),
+10 ; under Multiple Patient Documents/Integrated Document Management.
+11 ; Updates ^TIU(8925.1,38,99), which triggers ^XUTL update.
+12 NEW XQORM,X,Y,ORULT
+13 SET XQORM="38;TIU(8925.1,"
+14 DO XREF^XQORM
+15 QUIT
+16 ;
PARENT(NUM) ; Return IEN of parent new DDEF should be added to
+1 NEW PIEN,PNUM
+2 ; Parent node has form:
+3 ; -- PIEN node = IEN of parent if known, or if not,
+4 ; PNUM node = DDEF# of parent
+5 ;^XTMP("TIU137","DATA",1,"PIEN")=38
+6 SET PIEN=$GET(^XTMP("TIU137","DATA",NUM,"PIEN"))
+7 ; -- If parent IEN is known, we're done:
+8 IF +PIEN
GOTO PARENTX
+9 ; -- If not, get DDEF# of parent
+10 SET PNUM=$GET(^XTMP("TIU137","DATA",NUM,"PNUM"))
+11 IF 'PNUM
QUIT 0
+12 ; -- Get Parent IEN from "DONE" node, which was set
+13 ; when parent was created:
+14 SET PIEN=+$GET(^XTMP("TIU137","BASICS",PNUM,"DONE"))
PARENTX QUIT PIEN
+1 ;
ADDITEM(NUM,TIUDA,TMPCNT) ; Add DDEF to Parent; Set item fields
+1 NEW PIEN,MENUTXT,TIUFPRIV,TIUFISCR
+2 NEW DIE,DR
+3 SET TIUFPRIV=1
+4 SET PIEN=$$PARENT(NUM)
+5 IF 'PIEN!'$DATA(^TIU(8925.1,PIEN,0))!'$DATA(^TIU(8925.1,TIUDA,0))
KILL PIEN
GOTO ADDX
+6 NEW DA,DIC,DLAYGO,X,Y
+7 NEW I,DIY
+8 SET DA(1)=PIEN
+9 SET DIC="^TIU(8925.1,"_DA(1)_",10,"
SET DIC(0)="LX"
+10 SET DLAYGO=8925.14
+11 ;S X="`"_TIUDA
+12 ; -- If TIUDA is say, x, and Parent has x as IFN in Item subfile,
+13 ; code finds item x under parent instead of creating a new item,
+14 ; so don't use "`"_TIUDA:
+15 SET X=^XTMP("TIU137","BASICS",NUM,"NAME")
+16 ; -- Make sure the DDEF it adds is TIUDA and not another w same name:
+17 ; activates screen on fld 10, Subfld .01 in DD
SET TIUFISCR=TIUDA
+18 DO ^DIC
IF Y'>0!($PIECE(Y,U,3)'=1)
KILL PIEN
GOTO ADDX
+19 ; -- Set Menu Text:
+20 SET MENUTXT=$GET(^XTMP("TIU137","DATA",NUM,"MENUTXT"))
+21 IF $LENGTH(MENUTXT)
Begin DoDot:1
+22 NEW DA,DIE,DR
+23 NEW D,D0,DI,DQ
+24 SET DA(1)=PIEN
+25 SET DA=+Y
SET DIE=DIC
+26 SET DR="4////^S X=MENUTXT"
+27 DO ^DIE
End DoDot:1
ADDX ; -- Tell user about adding to parent:
+1 IF '$GET(PIEN)
Begin DoDot:1
+2 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=" Couldn't add entry to parent. Please contact National VistA Support"
+3 SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=" for help."
End DoDot:1
+4 IF '$TEST
SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=" Entry added to parent."
+5 ; -- If just added Class LR LABORATORY REPORTS to CLINICAL
+6 ; DOCUMENTS, serialize menu items of CLIN DOC:
+7 IF NUM=1
DO SERIAL
+8 QUIT
+9 ;
FILE(NUM,TIUDA,TMPCNT) ; File fields for new entry TIUDA
+1 ; Files ALL FIELDS set in "FILEDATA" nodes of ^XTMP:
+2 ; ^XTMP("TIU137","FILEDATA",NUM,Field#)
+3 NEW TIUFPRIV,FDA,TIUERR
+4 SET TIUFPRIV=1
+5 MERGE FDA(8925.1,TIUDA_",")=^XTMP("TIU137","FILEDATA",NUM)
+6 DO FILE^DIE("TE","FDA","TIUERR")
+7 IF $DATA(TIUERR)
SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=" Problem filing data for entry. Please contact National VistA Support."
+8 IF '$TEST
SET TMPCNT=TMPCNT+1
SET ^TMP("TIU137",$JOB,TMPCNT)=" Data for entry filed successfully."
+9 QUIT
+10 ;
CREATE(NUM) ; Create new DDEF entry
+1 NEW DIC,DLAYGO,DA,X,Y,TIUFPRIV
+2 SET TIUFPRIV=1
+3 ;S (DIC,DLAYGO)="^TIU(8925.1,"
+4 ;-- CACHE won't take global root for DLAYGO; use file number:
+5 SET DIC="^TIU(8925.1,"
SET DLAYGO=8925.1
+6 SET DIC(0)="LX"
SET X=^XTMP("TIU137","BASICS",NUM,"NAME")
+7 SET DIC("S")="I $P(^(0),U,4)="_""""_^XTMP("TIU137","BASICS",NUM,"INTTYPE")_""""
+8 DO ^DIC
+9 ; -- If DDEF was just created, set "DONE" node = IEN
+10 IF $PIECE(Y,U,3)=1
SET ^XTMP("TIU137","BASICS",NUM,"DONE")=+$GET(Y)
+11 QUIT $GET(Y)