Thanks, Bjorn. There doesn't seem to be a need for the System Builder $INCLUDE or the call to SET.COMMON as long as the AM entries are changed to @AM. I'm curious, though, as to why you would write it to only run on cataloged programs. Like you said, it can be modified to suit our needs but I was just wondering.
BobW > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:owner-u2- > [EMAIL PROTECTED] On Behalf Of Bjorn Behr > Sent: Wednesday, February 23, 2005 12:22 AM > To: u2-users@listserver.u2ug.org > Subject: RE: [U2] Subroutine utility > > Here is one I wrote a whle back, when I needed it. > > It currently looks for any call statements and explodes them and displays > it > in a tree structure.. > Of course, to can be modified to suit your needs. > > Regards > Bjorn > > Program Start: > > PROGRAM GET.CALL > * ------------------------------------------------------------------- * > * AUTHOR : Bjorn Behr (BJB) * > * DATE : 14/05/03 * > * DESC : Program to display all Call Routines in the Requested * > * : Program * > * ------------------------------------------------------------------- * > * No Date Who Description * > * -- ---- --- ----------- * > * H00 14/05/03 BJB Original Code * > * =================================================================== * > PROMPT "" > $INCLUDE SBINCLUDE COMMON > CALL SET.COMMON > GOSUB Initialization > GOSUB GetCalls > GOSUB DisplayCalls > ExitOnError: > RETURN > * =================================================================== * > * SUBROUTINES - Start * > * ------------------------------------------------------------------- * > Initialization: > DIM RecordArray(250) > DIM OrigArray(250) > DIM RowNumber(250) > * Open Files > OPEN "MD" TO MD ELSE STOP 201,"MD" > OPEN "NOTES" TO SCalls ELSE STOP 201,"NOTES" > * Variables > ** Get Depth number > DepthNo = 250 > LOOP > CRT @(-1) > CRT @(10,12):"How far do you want to explode 'Calls' [1-250] : ": > INPUT DepthNo > IF (DepthNo = "") THEN DepthNo = 250 > UNTIL (DepthNo > 0) AND (DepthNo < 251) > REPEAT > ** Ask if you want to see DISP's or not > DispAns = "" > LOOP > CRT @(10,13):"Do you want to see DISP Calls [Y/N] : ": > INPUT DispAns, 1 > DispAns = UPCASE(DispAns) > UNTIL (DispAns = "Y") OR (DispAns = "N") > REPEAT > ** Ask if you want to see INPX or not > InpxAns = "" > LOOP > CRT @(10,14):"Do you want to see INPX Calls [Y/N] : ": > INPUT InpxAns, 1 > InpxAns = UPCASE(InpxAns) > UNTIL (InpxAns = "Y") OR (InpxAns = "N") > REPEAT > ** Ask if you want to see Comments or not > CommentAns = "" > LOOP > CRT @(10,15):"Do you want to see Comments [Y/N] : ": > INPUT CommentAns, 1 > CommentAns = UPCASE(CommentAns) > UNTIL (CommentAns = "Y") OR (CommentAns = "N") DO > REPEAT > * > ProgramArray = "" > CallArray = "" > Blink = " | " > FileArray = "" > ArrayCounter = 1 > RowCounter = "" > ProgramName = OCONV(@SENTENCE,"G1 1") > Extras = OCONV(@SENTENCE,"G2 1") > CallArray<-1> = "Call Statement Listing for > ":@(-13):ProgramName:@(-14) > ProgramArray<1,ArrayCounter> = ProgramName > SearchString = "CALL" > CRT @(-1) > CRT "Selecting Records!": > StringLength = LEN(SearchString) -1 > LineString = "" > LineLength = "" > RETURN > * ------------------------------------------------------------------- * > * Get Calls * > * ========= * > * 1. Read the Program from the program file * > * 2. Loop through Program looking for CALL * > * 3. Place Calls into an array * > * 4. Look for which file the program belongs in * > * ------------------------------------------------------------------- * > GetCalls: > * Look for File > ProgramName = ProgramArray<1,ArrayCounter> > READ MDRec FROM MD,ProgramName THEN > MDLine2 = MDRec<2> > Delims = DCOUNT(MDLine2,"\") > IF (Delims > 1) THEN > ObjTable = FIELD(MDLine2,"/",2) > END ELSE > ObjTable = FIELD(MDLine2,"/",3) > END > SrcTable = ObjTable[1,LEN(ObjTable)-2] > SrcTable = TRIM(SrcTable) > OPEN SrcTable TO File ELSE > CallArray<-1> = "!! NB !! - File ":SrcTable:" not found" > ArrayCounter += -1 > RETURN > END > END > FileArray<1,ArrayCounter> = SrcTable > * 1. Read File > READ Rec FROM File,ProgramName ELSE > CallArray<-1> = "!! NB !! :- ":ProgramName:" not a valid program > in > ":FileArray<1,ArrayCounter> > END > CRT @(0,2):@(-4):"Record Depth : ":ArrayCounter > IF (ArrayCounter = 250) THEN > Write CallArray ON MD,"BJORN.TEST" > END > RecordArray(ArrayCounter) = Rec > * 2. Loop through program looking for call > RowCounter<ArrayCounter> = DCOUNT(RecordArray(ArrayCounter),AM) > FOR RowNumber(ArrayCounter) = 1 TO RowCounter<ArrayCounter> > LineString = RecordArray(ArrayCounter)<RowNumber(ArrayCounter)> > LineLength = LEN(LineString) > CallFound = 0 > FOR CharCounter = 1 TO (LineLength - StringLength) UNTIL > (CallFound) > Pos1 = CharCounter > Pos2 = CharCounter + StringLength > CheckString = TRIM(LineString[Pos1,Pos2]) > IF CheckString = SearchString THEN > * 3. Display Calls > * ---->>> Original Code <<<---- > * SpaceCount = (ArrayCounter - 1) * 3 > * CallArray<-1> = SPACE(SpaceCount):RowNumber(ArrayCounter)"R%4":": > ":TRIM(LineString[1,LineLength]) > * Extract File Name And Check For DISP / INPX > CheckProgram = TRIM(LineString) > IF (TRIM(LineString[1,1]) # "*") THEN > CheckProgram = OCONV(CheckProgram,"G1 1") > END ELSE > CheckProgram = OCONV(CheckProgram,"G2 1") > END > CheckProgram = OCONV(CheckProgram,"G(1") > CheckProgram = OCONV(CheckProgram,"G;1") > SaveLine = "Y" > IF (CheckProgram = "DISP") AND (DispAns = "N") THEN > SaveLine = "N" > END > IF (SaveLine = "Y") THEN > IF (CheckProgram = "INPX") ANd (InpxAns = "N") THEN > SaveLine = "N" > END > END > IF (SaveLine = "Y") THEN > IF (LineString[1,1] = "*") AND (CommentAns = "N") THEN > SaveLine = "N" > END > END > IF (SaveLine = "Y") THEN > * ====>>> Modified Code <<<==== An attempt at lining up subrs > SpaceCount = (ArrayCounter - 1) > CallLine = STR(Blink, SpaceCount) > CallLine := RowNumber(ArrayCounter)"R%4":": " > CallLine := TRIM(LineString[1,LineLength]) > CallArray<-1> = CallLine > * ===<<< End of Modification >>>=== * > CallFound = 1 > * Check for comments > IF (LineString[1,1] # "*") THEN > NewProgram = TRIM(LineString) > NewProgram = OCONV(NewProgram,"G1 1") > NewProgram = OCONV(NewProgram,"G(1") > NewProgram = OCONV(NewProgram,"G;1") > ArrayCounter += 1 > ProgramArray<1,ArrayCounter> = NewProgram > OrigProgram = ProgramArray<1,ArrayCounter-1> > IF (NewProgram # OrigProgram) AND (ArrayCounter <= > DepthNo) THEN > GOSUB GetCalls > END ELSE > ArrayCounter += -1 > END > END > END > END > NEXT CharCounter > NextLoop: > Next RowNumber(ArrayCounter) > ArrayCounter += -1 > RETURN > * ------------------------------------------------------------------- * > * DisplayCalls * > * ============ * > * 1. Set Counters to 0 * > * 2. Display Calls with looping functionality * > * ------------------------------------------------------------------- * > DisplayCalls: > * 1. Set Counters > RowCounter1 = 1 > RowCounter2 = 0 > TryNumber = 0 > InputAns = "" > MaxCalls = DCOUNT(CallArray,AM) > LOOP > IF NOT(TryNumber) THEN > TryNumber = 1 > RowCounter1 = 1 > END ELSE > CRT @(0,23):"[F]orwards, [B]ack, [T]op, [E]nd, [P]rint, [Q]uit > : > ": > IF (Extras # "") THEN > DATA Extras > Extras = "" > END > INPUT InputAns, 1 > END > InputAns = UPCASE(InputAns) > UNTIL (InputAns = "Q") DO > BEGIN CASE > CASE InputAns = "F" > RowCounter1 += 20 > IF (RowCounter1 > MaxCalls) THEN > RowCounter1 = MaxCalls > END > CASE InputAns = "B" > RowCounter1 += -20 > IF (RowCounter1 < 1) THEN > RowCounter1 = 1 > END > CASE InputAns = "T" > RowCounter1 = 1 > CASE InputAns = "E" > RowCounter1 = MaxCalls > CASE InputAns = "P" > PRINTER ON > PRINT "Call Listing for ":ProgramArray<1,1>:" - Printed by > ":SB.USERCODE > FOR J_MaxCalls = 2 TO MaxCalls > PRINT CallArray<J_MaxCalls> > NEXT J_MaxCalls > PRINTER CLOSE > PRINTER OFF > CASE InputAns = "S" > WRITE CallArray ON SCalls,ProgramArray<1,1> > CASE 1 > END CASE > CRT @(-1) > * Setup RowCounter2 > RowCounter2 = RowCounter1 + 20 > IF (RowCounter2 > MaxCalls) THEN > RowCounter2 = MaxCalls > RowCounter1 = RowCounter2 - 20 > IF (RowCounter1 < 1) THEN RowCounter1 = 1 > END > * 2. Display Calls > FOR J_RowCounter = RowCounter1 TO RowCounter2 > CRT CallArray<J_RowCounter> > NEXT J_RowCounter > REPEAT > RETURN > * ------------------------- END OF PROGRAM --------------------------- * > END > > Program End: > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Horn, John > Sent: 23 February 2005 12:41 > To: U2 Mailing List (E-mail) > Cc: Roberts, Robert > Subject: [U2] Subroutine utility > > Have any of you every seen or heard of a utility that would take a Pick > program and identify what programs were called by that program and > continue > to transverse down those programs until all programs were identified? > > - John M. Horn > IT Technical Expert > HealthLink, Inc. > 314-989-6050 > [EMAIL PROTECTED] > ------- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ > ------- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/