MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

what are the advantages of initializing variables wit value

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
prasad_kdd
Beginner


Joined: 22 Aug 2005
Posts: 6
Topics: 4
Location: hyderabad

PostPosted: Wed Oct 05, 2005 10:49 pm    Post subject: what are the advantages of initializing variables wit value Reply with quote

hi,
i would like to know what are the advantages and disadvantages of setting variable values in the working storage section with 'value clause' and initializing them in the procedure division.

which one is more efficient and also could you please provide me any link which helps this topic.

Thanks,
prasad.P
_________________
prasad.Polisetti
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Wed Oct 05, 2005 11:03 pm    Post subject: Reply with quote

I don't think it will affect efficiency. If you don't initialize then also it will be set some default values, say low values.
Back to top
View user's profile Send private message Send e-mail
prasad_kdd
Beginner


Joined: 22 Aug 2005
Posts: 6
Topics: 4
Location: hyderabad

PostPosted: Wed Oct 05, 2005 11:59 pm    Post subject: Reply with quote

hi ,
thanks for the reply but i would like to know the advantages and disadvantages also .can u please provide me any link or tutorial that would help me out.
_________________
prasad.Polisetti
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Oct 06, 2005 3:06 am    Post subject: Reply with quote

Prasad,

I just consider that as a feature provided to the developer - to save his time in moving the values individually in the Procedure division - increasing the number of lines !!!.

As far as efficiency is considered, there will not be any difference b/w Value Clause and moving values, since anyway your program is going to do an internal move when it encounters the VALUE Clause.

Thanks,
Phantom
Back to top
View user's profile Send private message
prasad_kdd
Beginner


Joined: 22 Aug 2005
Posts: 6
Topics: 4
Location: hyderabad

PostPosted: Thu Oct 06, 2005 3:55 am    Post subject: Reply with quote

hi phantom,
thanx for the reply.But i would like to know that will there be any advantages in using the valus clause with cobol sub routines.And also i have seen in one book with program-id in the identification division we can give the 'initial' and 'common' option.could you pls explain me how this one will affect the performance of the progarm.

thanks
prasad.P
_________________
prasad.Polisetti
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Oct 06, 2005 4:44 am    Post subject: Reply with quote

prasad_kdd,

check this link which explains in detail about the PROGRAM ID

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR10/3.1.1?DT=20020920180651

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Oct 06, 2005 4:45 am    Post subject: Reply with quote

Prasad kdd,

I think you are referring to this:
Quote:

Setting a program to an initial state
Use the INITIAL attribute to specify that whenever a program is called, it is placed
in its initial state. If the program contains programs, these are also placed in their
initial states.
A program is in its initial state when the following has occurred:
v Data items having VALUE clauses are set to the specified value.
v Changed GO TO statements and PERFORM statements are set to their initial states.
v Non-EXTERNAL files are closed.


When you use VALUE Clause in these type of situations where the sub-program is set to its INITIAL state, the data items will be initialized to the specified value.

If a field does not have any VALUE clause then its contents are flushed and may have junk/low-values. So, the developer must take care to load proper values to these fields so that he doesn't end up in data Exception.

Kolusu, Do you think of any other case ?

Thanks,
Phantom
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Thu Oct 06, 2005 6:44 am    Post subject: Reply with quote

One initialize statement can do equivalent of 10 to 50 lines of codes.

I will say initializing makes life simple, both in developing and maintaining the code.

Also, I don't see any disadvantage.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group