IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

what are the adv of initialising variables in working storag


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prasad_kdd

New User


Joined: 17 Aug 2005
Posts: 5

PostPosted: Thu Oct 06, 2005 9:35 am
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
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 463

PostPosted: Thu Oct 06, 2005 10:07 am
Reply with quote

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
View user's profile Send private message
prasad_kdd

New User


Joined: 17 Aug 2005
Posts: 5

PostPosted: Thu Oct 06, 2005 10:46 am
Reply with quote

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
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 463

PostPosted: Thu Oct 06, 2005 11:57 am
Reply with quote

HI Prasad,

Please check teh following link

http://ibmmainframes.com/manuals.php

Regards

Rupesh
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Oct 09, 2005 11:01 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts JCL with variables JCL & VSAM 1
No new posts ICETOOL with JOINKEY for Big record l... DFSORT/ICETOOL 12
No new posts JCL Variables JCL & VSAM 1
Search our Forums:

Back to Top