1 | DICL ;SEA/TOAD,SF/TKW-VA FileMan: Lookup: Lister ;12/14/98 13:55
|
---|
2 | ;;22.0;VA FileMan;;Mar 30, 1999
|
---|
3 | ;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
4 | ;
|
---|
5 | LIST(DIFILE,DIFIEN,DIFIELDS,DIFLAGS,DINUMBER,DIFROM,DIPART,DINDEX,DISCREEN,DIWRITE,DILIST,DIMSGA,DIC) ;
|
---|
6 | ; ENTRY POINT--return a list of entries from a file
|
---|
7 | ; (Note: DIC parameter only passed if called from ^DICQ)
|
---|
8 | ;
|
---|
9 | IN ; Entry point from LIST^DIC
|
---|
10 | I '$D(DIQUIET) N DIQUIET S DIQUIET=1
|
---|
11 | I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
|
---|
12 | N DICLERR S DICLERR=$G(DIERR) K DIERR
|
---|
13 | ;
|
---|
14 | INPUT ; Validate input parameters
|
---|
15 | N DIERN,DIPE,DIDENT
|
---|
16 | S DIFLAGS=$G(DIFLAGS)
|
---|
17 | I DIFLAGS["I",DIFLAGS'["Q" S DIFLAGS=DIFLAGS_"Q"
|
---|
18 | S DIFIELDS=$G(DIFIELDS)
|
---|
19 | I DIFIELDS'["-IX" D
|
---|
20 | . N DID S DID=";"_DIFIELDS_";"
|
---|
21 | . I (DID["@"!(DIFLAGS["I")),DID'[";IX;",DID'[";IXE",DID'[";IXIE" Q
|
---|
22 | . S DIDENT(-5)=1 Q
|
---|
23 | S DINUMBER=$G(DINUMBER) I DINUMBER="" S DINUMBER="*"
|
---|
24 | I '$D(DIPART(1)) S DIPART(1)=$G(DIPART)
|
---|
25 | I '$D(DIFROM(1)) S DIFROM(1)=$G(DIFROM)
|
---|
26 | I $O(DIFROM(1)) D
|
---|
27 | . N E S E=9999 F S E=$O(DIFROM(E),-1) Q:'E Q:DIFROM(E)]""
|
---|
28 | . I E N I F I=1:1:E I DIFROM(I)="" D BLD^DIALOG(202,"FROM values"),OUT Q
|
---|
29 | . Q
|
---|
30 | S DIFROM("IEN")=$G(DIFROM("IEN"))
|
---|
31 | S DINDEX("WAY")=1 I DIFLAGS["B" S DINDEX("WAY")=-1
|
---|
32 | S DINDEX=$G(DINDEX)
|
---|
33 | I '$D(DISCREEN("S")) S DISCREEN("S")=$G(DISCREEN)
|
---|
34 | S DIWRITE=$G(DIWRITE)
|
---|
35 | ;
|
---|
36 | OUTPUT ; Establish output file name, starting output subscript no.
|
---|
37 | I $G(DILIST)="" S DILIST="^TMP(""DILIST"",$J)"
|
---|
38 | E I DIFLAGS'["h" D I $G(DIERR) D OUT Q
|
---|
39 | . I DILIST'?.1"^"1U.7UN.ANP,DILIST'?.1"^%".7UN.ANP D Q
|
---|
40 | . . D BLD^DIALOG(202,"target array")
|
---|
41 | . S DILIST=$NA(@DILIST@("DILIST"))
|
---|
42 | . Q
|
---|
43 | K @DILIST
|
---|
44 | S DILIST("ORDER")=$S(DINDEX("WAY")=1:0,1:DINUMBER+1)
|
---|
45 | I DINUMBER="*",DINDEX("WAY")=-1 D
|
---|
46 | . S DINDEX("WAY")=1,DINDEX("WAY","REVERSE")=1
|
---|
47 | . S DILIST("ORDER")=0
|
---|
48 | . Q
|
---|
49 | ;
|
---|
50 | FILE ; Validate file number and IENS.
|
---|
51 | I DIFLAGS'["h" D FILE^DICUF(.DIFILE,.DIFIEN,DIFLAGS)
|
---|
52 | I $G(DIERR) S DIFROM="",DIFROM("IEN")="" D OUT Q
|
---|
53 | D SCREEN^DICUF(DIFLAGS,.DIFILE,.DISCREEN)
|
---|
54 | ;
|
---|
55 | IXNAME ; Set default index name if null.
|
---|
56 | I DINDEX'="#",DINDEX'?1U.UNP S DINDEX=$$DINDEX(DIFILE,DIFLAGS)
|
---|
57 | CHECKS ;
|
---|
58 | I $TR(DIFLAGS,"BIKMPQSUfhu")'="" S DIERN=301,DIPE(1)=DIFLAGS D ERROUT Q
|
---|
59 | S DIFLAGS=DIFLAGS_3
|
---|
60 | I DINUMBER'="*",DINUMBER<1!(DINUMBER\1'=DINUMBER) D Q
|
---|
61 | . S DIERN=202,DIPE(1)="Number" D ERROUT
|
---|
62 | ;
|
---|
63 | IXANDID ; Gather information about index and field data to be returned.
|
---|
64 | N DIOUT S DIOUT=0
|
---|
65 | D INDEX^DICUIX(.DIFILE,DIFLAGS,.DINDEX,.DIFROM,.DIPART,DINUMBER,.DISCREEN,DILIST,.DIOUT)
|
---|
66 | I DIOUT!($G(DIERR)) D KTMPIX^DICL1 Q
|
---|
67 | I $D(DISCREEN("V")) D VPDATA^DICUF(.DINDEX,.DISCREEN)
|
---|
68 | I $O(DIFROM(DINDEX("#")+1))!(DINDEX'="#"&($O(DIPART(DINDEX("#"))))) D BLD^DIALOG(202,"Index"),KTMPIX^DICL1 Q
|
---|
69 | D IDENTS^DICU1(DIFLAGS,.DIFILE,DIFIELDS,DIWRITE,.DIDENT,.DINDEX)
|
---|
70 | I $G(DIERR) D KTMPIX^DICL1 Q
|
---|
71 | ;
|
---|
72 | BRANCH ; Continue on to actual search.
|
---|
73 | G PREP^DICL1
|
---|
74 | ;
|
---|
75 | DINDEX(DIFILE,DIFLAGS) ; Set DINDEX to index name for KEY.
|
---|
76 | N I,X S X=""
|
---|
77 | I $G(DIFLAGS)["K" D
|
---|
78 | . S I=$O(^DD("KEY","AP",DIFILE,"P",0)) Q:'I
|
---|
79 | . S X=$P($G(^DD("IX",+$P($G(^DD("KEY",I,0)),U,4),0)),U,2) Q
|
---|
80 | Q:X?1U.UNP X
|
---|
81 | Q "B"
|
---|
82 | ;
|
---|
83 | ERROUT D BLD^DIALOG(DIERN,.DIPE,.DIPE),OUT Q
|
---|
84 | ;
|
---|
85 | OUT I DICLERR'=""!$G(DIERR) D
|
---|
86 | . S DIERR=$G(DIERR)+DICLERR_U_($P($G(DIERR),U,2)+$P(DICLERR,U,2))
|
---|
87 | I $G(DIMSGA)'="" D CALLOUT^DIEFU(DIMSGA)
|
---|
88 | Q
|
---|
89 | ;
|
---|
90 | ; Possible messages returned
|
---|
91 | ; 202 The input parameter that identifies the |1
|
---|
92 | ; 301 The passed flag(s) '|1|' are unknown or in
|
---|
93 | ;
|
---|