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 

differnece in effeciency when COMPUTE or ADD is used

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


Joined: 20 May 2004
Posts: 97
Topics: 43
Location: hyderabad, India

PostPosted: Sat Aug 21, 2004 8:06 am    Post subject: differnece in effeciency when COMPUTE or ADD is used Reply with quote

hi all ,

i had following queries :

1) Which one is best to use COMPUTE or ADD in COBOL program & Why.

2) What is the difference between FILLER & VALUE Clause when used in FD of FILE SECTION & when used in WORKING-STORAGE SECTION in Cobol Program.

Thanx in advance

P.R.Mohanty
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Sat Aug 21, 2004 10:32 am    Post subject: Reply with quote

pzmohanty,

Quote:

1) Which one is best to use COMPUTE or ADD in COBOL program & Why.


Both compute and ADD verbs generate identical Assembler instructions. You can check that compiling the pgm with LIST compiler option. COMPUTE allows more complex expressions than ADD verb.

Remember with COMPUTE verb when used with complex expressions, precision may be lost because of the use of intermediate work fields.

So it depends on the complexity of the expression. For a plain addition there is not much of a difference between the 2 verbs. Choose the verb which can be easily understood.
Quote:

2.)What is the difference between FILLER & VALUE Clause when used in FD of FILE SECTION & when used in WORKING-STORAGE SECTION in Cobol Program.


The filler value coded in FD section adds to the record length of the file defined above where the filler defined in the working storage section has no affect.

A value clause in the FD section is treated as comments whereas the value clause coded in the working storage is assigned the to the variable.

Hope this helps...

Cheers

kolusu

PS: Did the proposed solution for sorting the header and detail records work for you?
_________________
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: Sun Aug 22, 2004 3:03 am    Post subject: Reply with quote

Kolusu,

Code:

The filler value coded in FD section adds to the record length of the file defined above where the filler defined in the working storage section has no affect.


Does this mean that the FILLER coded in the working-storage does not occupy any memory ? This is the first time I'm hearing this.

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


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Mon Aug 23, 2004 7:24 am    Post subject: Reply with quote

Phantom,

Quote:

Does this mean that the FILLER coded in the working-storage does not occupy any memory ? This is the first time I'm hearing this.


The filler coded in working-storage section will not affect the length of the file. Whereas the one defined in the FD section for the file will increase the length of the file.
_________________
Regards,
Programmer
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: Mon Aug 23, 2004 11:27 am    Post subject: Reply with quote

Thanks programmer1. I got it now. I just got a bit confused.

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


Joined: 20 May 2004
Posts: 97
Topics: 43
Location: hyderabad, India

PostPosted: Mon Aug 23, 2004 10:32 pm    Post subject: Reply with quote

hi all,

Thanks a lot Kolusu.

ur answer did put the things in right perspective.

regarding ur proposed solution for SORT , that worked fine.

thanx ,
P.R.Mohanty
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
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