View previous topic :: View next topic |
Author |
Message |
pzmohanty Beginner
Joined: 20 May 2004 Posts: 97 Topics: 43 Location: hyderabad, India
|
Posted: Sat Aug 21, 2004 8:06 am Post subject: differnece in effeciency when COMPUTE or ADD is used |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Sat Aug 21, 2004 10:32 am Post subject: |
|
|
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 |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Sun Aug 22, 2004 3:03 am Post subject: |
|
|
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 |
|
|
programmer1 Beginner
Joined: 18 Feb 2004 Posts: 138 Topics: 14
|
Posted: Mon Aug 23, 2004 7:24 am Post subject: |
|
|
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 |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Mon Aug 23, 2004 11:27 am Post subject: |
|
|
Thanks programmer1. I got it now. I just got a bit confused.
Thanks, |
|
Back to top |
|
|
pzmohanty Beginner
Joined: 20 May 2004 Posts: 97 Topics: 43 Location: hyderabad, India
|
Posted: Mon Aug 23, 2004 10:32 pm Post subject: |
|
|
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 |
|
|
|
|