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
What is rmode(any) ?
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
What do you understand by psb and acb?
Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks
Name the divisions, which are available in a cobol program?
What is a scope terminator give example?
What are the different open modes available in cobol?
Explain how to differentiate call by context by comparing it to other calls?
Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
What is Pic 9v99 Indicates in COBOL?
What is amode(24)?
example for sub strings ? and refernce modifications whit output pls
What is cobol?
How do define dynamic array in cobol.