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
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 |
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 |
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 |
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 |
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 |
can we use COPY statement in w-s section? how?
The order of precedence of arithmetic operators in an expression can be overridden with the use of (a) [] (b) () (c) {} (d) Any of the above
Name the sections present in data division.
When is inspect verb is used in cobol?
In which area will you utilize 88 level items in cobol?
Did anybody attend the walkin of TCS on 31st July in Gurgaon for any technology,If u have completed 3 round i.e till the HR round,have u received the Offer letter yet? Please let me know.Thanks.
Syntax for JCLLIB & JOBLIB???
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.
DATAONLY, MAPONLY functionality?
01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i need to get the miuns sign in the result?
Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?
Under which scenario you would go for a static call as opposed to dynamic call?