Wat is the difference between NEXT and CONTINUE statement in
cobol,can any one explain with example.

Answers were Sorted based on User's Feedback



Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / ankur kar

the following code explains u clearly

If A>B

next sentence

end-if

display 1

display 2.

display 3.

it will display only 3. if a>b

if a>b

continue

end-if

display 1

display 2.

display 3.

it will display 1 2 3. if a>b. let me know if it is not
correct.

Is This Answer Correct ?    97 Yes 16 No

Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / satish k

Explanation for Next sentence:
sol:
code:
If A>B

next sentence

end-if

display 1

display 2.

display 3.

So, over here the output is no doubt 3 provided A>B id true.
well, but it works is, the next sentence will always search
for the next executable sentence in the flow.
Here, the next executable sentence was display 3.so, it
executes and gives output as 3.
Explanation for Continue:
code:
if a>b

continue

end-if

display 1

display 2.

display 3.
Here in Continue statement, it is just like 'do nothing'.
so, it will executes all the display statements.

Is This Answer Correct ?    37 Yes 3 No

Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / krishna kumar

NEXT SENTENCE gives control to the verb following the next
period(.) while CONTINUE gives the control to the next verb
after the END-IF.

Is This Answer Correct ?    37 Yes 3 No

Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / shubha

continue is no operation stmt, which transfers the control
to next stmt.

where as 'next sentence' transfers the control to next
sentence.

Is This Answer Correct ?    29 Yes 10 No

Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / girish kanswa

continue means it pass the control to the stmt when it find
explicit scope terminator(end-if,end-perform),and next
sentence means it pass d cntrl to d next sentence when it
finds implicit scope terminator(.)

Is This Answer Correct ?    22 Yes 4 No

Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / osachari

next sentence transfers the control to the sentence which
after the first period. where as continue transfers the
control to the statement after the first scope
terminator(end-if...).

Is This Answer Correct ?    6 Yes 0 No

Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / rajasekhar

.NEXT Sentence is used to skip the statements and the control will move after the period operator.
.CONTINUE is statement in which the control is move to after scope terminator.
Example:

ws section
01 A PIC 99 VALUE 2
O1 B PIC 99 VALUE 2
01 C PIC 99 VALUE 3
01 D PIC 99 VALUE 3
01 E PIC XXXXX VALUE HAI
01 F PIC XXXXX VALUE HELLO
01 G PIC X(3) VALUE HAI
01 H PIC X(5) VALUE HELLO
PROCEDURE DIVISION
IF A = B
IF C = D
NEXT SENTENCE
DISPLAY 'NOT EQUAL'
END-IF.
DISPLAY 'EQUAL'
END-IF.
IF E = G
IF F = H
CONTINUE
DISPLAY 'STRINGS ARE NOT EQUAL'
END-IF.
DISPLAY 'STRINGS ARE EQUAL'
END-IF.
STOP RUN.

OUTPUT:-
EQUAL
STRINGS ARE EQUAL.

Is This Answer Correct ?    8 Yes 3 No

Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / abhilash

Its simple

Both mean transfer of control.

Continue - Will transfer control to next statement after
explicit scope terminator.( end-if, end-perform etc.)

Get Next - Will transfer control to next statement after
Implicit scope terminator (. operator)

Is This Answer Correct ?    3 Yes 0 No

Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / vinutna koritala

continue will skip control to next executable instruction
after scope terminator. Next sentence will pass control to
next sentence after fullstop.Always prefer continue
statement.

Is This Answer Correct ?    16 Yes 15 No

Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example..

Answer / murali

Answer #9 would never compile in the first place. We cannot
have and END-IF. after an END-IF. without an IF statement.

The ANSI-85 specifically flags that NEXT SENTENCE within IF
ELSE END-IF Block.

In the example provided in #4

If A>B
next sentence
end-if
display 1
display 2.
display 3.

when A>B is true Display 3 will be executed and if not
display 1 display 2 display 3 will be executed. This means
that we want to display 1 and display 2 to be executed in
when A > B is false. In such cases it should be coded in the
else portion of the code. When display 1 and display 2
should be executed irrespective of the test condition, then
the next sentence needs to be replaced with continue.

Avoid coding a next sentence within if - else - end-if blocks.

Very simple.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More COBOL Interview Questions

COMP field occupy ?

2 Answers  


HOw can I get the negative sign while deduct high value from low value

0 Answers  


how to access vsam files in cobol and how to differentiate that this is ESDS file

1 Answers   EDS,


How do u debug a S0C7 abend? (aswered till we get the field which caused that) After knowing the field which caused that how do u know the record which caused that if it is in production env? (dumb) Ok let us assume that we got to know that 100th record caused that and I wanted to skip only 100th record from the file and process from 101th. How to do that in JCL using SORT? (tried with STOPAFT but ended up dumb when he said smthing else is ther)

3 Answers   IBM,


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

0 Answers   HCL,






What is the default value of DISP parameter?

3 Answers   IBM,


How can we know that cobol program is using report file or simple file....?

4 Answers  


What is amode(31)

0 Answers  


1.What is the default print format in cobol?

5 Answers   HSBC,


I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSDS file in reverse order? In both the cases we donot know the total number of records.

1 Answers   L&T,


What is the use of EVALUATE statement?

4 Answers   Tesco,


What is Control Break processing ?

1 Answers   iGate,


Categories