How to replace the GOTO statement in COBOL without changing
the structure of program. e.g. consider following code...
I.D.
E.D.
D.D.
P.D.
compute C = A + B.
GOTO para 100-display.
compute D = C - D.
GOTO 200-display.
some other logic......
........
GOTO 300-para.
......
......
GOTO 400-para.

Now I want to replacce all GOTO statements without
changing the structure and otput of program.

Answers were Sorted based on User's Feedback



How to replace the GOTO statement in COBOL without changing the structure of program. e.g. conside..

Answer / muttaiah

My Opinion is we won't be able to change GOTO with Perform
here. why because if we use perform instead of goto like
this..
compute C = A + B.
Perform para 100-display.
compute D = C - D.
Perform 200-display.

what will happen means once c value is calculated. It wil
execute 100-display para once it completes. It will
calcualte d value. which is not the case in goto. Once C
value is calculated the control is passed to 100-display
para. The control will never return and cal D value.
what say!!
Correct me if i'm wrong please

Is This Answer Correct ?    10 Yes 0 No

How to replace the GOTO statement in COBOL without changing the structure of program. e.g. conside..

Answer / nag(igate)

using evaluate statement

Is This Answer Correct ?    8 Yes 1 No

How to replace the GOTO statement in COBOL without changing the structure of program. e.g. conside..

Answer / suraj borge

Using evaluate statement
take the value of para in a variable then evaluate it for ex.
evaluate xyz
when 100 perform para-100
when 200 perform para-200
..
.
.
.
.
like that we can replace the goto statement .

Is This Answer Correct ?    8 Yes 2 No

How to replace the GOTO statement in COBOL without changing the structure of program. e.g. conside..

Answer / krishnan a

Instead of GOTO we can use PERFORM noneed to go EVALUATE
also
compute C = A + B.
PERFORM 100-display.
compute D = C - D.
PERFORM 200-display.
some other logic......
........
PERFORM 300-para.
......
......
PERFORM 400-para.

Is This Answer Correct ?    8 Yes 5 No

How to replace the GOTO statement in COBOL without changing the structure of program. e.g. conside..

Answer / vani

is there any exit statement for the goto para
if it's so,it can be replaced with perform statement

Is This Answer Correct ?    3 Yes 0 No

How to replace the GOTO statement in COBOL without changing the structure of program. e.g. conside..

Answer / ganesh

but if there is no any condition to check for in evaluate
statement. how can we replace it using evaluate.

won't it change the structure of program if we use evaluate
statement.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More COBOL Interview Questions

in cobol perform stmt whether it first checks the condition or not

9 Answers  


What is mean by maxcc

7 Answers   Syntel,


Differentiate COBOL and COBOL-II?

0 Answers  


How to increase the logical record length of existing PS file?

7 Answers  


Scenario: I have 3 Input Files.Read the first i/p file and depending on certain business logic, I want to read wither i/p file-2 or i/p file-3.Now, depending on certain business logic applied to the record read from either file-2 or file-3, I decide to write them to either output file-2 or output file-2. Question: How many job steps are necessary to implement a solution for the above.

2 Answers   TCS,






what is the difference between Normal vaiable and comp variable.

5 Answers   DELL,


INREC AND OUTREC? HOW TO SPLIT 5K RECORDS TO DIFFERENT FILES IN A FILE IN COBOL? RESTART IN COBOL-DB2? ISOLATION LEVELS?

0 Answers  


What guidelines should be followed to write a structured Cobol program?

1 Answers  


Define static linking and dynamic linking.

0 Answers  


how to create temporary data set in jcl? what is the use?

3 Answers   Cap Gemini, Temenos,


we can use set true for condition names.. similarly can we code set to false in cobol pgm? will it work?

1 Answers  


How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

0 Answers  


Categories