Get result of LIST COMPOUT from Natural code

Hi,

i have to check the quality of the Natural code before upload it, and among other things i have verify there are no unused variable, internal subroutines unused or commented code.

I’m trying to do this with Natural, reading code to check with USR1057N and processing code line to line. It’s very simple to detect commented code searching first characted ‘’ or with SCAN('/’), but it so more complicated to identify unused variables.

I’d like to use te result of LIST COMPOUT to find unused variables, but i don’t know how to call this from Natural code. I couldn’ find any SYSEXT utility or similar to do this.

Any idea how to do it?

I know there is a SYSEXT that recover the variables from a program, but identify if each one is used in the program could be more complicated when LIST COMPOUT offers it.

Our Natural version is 8.2.3.1

Thanks!

It is not pretty; but this should work.

Suppose you have a program, CHECKER, that is going to check PROG1 for “quality”.

After other processing,

STACK TOP COMMAND ‘LIST COMPOUT PROG1 WORKFILE’ /* assuming you want the output to go to work file 1
STOP

Suppose you want to check several programs:

between the STACK TOP and STOP above,

insert

STACK TOP DATA ‘last program processed’ /* see below
STACK TOP COMMAND ‘CHECKER’

In CHECKER, see if the last program processed is blank; if so it is first program of run. If not, start CHECKER with the next program after the one indicated.

If any problems with this approach please post what happens.