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

Identify the invalid dataname from the following: (A) savings-account (B) annual-allocation-for-overhead (C) samount250 (D) 12demand

4 Answers   TCS,


What divisions, sections and paragraphs are mandatory for a COBOL program?

8 Answers   Arigo Infotech,


How do u sort the table for Search ALL? Is it only using ASCENDING KEY IS statement in occurs clause? If the data is input in non ascending order, will the ASC KEY IS automatically sort the data? or will it throw compile time error?

1 Answers   CTS,


what is the difference between occurs and occurs depending on? i dont think so there is the difference in storage..then why we should use occurs depending on?

9 Answers   TCS, Tech Mahindra,


IF there 5 to 6 files in a JCL and there is some space abends, how can we identify which file has space abend and what can be done to get off that abend or rectify that abend.

2 Answers   ADNA, CSC,






Suppose a program has the following code. What will be the output? MAIN-PARA. DISPLAY 'MAIN-PARA' PERFORM SECTION-A. STOP RUN. SECTION-A. PARA-A1. DISPLAY 'SECTION A PARA A1'. PARA-A2. DISPLAY 'SECTION A PARA A2'.

4 Answers  


What are the different types of condition in cobol and write their forms.

0 Answers  


A paragraph PARA-X is to be executed when none of the data names A, B and C have value of 1. Which of the following will achieve this ? (a) IF A NOT = 1 OR B NOT = 1 OR C NOT = 1 PERFORM PARA-X (B) IF NOT A= 1 AND B= 1 AND C = 1 PERFORM PARA-X (C) IF A NOT =1 IF NOT B = 1 OR C= 1 PERFORM PARA-X (C) IF A NOT = 1 AND B NOT = 1 AND C NOT = 1 PERFORM PARA-X

3 Answers   TCS,


what is rediffine clause?in what situation it can use?give me real time example?

1 Answers   IBM,


what is level 66 means??

7 Answers  


What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?

0 Answers  


When we code these comp,comp1,comp-2,comp-3 and comp4 values. I know the differnece.I mean when we will prefer if it is new program.Explain in detail with memory examples. Thanks in advance.

1 Answers   CTS,


Categories