TIUFLT ; SLC/MAM - Library; Template T (Items) Related: BUFITEMS(CONTENT,EINFO,LASTLIN), ITEMS(FILEDA) ;4/6/95 11:02
;;1.0;TEXT INTEGRATION UTILITIES;;Jun 20, 1997
;
BUFITEMS(CONTENT,EINFO,LASTLIN) ; Set items of Entry EINFO into
;Buffer array in proper order.
; Requires CONTENT = String containing some or all of: 80, H, C, A, D, T, W. See BUFENTRY^TIUFLLM2.
; Requires EINFO, where EINFO is either as set in NINFO^TIUFLLM or
;is = ^TMP("TIUFIDX,$J,LINENO).
; Requires LASTLIN=LM array line before item insertion point.
; Requires all of the entry's items to exist in the file: check before calling this module.
; Updates LASTLIN to last line set in buffer array, ie
;buffer array starts with line [received LASTLIN+1] and ends with
;line [returned LASTLIN].
N FILEDA,TIUFITEM,LINENO,TIUFI,IFILEDA,ITENDA,INFO,INODE0
S FILEDA=$P(EINFO,U,2)
I TIUFTMPL="C",TIUFCLPS S TIUFITEM(1)=TIUFCDA_U_TIUFCTDA
E D ITEMS(FILEDA)
K ^TMP("TIUFB",$J),^TMP("TIUFBIDX",$J)
S LINENO=LASTLIN
F TIUFI=1:1 Q:'$G(TIUFITEM(TIUFI)) D Q:$D(DTOUT)
. S IFILEDA=$P(TIUFITEM(TIUFI),U),ITENDA=$P(TIUFITEM(TIUFI),U,2) Q:'IFILEDA Q:'ITENDA
. S LINENO=LINENO+1 ;Needed by NINFO.
. D NINFO^TIUFLLM(LINENO,IFILEDA,.INFO,EINFO,ITENDA),PARSE^TIUFLLM(.INFO)
. D NODE0ARR^TIUFLF(IFILEDA,.INODE0,FILEDA) Q:$D(DTOUT)
. I INODE0="" S LINENO=LINENO-1 Q
. D BUFENTRY^TIUFLLM2(.INFO,.INODE0,CONTENT,FILEDA) I TIUFI>5 W "."
. Q
S LASTLIN=LINENO
Q
;
ITEMS(FILEDA) ; Sets items of FILEDA into array TIUFITEM in proper order.
; TIUFITEM(TIUFI)=Item's 8925.1 IFN^Item's IFN in Item multiple
; Requires FILEDA = Entry's 8925.1 IFN
N TIUFI,SEQ,TENDA,TENODE0,NAME
S (TIUFI,SEQ,TENDA)=0
F S SEQ=$O(^TIU(8925.1,FILEDA,10,"AC",SEQ)) Q:'SEQ D
. ; Set items having sequence into TIUFITEM in sequence order
. F S TENDA=$O(^TIU(8925.1,FILEDA,10,"AC",SEQ,TENDA)) Q:'TENDA D
. . S TENODE0=^TIU(8925.1,FILEDA,10,TENDA,0) Q:'TENODE0
. . S TIUFI=TIUFI+1,TIUFITEM(TIUFI)=+TENODE0_"^"_TENDA
S NAME=""
F S NAME=$O(^TIU(8925.1,FILEDA,10,"C",NAME)) Q:NAME="" D
. ; Set items with no sequence into TIUFITEM in alpha order by Display Name.
. S TENDA=0
. F S TENDA=$O(^TIU(8925.1,FILEDA,10,"C",NAME,TENDA)) Q:'TENDA D
. . S TENODE0=^TIU(8925.1,FILEDA,10,TENDA,0) Q:'TENODE0
. . Q:$P(TENODE0,U,3) ;If has sequence, already in TIUFITEM.
. . S TIUFI=TIUFI+1,TIUFITEM(TIUFI)=+TENODE0_"^"_TENDA
S TENDA=0
F S TENDA=$O(^TIU(8925.1,FILEDA,10,TENDA)) Q:'TENDA D
. ; Set items with no sequence, no display name into buffer in item order
. S TENODE0=^TIU(8925.1,FILEDA,10,TENDA,0) Q:'TENODE0
. Q:$P(TENODE0,U,3) ;If has sequence, already in TIUFITEM.
. Q:$P(TENODE0,U,4)'="" ;If has Display Name, already in TIUFITEM.
. S TIUFI=TIUFI+1,TIUFITEM(TIUFI)=+TENODE0_"^"_TENDA
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUFLT 2823 printed Oct 16, 2024@18:41:56 Page 2
TIUFLT ; SLC/MAM - Library; Template T (Items) Related: BUFITEMS(CONTENT,EINFO,LASTLIN), ITEMS(FILEDA) ;4/6/95 11:02
+1 ;;1.0;TEXT INTEGRATION UTILITIES;;Jun 20, 1997
+2 ;
BUFITEMS(CONTENT,EINFO,LASTLIN) ; Set items of Entry EINFO into
+1 ;Buffer array in proper order.
+2 ; Requires CONTENT = String containing some or all of: 80, H, C, A, D, T, W. See BUFENTRY^TIUFLLM2.
+3 ; Requires EINFO, where EINFO is either as set in NINFO^TIUFLLM or
+4 ;is = ^TMP("TIUFIDX,$J,LINENO).
+5 ; Requires LASTLIN=LM array line before item insertion point.
+6 ; Requires all of the entry's items to exist in the file: check before calling this module.
+7 ; Updates LASTLIN to last line set in buffer array, ie
+8 ;buffer array starts with line [received LASTLIN+1] and ends with
+9 ;line [returned LASTLIN].
+10 NEW FILEDA,TIUFITEM,LINENO,TIUFI,IFILEDA,ITENDA,INFO,INODE0
+11 SET FILEDA=$PIECE(EINFO,U,2)
+12 IF TIUFTMPL="C"
IF TIUFCLPS
SET TIUFITEM(1)=TIUFCDA_U_TIUFCTDA
+13 IF '$TEST
DO ITEMS(FILEDA)
+14 KILL ^TMP("TIUFB",$JOB),^TMP("TIUFBIDX",$JOB)
+15 SET LINENO=LASTLIN
+16 FOR TIUFI=1:1
if '$GET(TIUFITEM(TIUFI))
QUIT
Begin DoDot:1
+17 SET IFILEDA=$PIECE(TIUFITEM(TIUFI),U)
SET ITENDA=$PIECE(TIUFITEM(TIUFI),U,2)
if 'IFILEDA
QUIT
if 'ITENDA
QUIT
+18 ;Needed by NINFO.
SET LINENO=LINENO+1
+19 DO NINFO^TIUFLLM(LINENO,IFILEDA,.INFO,EINFO,ITENDA)
DO PARSE^TIUFLLM(.INFO)
+20 DO NODE0ARR^TIUFLF(IFILEDA,.INODE0,FILEDA)
if $DATA(DTOUT)
QUIT
+21 IF INODE0=""
SET LINENO=LINENO-1
QUIT
+22 DO BUFENTRY^TIUFLLM2(.INFO,.INODE0,CONTENT,FILEDA)
IF TIUFI>5
WRITE "."
+23 QUIT
End DoDot:1
if $DATA(DTOUT)
QUIT
+24 SET LASTLIN=LINENO
+25 QUIT
+26 ;
ITEMS(FILEDA) ; Sets items of FILEDA into array TIUFITEM in proper order.
+1 ; TIUFITEM(TIUFI)=Item's 8925.1 IFN^Item's IFN in Item multiple
+2 ; Requires FILEDA = Entry's 8925.1 IFN
+3 NEW TIUFI,SEQ,TENDA,TENODE0,NAME
+4 SET (TIUFI,SEQ,TENDA)=0
+5 FOR
SET SEQ=$ORDER(^TIU(8925.1,FILEDA,10,"AC",SEQ))
if 'SEQ
QUIT
Begin DoDot:1
+6 ; Set items having sequence into TIUFITEM in sequence order
+7 FOR
SET TENDA=$ORDER(^TIU(8925.1,FILEDA,10,"AC",SEQ,TENDA))
if 'TENDA
QUIT
Begin DoDot:2
+8 SET TENODE0=^TIU(8925.1,FILEDA,10,TENDA,0)
if 'TENODE0
QUIT
+9 SET TIUFI=TIUFI+1
SET TIUFITEM(TIUFI)=+TENODE0_"^"_TENDA
End DoDot:2
End DoDot:1
+10 SET NAME=""
+11 FOR
SET NAME=$ORDER(^TIU(8925.1,FILEDA,10,"C",NAME))
if NAME=""
QUIT
Begin DoDot:1
+12 ; Set items with no sequence into TIUFITEM in alpha order by Display Name.
+13 SET TENDA=0
+14 FOR
SET TENDA=$ORDER(^TIU(8925.1,FILEDA,10,"C",NAME,TENDA))
if 'TENDA
QUIT
Begin DoDot:2
+15 SET TENODE0=^TIU(8925.1,FILEDA,10,TENDA,0)
if 'TENODE0
QUIT
+16 ;If has sequence, already in TIUFITEM.
if $PIECE(TENODE0,U,3)
QUIT
+17 SET TIUFI=TIUFI+1
SET TIUFITEM(TIUFI)=+TENODE0_"^"_TENDA
End DoDot:2
End DoDot:1
+18 SET TENDA=0
+19 FOR
SET TENDA=$ORDER(^TIU(8925.1,FILEDA,10,TENDA))
if 'TENDA
QUIT
Begin DoDot:1
+20 ; Set items with no sequence, no display name into buffer in item order
+21 SET TENODE0=^TIU(8925.1,FILEDA,10,TENDA,0)
if 'TENODE0
QUIT
+22 ;If has sequence, already in TIUFITEM.
if $PIECE(TENODE0,U,3)
QUIT
+23 ;If has Display Name, already in TIUFITEM.
if $PIECE(TENODE0,U,4)'=""
QUIT
+24 SET TIUFI=TIUFI+1
SET TIUFITEM(TIUFI)=+TENODE0_"^"_TENDA
End DoDot:1
+25 QUIT
+26 ;