View previous topic :: View next topic
|
Author |
Message |
saurabh39 Warnings : 1 Active User
Joined: 11 Apr 2008 Posts: 144 Location: Jamshedpur
|
|
|
|
Hi,
If my program has lots of unused variable, does it affects my performance, if yes how & why?
Secondly, I have read we should not use GO TO statement. Now, I have too option, either I use a 88 Level variable or a GO TO statement. There are multiple place where I have to transfer control to other para, should I use a 88 Level variable everywhere or can I use Go To. Is there any marked difference in performance between the two.
Last, RMODE is used to place the load module, and data is used to place the working storage data below or above the line. does having different location for data and load module has some advantage over having data part embedded itself in load module.Basically, I want to know, why IBM decided to have two different module for load & data? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Unused variables make the module bigger.
There is nothing wrong with a GO TO when used appropriately. Many organizations have standards that prohibit the use of GO TO. Others have rules about wen it is acceptable. A few have no rules at all. . .
I'm not sure how you reached the point where your choices were an 88 or a GO TO. . . Not knowing what you have, it is difficult to say if there wouold be a difference in performance.
You need to do more research on your last paragraph. Why do you believe IBM decided to have 2 different modules for "load and data"? |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
As I understood (probably my terminology is wrong) :
The 'load' is shared among all running instances of the program meaning it resides only once in memory.
WS of course exists for each "user". |
|
Back to top |
|
|
saurabh39 Warnings : 1 Active User
Joined: 11 Apr 2008 Posts: 144 Location: Jamshedpur
|
|
|
|
Hi
@GuyC - That does make sense....i mean to avoid using same data for re entrant program, you just create different instance of data.
@Dick - In our module, one logic makes one paragraph, and generally, transferring control will mean to execute next para, so whatever leftover logic are there, just put a flag for it. Like
Perform Para-A
Perform Para-B
Para-A
Do I = 1 to N
Instructyion..1
Instruction...2
End-Do
If N> 10 Then
Go To Para-B
End If.
Instruction...3
Instruction...4
..Intsrtuction N
End-Para
Now what we would have done is,
Para-A
Do I = 1 to N
Instructyion..1
Instruction...2
End-Do
If N> 10 Then
Set Do-Not-Execute-Rest-Of-Logic To True
End If.
If Not Do-Not-Execute-Rest-Of-Logic
Instruction...3
Instruction...4
. .Intsrtuction N
End-If
End-Para
So in my 2 method, will there be any marked difference in performance.
Regards,
Tushar |
|
Back to top |
|
|
shaktiprasad
New User
Joined: 20 Aug 2006 Posts: 34 Location: chennai
|
|
|
|
Hi ,
As I understood your first method PARA-A will be executed and each time it will GO TO PARA-B as N>0 will be true. and in
PARA-B If N <= 10
it will perform:
Instruction...3
Instruction...4
..Intsrtuction N
End-Para .
And in your second method you are intializing one flag and according to the value in the flag you are excuting the rest of the instructions.
I think second method will be little bit more efficient than the first method as in the first one you are using the go to statement.But your readbilty will high for the first method than the second one.
Somebody can correct me if I am wrong.
Thanks
Shakti |
|
Back to top |
|
|
|