View previous topic :: View next topic
|
Author |
Message |
prasad_kdd
New User
Joined: 17 Aug 2005 Posts: 5
|
|
|
|
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 |
|
Back to top |
|
|
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 463
|
|
|
|
Hi Prasad,
Quote: |
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. |
I believe, there is no such adv aor disadvantage to specify value clause in Working storage instad of Procedure Division.
To reduce the complexity and redundacy we use value clause in Working storage with defining the variable.
Correct me If I m wrong.
Regards
Rupesh |
|
Back to top |
|
|
prasad_kdd
New User
Joined: 17 Aug 2005 Posts: 5
|
|
|
|
hi Rupesh,
thanks for the reply but i would also like to know does it affect the efficiency of program and also does this affect in the cobol subroutines.can u please provide me any manual or link that would help me.
Thanks,
prasad.P |
|
Back to top |
|
|
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 463
|
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Prasad,
Doing it in WS is infinitely more efficient. Because it is done at compile time no CPU is used EVER at exec time.
However, there are times when a field or fields must be reinitailized in a loop. In this case you must reinitialize them in the PD at the top of the loop for each exec of the loop. In this case, since the code is usually placed at the top of the loop, there's no good reason to do it in WS too.
As Rupesh suggested, look at the COBOL manuals at this site. Look in the manual index at the bottom of the TOC for "value" and "initialize". Sometimes the Pgmr's Guide has a discussion of pros and cons of various approaches. |
|
Back to top |
|
|
|