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

Query regarding unused variable,GO TO statement & Data s


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

Active User


Joined: 11 Apr 2008
Posts: 144
Location: Jamshedpur

PostPosted: Wed Dec 02, 2009 9:39 am
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Dec 02, 2009 9:47 am
Reply with quote

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

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Dec 02, 2009 2:29 pm
Reply with quote

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
View user's profile Send private message
saurabh39
Warnings : 1

Active User


Joined: 11 Apr 2008
Posts: 144
Location: Jamshedpur

PostPosted: Wed Dec 02, 2009 2:42 pm
Reply with quote

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

New User


Joined: 20 Aug 2006
Posts: 34
Location: chennai

PostPosted: Wed Dec 02, 2009 5:34 pm
Reply with quote

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
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 Store the data for fixed length COBOL Programming 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top