1 | FSCRPCTF ;SLC/STAFF-NOIS RPC Text Finder ;5/18/98 14:58
|
---|
2 | ;;1.1;NOIS;;Sep 06, 1998
|
---|
3 | ;
|
---|
4 | TEXT(IN,OUT) ; from FSCRPX (RPCTextFinder)
|
---|
5 | N CNT,FIELDS,LINE,METHOD,NUM,TEXT K TEXT
|
---|
6 | S METHOD=$G(^TMP("FSCRPC",$J,"INPUT",1)),FIELDS=$G(^(2))
|
---|
7 | Q:'$L(METHOD) Q:'$L(FIELDS)
|
---|
8 | S CNT=0,NUM=2 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) D
|
---|
9 | .I '$L(LINE) Q
|
---|
10 | .S CNT=CNT+1
|
---|
11 | .S TEXT(CNT)=$$UP^XLFSTR(LINE)
|
---|
12 | I '$O(TEXT(0)) Q
|
---|
13 | D
|
---|
14 | .I METHOD=1 D CURRENT(FIELDS,.TEXT) Q
|
---|
15 | .I +METHOD=2 D LAST(FIELDS,.TEXT,+$P(METHOD,";",2)) Q
|
---|
16 | K TEXT
|
---|
17 | Q
|
---|
18 | ;
|
---|
19 | CURRENT(FIELDS,TEXT) ;
|
---|
20 | N CALL,CNT
|
---|
21 | K ^TMP("FSC LIST",$J)
|
---|
22 | S CNT=0,CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D ROUTE(CALL,FIELDS,.TEXT,.CNT)
|
---|
23 | K ^TMP("FSC CURRENT LIST",$J)
|
---|
24 | M ^TMP("FSC CURRENT LIST",$J)=^TMP("FSC LIST",$J)
|
---|
25 | K ^TMP("FSC LIST",$J)
|
---|
26 | S CNT=0 F S CNT=$O(^TMP("FSC CURRENT LIST",$J,CNT)) Q:CNT<1 S ^TMP("FSCRPC",$J,"OUTPUT",CNT)=^(CNT)
|
---|
27 | Q
|
---|
28 | ;
|
---|
29 | LAST(FIELDS,TEXT,LAST) ;
|
---|
30 | N CALL,CNT,NUM
|
---|
31 | K ^TMP("FSC LIST",$J)
|
---|
32 | S NUM=0,CNT=0,CALL="A" F S CALL=$O(^FSCD("CALL",CALL),-1) Q:CALL="" S NUM=NUM+1 Q:NUM>LAST D ROUTE(CALL,FIELDS,.TEXT,.CNT)
|
---|
33 | K ^TMP("FSC CURRENT LIST",$J)
|
---|
34 | M ^TMP("FSC CURRENT LIST",$J)=^TMP("FSC LIST",$J)
|
---|
35 | K ^TMP("FSC LIST",$J)
|
---|
36 | S CNT=0 F S CNT=$O(^TMP("FSC CURRENT LIST",$J,CNT)) Q:CNT<1 S ^TMP("FSCRPC",$J,"OUTPUT",CNT)=^(CNT)
|
---|
37 | Q
|
---|
38 | ;
|
---|
39 | ROUTE(CALL,FIELDS,TEXT,CNT) ;
|
---|
40 | N IEN,OK
|
---|
41 | S OK=0
|
---|
42 | D
|
---|
43 | .S IEN=+$G(^FSCD("CALL USER","AUC",DUZ,CALL))
|
---|
44 | .I IEN D I OK Q
|
---|
45 | ..I $P(FIELDS,U,8) D PSHORT(IEN,.TEXT,.OK) I OK Q
|
---|
46 | ..I $P(FIELDS,U,9) D PLONG(IEN,.TEXT,.OK) I OK Q
|
---|
47 | ..I $P(FIELDS,U,7) D PNOTE(IEN,.TEXT,.OK) I OK Q
|
---|
48 | .I $P(FIELDS,U) D SUBJECT(CALL,.TEXT,.OK) I OK Q
|
---|
49 | .I $P(FIELDS,U,2) D KEYWORDS(CALL,.TEXT,.OK) I OK Q
|
---|
50 | .I $P(FIELDS,U,3) D PATCH(CALL,.TEXT,.OK) I OK Q
|
---|
51 | .I $P(FIELDS,U,4) D DESC(CALL,.TEXT,.OK) I OK Q
|
---|
52 | .I $P(FIELDS,U,5) D RES(CALL,.TEXT,.OK) I OK Q
|
---|
53 | .I $P(FIELDS,U,6) D NOTES(CALL,.TEXT,.OK) I OK Q
|
---|
54 | I 'OK Q
|
---|
55 | S CNT=CNT+1
|
---|
56 | S ^TMP("FSC LIST",$J,CNT)=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
|
---|
57 | S ^TMP("FSC LIST",$J,"C",CALL)=CNT
|
---|
58 | Q
|
---|
59 | ;
|
---|
60 | SUBJECT(CALL,TEXT,OK) ;
|
---|
61 | N NUM,SUBJECT
|
---|
62 | S SUBJECT=$G(^FSCD("CALL",CALL,1))
|
---|
63 | I '$L(SUBJECT) Q
|
---|
64 | S SUBJECT=$$UP^XLFSTR(SUBJECT)
|
---|
65 | S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I SUBJECT[TEXT(NUM) S OK=1 Q
|
---|
66 | Q
|
---|
67 | ;
|
---|
68 | KEYWORDS(CALL,TEXT,OK) ;
|
---|
69 | N KEYWORDS,NUM
|
---|
70 | S KEYWORDS=$G(^FSCD("CALL",CALL,1.5))
|
---|
71 | I '$L(KEYWORDS) Q
|
---|
72 | S KEYWORDS=$$UP^XLFSTR(KEYWORDS)
|
---|
73 | S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I KEYWORDS[TEXT(NUM) S OK=1 Q
|
---|
74 | Q
|
---|
75 | ;
|
---|
76 | PATCH(CALL,TEXT,OK) ;
|
---|
77 | N NUM,PATCH
|
---|
78 | S PATCH=$P($G(^FSCD("CALL",CALL,120)),U,14)
|
---|
79 | I '$L(PATCH) Q
|
---|
80 | S PATCH=$$UP^XLFSTR(PATCH)
|
---|
81 | S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I PATCH[TEXT(NUM) S OK=1 Q
|
---|
82 | Q
|
---|
83 | ;
|
---|
84 | DESC(CALL,TEXT,OK) ;
|
---|
85 | N LNUM,NUM,LINE
|
---|
86 | S LNUM=0 F S LNUM=$O(^FSCD("CALL",CALL,30,LNUM)) Q:LNUM<1 S LINE=$G(^(LNUM,0)) D Q:OK
|
---|
87 | .I '$L(LINE) Q
|
---|
88 | .S LINE=$$UP^XLFSTR(LINE)
|
---|
89 | .S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I LINE[TEXT(NUM) S OK=1 Q
|
---|
90 | S LNUM=0 F S LNUM=$O(^FSCD("CALL",CALL,30,LNUM)) Q:LNUM<1 S LINE=$G(^(LNUM,0)) D Q:OK
|
---|
91 | .I '$L(LINE) Q
|
---|
92 | .S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I LINE[TEXT(NUM) S OK=1 Q
|
---|
93 | Q
|
---|
94 | ;
|
---|
95 | RES(CALL,TEXT,OK) ;
|
---|
96 | N LNUM,NUM,LINE
|
---|
97 | S LNUM=0 F S LNUM=$O(^FSCD("CALL",CALL,80,LNUM)) Q:LNUM<1 S LINE=$G(^(LNUM,0)) D Q:OK
|
---|
98 | .I '$L(LINE) Q
|
---|
99 | .S LINE=$$UP^XLFSTR(LINE)
|
---|
100 | .S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I LINE[TEXT(NUM) S OK=1 Q
|
---|
101 | Q
|
---|
102 | ;
|
---|
103 | NOTES(CALL,TEXT,OK) ;
|
---|
104 | N LNUM,NUM,LINE
|
---|
105 | S LNUM=0 F S LNUM=$O(^FSCD("CALL",CALL,50,LNUM)) Q:LNUM<1 S LINE=$G(^(LNUM,0)) D Q:OK
|
---|
106 | .I '$L(LINE) Q
|
---|
107 | .S LINE=$$UP^XLFSTR(LINE)
|
---|
108 | .S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I LINE[TEXT(NUM) S OK=1 Q
|
---|
109 | Q
|
---|
110 | ;
|
---|
111 | PSHORT(IEN,TEXT,OK) ;
|
---|
112 | N NUM,PSHORT
|
---|
113 | S PSHORT=$P($G(^FSCD("CALL USER",IEN,0)),U,3)
|
---|
114 | I '$L(PSHORT) Q
|
---|
115 | S PSHORT=$$UP^XLFSTR(PSHORT)
|
---|
116 | S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I PSHORT[TEXT(NUM) S OK=1 Q
|
---|
117 | Q
|
---|
118 | ;
|
---|
119 | PLONG(IEN,TEXT,OK) ;
|
---|
120 | N NUM,PLONG
|
---|
121 | S PLONG=$G(^FSCD("CALL USR",IEN,1))
|
---|
122 | I '$L(PLONG) Q
|
---|
123 | S PLONG=$$UP^XLFSTR(PLONG)
|
---|
124 | S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I PLONG[TEXT(NUM) S OK=1 Q
|
---|
125 | Q
|
---|
126 | ;
|
---|
127 | PNOTE(IEN,TEXT,OK) ;
|
---|
128 | N LNUM,NUM,LINE
|
---|
129 | S LNUM=0 F S LNUM=$O(^FSCD("CALL USER",IEN,2,LNUM)) Q:LNUM<1 S LINE=$G(^(LNUM,0)) D Q:OK
|
---|
130 | .I '$L(LINE) Q
|
---|
131 | .S LINE=$$UP^XLFSTR(LINE)
|
---|
132 | .S NUM=0 F S NUM=$O(TEXT(NUM)) Q:NUM<1 I LINE[TEXT(NUM) S OK=1 Q
|
---|
133 | Q
|
---|