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 |
How to code fscode 10 in cobol program? Where yoy code in your pgm?give ans for the question.
Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?
what are the control characters used in reports
what is record label is empty or standard in file description of data division?
i made it to stage 3 of an interview process wednessday they will quiz my knowledge again face to face for an analyst role recruiter said it will be based on Business requirements system is cobol and good ideas what they might ask etc
How to retain the Duplicates in the one records?
consider two data items 77 W-A PIC 9(3)V99 VALUE 23.75 77 W-B PIC ZZ9V99 VLAUE 123.45 after the statement MOVE W-A TO W-B what will be W-B's value? a.123.75 b.b23.75 (where b indicates space) c.023.75 d.invalid move
I have a file it contain 10 records.i got abend at 8th record because of soc7.how do you know that perticular record got abend?
What are the different forms of EVALUATE statement?
What is the difference between SEARCH and SEARCH ALL?
01 WS-NAME PIC X(10) OCCURES 2. by this we can get ws-name 2 times. My qustion is how can we access the second name
what is the meaning of pic 9(09)v99-