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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is rmode(24)

676


which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad

1022


i have 10 names in an array and my name is one of them also array is not in sorted order i need to display my name using index how will i do this

996


Can you please let me know the centre name of INS certification in Kolkata.

1715


How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?

700






How can you get the ksds file records into your cobol program?

642


What is the difference between comp and comp-3?

694


How to traceback if I am getting SOC7 or SOC4 abend? List down the steps

771


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

1788


Write a program to explain size error.

671


Write the code to count the sum of n natural numbers.

697


What is Pic 9v99 Indicates in COBOL?

725


Why would you use find and get rather than to obtain?

683


How to remove the spaces at the end of each record in the output file of variable length, via cobol program?

672


Can we change the password using ALTER? anyone tried and changed?

1547