There are two commands that address this need directly. The XREF and UNREF commands. The XREF displays a list of every BSU (a university buzzword short for Basic Syntactic Unit) and every place each is referenced in a program. The UNREF command lists out only those BSU's that are defined but not referenced. When I say every BSU, that includes all variables, files, and labels. Each BSU is identified as to what it is, whether a variable, a file, or a label.
As in all mvToolbox commands, these two commands are fully integrated. By that I mean all functionality is available from any prompt. In the case of the UNREF display, putting the cursor on a line or clicking on any line takes you to that line in the program.
For searching includes and called programs for additional references to a BSU, the LX or LU commands with the -I switch (for includes), -C switch (for called subroutines), or -D switch (for both calls and includes) can be used.
One nice feature of the LX command is that when searching subbroutine calls, it is a smart search. Say you are looking for all exact matches for a string in a root progam and all called subroutines. LX CUSTOMER.FILE -C If the search identifies the search string occurring in a subroutine calling sequence, it switches to searching for the new value when that subroutine is searched.
Example:
LX (locate all exact matches):: LX CUSTOMER.FILE -C
...
CALL POSTING.SUBROUTINE(CUSTOMER.FILE,ORDER.INFORMATION, 'P')
...
SUBROUTINE POSTING.SUBROUTINE(CM.FILE, OINFO, POST.FLAG)
While looking for CUSTOMER.FILE in the root program, when the POSTING.SUBROUTINE is searched, the search switches to look for its local name - CM.FILE.
The display will contain all exact matches to the desired string and any other variable names that the search string is mapped to.
Bro