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
 
Query regarding unused variable,GO TO statement & Data s

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Query regarding unused variable,GO TO statement & Data s
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

Site Director


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

PostPosted: Wed Dec 02, 2009 9:47 am    Post subject:
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    Post subject:
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    Post subject: Reply to: Query regarding unused variable,GO TO statement &a
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    Post subject: Reply to: Query regarding unused variable,GO TO statement &a
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    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 Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm

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