Finding un-initialized variable



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Finding un-initialized variable

Postby nm992 » Mon Jul 12, 2010 10:29 pm

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
nm992
 
Posts: 43
Joined: Sun Jul 11, 2010 11:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Finding un-initialized variable

Postby Robert Sample » Mon Jul 12, 2010 10:43 pm

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?
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Finding un-initialized variable

Postby nm992 » Mon Jul 12, 2010 10:54 pm

Both of the above.
nm992
 
Posts: 43
Joined: Sun Jul 11, 2010 11:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Finding un-initialized variable

Postby Robert Sample » Mon Jul 12, 2010 11:00 pm

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Finding un-initialized variable

Postby nm992 » Tue Jul 13, 2010 10:15 am

What are teh packages you are mentioning about?
nm992
 
Posts: 43
Joined: Sun Jul 11, 2010 11:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Finding un-initialized variable

Postby NicC » Tue Jul 13, 2010 10:42 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post