source: IHS-VA_UTILITIES-XB/XBRSRCH4.m@ 641

Last change on this file since 641 was 641, checked in by Sam Habiel, 15 years ago

Initial commit of XB, move away from sf.net.
Includes kids file and documentation.

File size: 2.3 KB
Line 
1XBRSRCH4 ; IHS/ADC/GTH - SEARCH XREFS FOR ROUTINES ; [ 02/07/97 3:02 PM ]
2 ;;4.0;XB;;Jul 20, 2009;Build 2
3 ;
4 ; Part of XBRSRCH
5 ;
6START ;
7 W !!,"This routine searches a file for XREFS that call routines.",!
8 S U="^",DIC="^DIC(",DIC(0)="AEMQ"
9 D ^DIC
10 I Y<0 D EOJ Q
11 S XBSXREF("FILE")=+Y
12 KILL ^UTILITY("XBRSRCH",$J)
13 S XBSXREF("MASTER")=""
14EN ;EP - ENTRY POINT FOR CALLING ROUTINES
15 S XBSXREF("LAST FILE")=""
16 D SBTRACE
17 D:$D(XBSXREF("MASTER")) LIST
18 D EOJ
19 Q
20 ;
21SBTRACE ; CHECK ALL SUB-FILES
22 KILL XBSXREFF
23 S XBSXREF("CNT")=1,XBSXREFF(XBSXREF("CNT"))=XBSXREF("FILE")
24 F XBSXREF("L")=0:0 S XBSXREF("LCTL")=$O(XBSXREFF("")) Q:XBSXREF("LCTL")="" S XBSXREF("FILE")=XBSXREFF(XBSXREF("LCTL")) D SBTRACE2 S XBSXREF("LCTL")=$O(XBSXREFF("")) D FILE KILL XBSXREFF(XBSXREF("LCTL"))
25 Q
26 ;
27SBTRACE2 ;
28 S XBSXREF("LCTL")=0
29 F XBSXREF("L")=0:0 S XBSXREF("LCTL")=$O(^DD(XBSXREF("FILE"),"SB",XBSXREF("LCTL"))) Q:XBSXREF("LCTL")="" S XBSXREF("CNT")=XBSXREF("CNT")+1,XBSXREFF(XBSXREF("CNT"))=XBSXREF("LCTL")
30 Q
31 ;
32FILE ; CHECK ONE FILE OR SUB-FILE
33 S XBSXREF("FIELD")=0
34 F XBSXREF("L")=0:0 S XBSXREF("FIELD")=$O(^DD(XBSXREF("FILE"),XBSXREF("FIELD"))) Q:XBSXREF("FIELD")'=+XBSXREF("FIELD") D FIELD
35 Q
36 ;
37FIELD ; CHECK FIELD'S XREFS
38 Q:'$D(^DD(XBSXREF("FILE"),XBSXREF("FIELD"),1))
39 S XBSXREF("XREF")=0
40 F XBSXREF("L")=0:0 S XBSXREF("XREF")=$O(^DD(XBSXREF("FILE"),XBSXREF("FIELD"),1,XBSXREF("XREF"))) Q:XBSXREF("XREF")'=+XBSXREF("XREF") D CHKXREF
41 Q
42 ;
43CHKXREF ; CHECK ONE XREF
44 S X=^DD(XBSXREF("FILE"),XBSXREF("FIELD"),1,XBSXREF("XREF"),1)
45 D CHKSK
46 S X=^DD(XBSXREF("FILE"),XBSXREF("FIELD"),1,XBSXREF("XREF"),2)
47 D CHKSK
48 Q
49 ;
50CHKSK ; CHECK XREF SET/KILL
51 Q:X'[U
52 S XBRSRCH("FOUND")=0,XBSXREF("COUNT")=$L(X,U)
53 F XBSXREF("I")=XBSXREF("COUNT"):-1:2 S Y=$P(X,U,XBSXREF("I")) D ^XBRSRCH1
54 D:XBRSRCH("FOUND") WRITE
55 Q
56 ;
57WRITE ;
58 I $D(XBRSRCH("NO DETAIL")) W "." Q
59 I XBSXREF("FILE")'=XBSXREF("LAST FILE") S XBSXREF("LAST FILE")=XBSXREF("FILE") W !
60 W !,XBSXREF("FILE"),",",XBSXREF("FIELD"),?20,$E(X,1,59)
61 F XBSXREF("L")=0:0 S X=$E(X,60,999) Q:X="" W !?20,$E(X,1,59)
62 Q
63 ;
64LIST ; LIST ROUTINE NAMES
65 Q:'$D(^UTILITY("XBRSRCH",$J))
66 W !!,"Sorted list of routines found:",!
67 S X=""
68 F XBSXREF("L")=0:0 S X=$O(^UTILITY("XBRSRCH",$J,X)) Q:X="" W !,"^",X
69 KILL ^UTILITY("XBRSRCH",$J)
70 W !
71 Q
72 ;
73EOJ ;
74 KILL DIC,X,X0,X1,X2,Y,YY
75 K:$D(XBSXREF("MASTER")) XBRSRCH
76 KILL XBSXREF,XBSXREFF
77 Q
78 ;
Note: See TracBrowser for help on using the repository browser.