VWBFPFND ;WV/BFP/jBell Portland, OR display labels in routine(s) May 2016 ;;**LOCAL** ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see Q ; LL ;Find labels or strings ;*********************************************************** ;*For gtm environs * ;* After driving myself to Van Gogh level insanity trying * ;* to remember line labels in only MY routines, or using * ;* %RSE for string find and getting some several thousand * ;* routine names AND being in a non-connective locale * ;* (idyll fingers, etc, etc...) I finally did this routine * ;* that will only list the targeted item in the routine * ;* set. The immediate benefit: I still have 2 ears. * ;*********************************************************** ; Q ; X W !?5 F I=1:1:10 W !,$T(LL+I^VWBFPFND) W ! Q ; C R !,"String: ",MATCH:30 I '$L(MATCH) Q E W !?10,"Searching for ",$S(WHAT="L":"LABEL ",1:"STRING "),""""_MATCH_"""" G @WHERE ; A G @WHERE ; ASK N WHAT,WHERE,ANS,R,X,I,J D X A2 K %ZR S ANS="" W !!,"(L)abel only, (S)tring match in routine set?: " R WHAT:30 Q:'$L(WHAT) S WHAT=$E($$UP^XLFSTR(WHAT),1) S WHERE=$S(WHAT="L":"LAB",WHAT="S":"STR",WHAT="H":"HELP",1:"LAB") S ANS="C" S ANS=$E($$UP^XLFSTR(ANS),1) A3 D @ANS G A2 ; LAB D ^%RSEL Q:$D(%ZR)#11 ;No selection array D ^%ZIS U IO S R="" F S R=$O(%ZR(R)) Q:R="" D . S MATCH=$S('$L($G(MATCH)):"",1:MATCH) . F I=1:1 S X=$T(@R+I^@R) Q:X="" S LABEL=$P(X," ") I $L(LABEL) D .. I ANS="A",MATCH="" S %ZR(R,$O(%ZR(R," "),-1)+1)=X Q .. I ANS="C",X[MATCH S %ZR(R,$O(%ZR(R," "),-1)+1)=X Q .. I ANS="E",X=MATCH S %ZR(R,$O(%ZR(R," "),-1)+1)=X Q D WR,^%ZISC Q ; STR ;Strings in the code I '$L(MATCH) W !?4,"Dude! No info!" Q D ^%RSEL Q:$D(%ZR)#11 ;No selection array D ^%ZIS U IO S R="" F S R=$O(%ZR(R)) Q:R="" D . F I=1:1 S X=$T(@R+I^@R) Q:X="" D .. F J=1:1:$L(X,MATCH) I X[MATCH S %ZR(R,$O(%ZR(" "),-1)+1)="+"_I_" ->"_X D WR,^%ZISC Q ; WR ;Go through %ZR array and only print path/routine name ; target... W !,"Searching for ",MATCH S R="" F S R=$O(%ZR(R)) Q:R="" D:$O(%ZR(R,0)) . W !,%ZR(R)_R . S N=0 F S N=$O(%ZR(R,N)) Q:'+N W !?4,%ZR(R,N) Q ; ;fini