source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DICL1.m@ 846

Last change on this file since 846 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1DICL1 ;SEA/TOAD,SF/TKW-VA FileMan: Lookup: Lister, Part 2 ;10/15/98 14:19
2 ;;22.0;VA FileMan;;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5PREP ; set up subfile's DA array under DIEN, init how many found,
6 ; set max, and init array of last entries returned.
7 ;
8 N DIEN D DA^DILF(DIFIEN,.DIEN)
9 N DISUB,DIVAL,X,Y
10 S DIDENT(-1)=0
11 S DIDENT(-1,"MAX")=DINUMBER
12 S DIDENT(-1,"JUST LOOKING")=0
13 F DISUB=1:1:DINDEX("#")+1 S DIDENT(-1,"LAST",DISUB)=""
14 S (DIDENT(-1,"LAST"),DIDENT(-1,"LAST","IEN"))=""
15 ;
16PTR ; if 1st indexed field is a pointer or var.ptr., and we're not doing
17 ; a quick list, we build info for the
18 ; pointer chain(s) to the end file(s) and do the search.
19 ;
20 I "VP"[DINDEX(1,"TYPE"),DIFLAGS'["Q",'$D(DINDEX("ROOTCNG",1)) D
21 . D POINT^DICL10(.DIFILE,.DIFLAGS,.DINDEX,.DIDENT,.DIEN,DIFIEN,.DISCREEN,.DILIST)
22 . Q
23 ;
24GETLIST ; build the output list when first subscript not a ptr. or var.ptr.
25 ;
26 E D
27 . I $D(DINDEX("ROOTCNG",1)) D BLDTMP^DICLIX1(.DINDEX,.DISCREEN,DIFLAGS,.DIDENT)
28 . D WALK^DICLIX(DIFLAGS,.DINDEX,.DIDENT,.DIFILE,.DIEN,.DIFIEN,.DISCREEN,.DILIST,"","",.DIC)
29 ;
30DSPHLP ; If we're displaying entries for online ^DIC help, display the rest
31 ;
32 I DIFLAGS["h",$O(DICQ(0)) D
33 . K DTOUT,DUOUT S DICQ(0,"MAP")=DIDENT(-3)
34 . D DSP^DICQ1(.DINDEX,.DICQ,.DIC,.DIFILE)
35 . I $G(DTOUT)!($G(DUOUT)) S (DINDEX("DONE"),DIDONE)=1 Q
36 . S DIDENT(-1)=0
37 . Q
38 ;
39KTMPIX ; if we've built temporary indexes, we delete them:
40 D KILLB(.DIFILE)
41 N DISUB S DISUB=$O(DINDEX("ROOTCNG","")) I DISUB K @DINDEX(DISUB,"ROOT")
42 ;
43FINAL ; cleanup after search.
44 ;
45 I $G(DIERR) K @DILIST D OUT^DICL Q
46 ;
47 ; set the output list header node and map node, output FROM values
48 ; for last entries returned.
49 ;
50 I '$D(DIDENT(-1)) S DIDENT(-1)=0,DIDENT(-1,"MAX")=DINUMBER
51 N DIHEADER S DIHEADER=DIDENT(-1)_U_DIDENT(-1,"MAX")_U_+$G(DIDENT(-1,"MORE?"))
52 S @DILIST@(0)=DIHEADER_U_$S(DIFLAGS[2:"H",1:"")
53 I DIFLAGS["P",$G(DIDENT(-3))]"" S @DILIST@(0,"MAP")=DIDENT(-3)
54 E D SETMAP(.DIDENT,DILIST)
55 N I S I=0 F S I=$O(DIDENT(-1,"LAST",I)) Q:'I D
56 . K DIDENT(-1,"LAST",I,"I")
57 . Q:$G(DIDENT(-1,"MORE?"))
58 . I I=1 S (DIDENT(-1,"LAST"),DIDENT(-1,"LAST","IEN"))=""
59 . S DIDENT(-1,"LAST",I)=""
60 . Q
61 K DIFROM M DIFROM=DIDENT(-1,"LAST")
62 ;
63 ; Move arrays to output and QUIT.
64 D OUT^DICL
65 Q
66 ;
67KILLB(DIFILE) ; Kill temporary "B" index on current file DIFILE or pointed-to files.
68 N DIROOT I $D(DIFILE(DIFILE,"NO B")) S DIROOT=DIFILE(DIFILE,"NO B")_")" K @DIROOT
69 Q:'$O(DIFILE("STACK",0))
70 N I,J,K
71 F I=0:0 S I=$O(DIFILE("STACK",I)) Q:'I F J=0:0 S J=$O(DIFILE("STACK",I,J)) Q:'J F K=0:0 S K=$O(DIFILE("STACK",I,J,K)) Q:'K I $D(DIFILE(K,"NO B")) D
72 . S DIROOT=DIFILE(K,"NO B")_")"
73 . K @DIROOT Q
74 Q
75 ;
76SETMAP(DIDENT,DILIST) ; Set map node for unpacked format
77 N I,J,K,DIMAP,DITMP S (DIMAP,I)=""
78 F S I=$O(DIDENT(-3,I)) Q:I="" S DITMP="" D D SETM2
79 . I I S J="" F S J=$O(DIDENT(-3,I,J)) Q:J="" D
80 . . I J?1.N.1"I" D
81 . . . N K S K="FID("_I_")"_$P("I^",U,J["I")
82 . . . K:$D(DIDENT(-3,I,K)) DIDENT(-3,I,K) Q
83 . . S DITMP=DITMP_J_"^" Q
84 . Q:I'=0
85 . F J=0:0 S J=$O(DIDENT(-3,0,J)) Q:'J S K="" F D Q:K=""
86 . . S K=$O(DIDENT(-3,0,J,K)) S:K]"" DITMP=DITMP_K_"^" Q
87 Q:DIMAP="" S $E(DIMAP,$L(DIMAP))=""
88 S @DILIST@(0,"MAP")=DIMAP
89 Q
90 ;
91SETM2 N DILENGTH S DILENGTH=$L(DIMAP) Q:$E(DIMAP,DILENGTH-3,DILENGTH)="..."
92 I $L(DITMP)+($L(DIMAP))>252 S DIMAP=DIMAP_"..." Q
93 S DIMAP=DIMAP_DITMP Q
94 ;
95 ;
Note: See TracBrowser for help on using the repository browser.