Page 1 of 1

Finding un-initialized variable

PostPosted: Mon Jul 12, 2010 10:29 pm
by nm992
I have a requirement in which i need to find all the unitialized variables in a cobol code?Any idea on how to go about this

Re: Finding un-initialized variable

PostPosted: Mon Jul 12, 2010 10:43 pm
by Robert Sample
Your requirement is far from obvious. Do you mean:

Any variable WITHOUT a VALUE clause?
Any variable not listed (explicitly OR implicitly) in an INITIALIZE statement?
Both of the above?
Something else entirely?

Re: Finding un-initialized variable

PostPosted: Mon Jul 12, 2010 10:54 pm
by nm992
Both of the above.

Re: Finding un-initialized variable

PostPosted: Mon Jul 12, 2010 11:00 pm
by Robert Sample
The easiest and fastest way will be manual code inspection. Developing an automated tool could be done but probably won't be worth the effort. Some vendor packages include such analysis automatically -- you might check to see if your site has something that will do this already.

Re: Finding un-initialized variable

PostPosted: Tue Jul 13, 2010 10:15 am
by nm992
What are teh packages you are mentioning about?

Re: Finding un-initialized variable

PostPosted: Tue Jul 13, 2010 10:42 am
by NicC
Check your compiler listings - generally the compiler can give a cross reference of where a variable is declared and used - the enterprise cobol compiler even indicates which statements update a variable.