Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
what are the adv of initialising variables in working storag

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: what are the adv of initialising variables in working storag
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: 464

PostPosted: Thu Oct 06, 2005 10:07 am    Post subject: Re: what are the adv of initialising variables in working st
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    Post subject:
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: 464

PostPosted: Thu Oct 06, 2005 11:57 am    Post subject: Re: what are the adv of initialising variables in working st
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts LIBDEF not working in called proc packerm CLIST & REXX 0 Fri Sep 15, 2017 7:22 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts ISREDIT MACRO NOT WORKING! :cry: kirank889 TSO/ISPF 3 Thu Aug 03, 2017 5:46 pm
No new posts Restart=Step not working ALAK SAHA JCL & VSAM 6 Fri Jun 30, 2017 6:28 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm

Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us