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

How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?

0 Answers  


In an EVALUATE statement, can I give a complex condition on a when clause?

2 Answers  


if a dataset is already created with fixed length but after that i want to change fixed length to variable length then how is it possible

3 Answers   IBM,


1.Can we define condition-name conditions in FD entry.

11 Answers  


How do define dynamic array in cobol.

0 Answers  






what is the meaning of pic 9(09)v99-

4 Answers   HSBC,


Suppose i have a Cobol field of 10 byte. it contains a decimal sign.How to know where is the point location?

1 Answers  


i have two file, each file having : file1 is having 2 fields field1 field2 file2 is having 3 fields field1 field2 field3 my req is to make it one file like: field1 field2 field1 field2 field3 if anyone know please send me syntax, i tried this with DFSORT but could not succeed.

9 Answers   Syntel,


There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.

0 Answers  


in a indexed file what is procedure for read the records from 12 to 18. please give the code example

2 Answers   L&T,


What is different between variable length and fixed length?

2 Answers   TCS,


A cobol program to read a file , match it with other if. If match occurs then write it to an output file. If no match then no need to write it.Error log created by program to track any error.

1 Answers  


Categories