AURSRCH2 ; SEARCH INPUT TRANSFORM FOR ROUTINES [ 04/06/88 8:29 AM ]
; PREVIOUSLY NAMED AUSINP
;
W !!,"This routine searches a file for INPUT TRANSFORMS that call routines.",!
S U="^"
S DIC="^DIC(",DIC(0)="AEMQ" D ^DIC
I Y<0 D EOJ Q
S AUSINP("FILE")=+Y
K ^UTILITY("AURSRCH",$J)
S AUSINP("MASTER")=""
EN ; ENTRY POINT FOR CALLING ROUTINES
S AUSINP("LAST FILE")=""
D SBTRACE
D:$D(AUSINP("MASTER")) LIST
D EOJ
Q
SBTRACE ; CHECK ALL SUB-FILES
K AUSINPFL S AUSINP("CNT")=1,AUSINPFL(AUSINP("CNT"))=AUSINP("FILE")
F AUSINP("L")=0:0 S AUSINP("LCTL")=$O(AUSINPFL("")) Q:AUSINP("LCTL")="" S AUSINP("FILE")=AUSINPFL(AUSINP("LCTL")) D SBTRACE2 S AUSINP("LCTL")=$O(AUSINPFL("")) D FILE K AUSINPFL(AUSINP("LCTL"))
Q
SBTRACE2 ;
S AUSINP("LCTL")=0 F AUSINP("L")=0:0 S AUSINP("LCTL")=$O(^DD(AUSINP("FILE"),"SB",AUSINP("LCTL"))) Q:AUSINP("LCTL")="" S AUSINP("CNT")=AUSINP("CNT")+1,AUSINPFL(AUSINP("CNT"))=AUSINP("LCTL")
Q
;
FILE ; CHECK ONE FILE OR SUB-FILE
S AUSINP("FIELD")=0
F AUSINP("L")=0:0 S AUSINP("FIELD")=$O(^DD(AUSINP("FILE"),AUSINP("FIELD"))) Q:AUSINP("FIELD")'=+AUSINP("FIELD") D FIELD
Q
;
FIELD ; CHECK FIELD'S INPUT TRANSFORM
S X=$P(^(AUSINP("FIELD"),0),U,5,99)
Q:X'[U
S AURSRCH("FOUND")=0,AUSINP("COUNT")=$L(X,U)
F AUSINP("I")=AUSINP("COUNT"):-1:2 S Y=$P(X,U,AUSINP("I")) D ^AURSRCH1
D:AURSRCH("FOUND") WRITE
Q
;
WRITE ;
I $D(AURSRCH("NO DETAIL")) W "." Q
I AUSINP("FILE")'=AUSINP("LAST FILE") S AUSINP("LAST FILE")=AUSINP("FILE") W !
W !,AUSINP("FILE"),",",AUSINP("FIELD"),?20,$E(X,1,59)
F AUSINP("L")=0:0 S X=$E(X,60,999) Q:X="" W !,?20,$E(X,1,59)
Q
;
LIST ; LIST ROUTINE NAMES
Q:'$D(^UTILITY("AURSRCH",$J))
W !!,"Sorted list of routines found:",!
S X="" F AUSINP("L")=0:0 S X=$O(^UTILITY("AURSRCH",$J,X)) Q:X="" W !,"^",X
K ^UTILITY("AURSRCH",$J)
W !
Q
;
EOJ ;
K DIC
K X,X0,X1,X2,Y,YY
K:$D(AUSINP("MASTER")) AURSRCH
K AUSINP,AUSINPFL
Q
AURSRCH2 ; SEARCH INPUT TRANSFORM FOR ROUTINES [ 04/06/88 8:29 AM ]
+1 ; PREVIOUSLY NAMED AUSINP
+2 ;
+3 WRITE !!,"This routine searches a file for INPUT TRANSFORMS that call routines.",!
+4 SET U="^"
+5 SET DIC="^DIC("
SET DIC(0)="AEMQ"
DO ^DIC
+6 IF Y<0
DO EOJ
QUIT
+7 SET AUSINP("FILE")=+Y
+8 KILL ^UTILITY("AURSRCH",$JOB)
+9 SET AUSINP("MASTER")=""
EN ; ENTRY POINT FOR CALLING ROUTINES
+1 SET AUSINP("LAST FILE")=""
+2 DO SBTRACE
+3 IF $DATA(AUSINP("MASTER"))
DO LIST
+4 DO EOJ
+5 QUIT
SBTRACE ; CHECK ALL SUB-FILES
+1 KILL AUSINPFL
SET AUSINP("CNT")=1
SET AUSINPFL(AUSINP("CNT"))=AUSINP("FILE")
+2 FOR AUSINP("L")=0:0
SET AUSINP("LCTL")=$ORDER(AUSINPFL(""))
IF AUSINP("LCTL")=""
QUIT
SET AUSINP("FILE")=AUSINPFL(AUSINP("LCTL"))
DO SBTRACE2
SET AUSINP("LCTL")=$ORDER(AUSINPFL(""))
DO FILE
KILL AUSINPFL(AUSINP("LCTL"))
+3 QUIT
SBTRACE2 ;
+1 SET AUSINP("LCTL")=0
FOR AUSINP("L")=0:0
SET AUSINP("LCTL")=$ORDER(^DD(AUSINP("FILE"),"SB",AUSINP("LCTL")))
IF AUSINP("LCTL")=""
QUIT
SET AUSINP("CNT")=AUSINP("CNT")+1
SET AUSINPFL(AUSINP("CNT"))=AUSINP("LCTL")
+2 QUIT
+3 ;
FILE ; CHECK ONE FILE OR SUB-FILE
+1 SET AUSINP("FIELD")=0
+2 FOR AUSINP("L")=0:0
SET AUSINP("FIELD")=$ORDER(^DD(AUSINP("FILE"),AUSINP("FIELD")))
IF AUSINP("FIELD")'=+AUSINP("FIELD")
QUIT
DO FIELD
+3 QUIT
+4 ;
FIELD ; CHECK FIELD'S INPUT TRANSFORM
+1 SET X=$PIECE(^(AUSINP("FIELD"),0),U,5,99)
+2 IF X'[U
QUIT
+3 SET AURSRCH("FOUND")=0
SET AUSINP("COUNT")=$LENGTH(X,U)
+4 FOR AUSINP("I")=AUSINP("COUNT"):-1:2
SET Y=$PIECE(X,U,AUSINP("I"))
DO ^AURSRCH1
+5 IF AURSRCH("FOUND")
DO WRITE
+6 QUIT
+7 ;
WRITE ;
+1 IF $DATA(AURSRCH("NO DETAIL"))
WRITE "."
QUIT
+2 IF AUSINP("FILE")'=AUSINP("LAST FILE")
SET AUSINP("LAST FILE")=AUSINP("FILE")
WRITE !
+3 WRITE !,AUSINP("FILE"),",",AUSINP("FIELD"),?20,$EXTRACT(X,1,59)
+4 FOR AUSINP("L")=0:0
SET X=$EXTRACT(X,60,999)
IF X=""
QUIT
WRITE !,?20,$EXTRACT(X,1,59)
+5 QUIT
+6 ;
LIST ; LIST ROUTINE NAMES
+1 IF '$DATA(^UTILITY("AURSRCH",$JOB))
QUIT
+2 WRITE !!,"Sorted list of routines found:",!
+3 SET X=""
FOR AUSINP("L")=0:0
SET X=$ORDER(^UTILITY("AURSRCH",$JOB,X))
IF X=""
QUIT
WRITE !,"^",X
+4 KILL ^UTILITY("AURSRCH",$JOB)
+5 WRITE !
+6 QUIT
+7 ;
EOJ ;
+1 KILL DIC
+2 KILL X,X0,X1,X2,Y,YY
+3 IF $DATA(AUSINP("MASTER"))
KILL AURSRCH
+4 KILL AUSINP,AUSINPFL
+5 QUIT