Variable Usage utility
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
|
By default, the Variable Usage utility identifies unused local variables in each routine. It can also identify the global variables, labels, and include files that are no longer referenced in each routine or the primary source file, as well as those used by one or more local (CALLed, not XCALLed) routines. The variable usage level compiler option designates which items are reported.
To use this utility, compile using the variable usage compiler option and optionally the variable usage level compiler option, as follows:
On Windows and Unix,
dbl -qvar_review[=file] -qreview_level=n sourcefile
On OpenVMs,
dibol /VAR_REVIEW[=file] /REVIEW_LEVEL=n sourcefile
Options
file
(optional) The name of the generated output file. The default filename is the name of the primary source file with a .unu extension.
n
The sum of one or more of the following bit flags:
0 = Unused local variables in each routine (default)
1 = Unused global and local variables in each routine
2 = Unused labels and local variables in each routine
4 = Unused include files and local variables in each routine
8 = Unused local variables defined in the primary source file only
sourcefile
The source file to report on.
Discussion
Valid values for n are 0 through 31. For example, using a value of 5 (1 + 4) reports on unused global and local variables and unused include files in each routine. A value of 11 (1+2+8) reports on unused labels and unused global and local variables defined in the primary source file only.
Sample output
VARIABLE USAGE REPORT FOR c:\dev\test.dbl ROUTINE ADDRECORD The following files are included in this routine, but are no longer referenced: testdata.def C:\dev\test.dbl Line: 23 testinfo.def C:\dev\test.dbl Line: 43 The following local variables are no longer referenced: IX C:\dev\test.dbl Line: 50 CUSTNO C:\dev\test.dbl Line: 63 ROUTINE UPDATERECORD LOCAL ROUTINE LBL The following local variables are referenced in this local routine: FF C:\dev\test.dbl Line: 348 GG C:\dev\test.dbl Line: 349 HH C:\dev\test.inc Line: 15 KK C:\dev\test.inc Line: 18 No referenced global variables found in this local routine ROUTINE DELETERECORD No un-referenced include files found. No un-referenced local variables found.