View previous topic :: View next topic
|
Author |
Message |
Siva Naga Krishna Kishore
New User
Joined: 22 Jan 2007 Posts: 1 Location: Chennai
|
|
|
|
Hi,
Could any one clarifies me the difference between "NEXT SENTENCE" and "CONTINUE" phrases in COBOL.
Thanks & Regards,
Kishore Kothamasu. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Continue continues with the next verb while next sentence skips to the next sentence, the next verb after a period. |
|
Back to top |
|
|
sachin_star3 Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 78 Location: pune
|
|
|
|
Siva Naga Krishna Kishore wrote: |
Hi,
Could any one clarifies me the difference between "NEXT SENTENCE" and "CONTINUE" phrases in COBOL.
Thanks & Regards,
Kishore Kothamasu. |
===============================
answer:
NEXT SENTENCE: THE SENTENCE IS COLLECTION OF STATEMENTS AND IS ALWAYS END WITH PERIODE (.)
SO NEXT SENTENCE MEANS THE CONTROL PASSES TO NEXT SENTENCE AFTER THE PERIODE.
CONTINUE:- TRANSFER THE CONTROL AFTER THE END SCOPE TERMINATOR, MEANS CONTINOUS THE EXCUTION NOT CHECK THE CONDITION.
CORRECT ME IF WRONGE
FROM -
SACHIN BORASE
PUNE |
|
Back to top |
|
|
muthukannan
New User
Joined: 03 Aug 2006 Posts: 42 Location: Chennai
|
|
|
|
Hi Kishore,
"NEXT SENTENCE" will seek for the "."...
It will execute from the next statement onwards. Say
Code: |
IF X <> 3
COMPUTE X = X+3
NEXT SENTENCE
END-IF
MOVE X TO Y.
MOVE 10 TO X
|
In the above code if X is not equal to 3 then
will be performed.
Code: |
IF X <> 3
COMPUTE X = X+3
CONTINUE
END-IF
MOVE X TO Y.
MOVE 10 TO X
|
In the above code if X is not equal to 3 then
will be performed.
Correct me if am wrong.
MK |
|
Back to top |
|
|
kaarthik6_mf
New User
Joined: 27 Feb 2006 Posts: 3
|
|
|
|
But u could have given same code as in example one and explained how continue works when given in that place .Two different codes makes things difficult to understand |
|
Back to top |
|
|
kaarthik6_mf
New User
Joined: 27 Feb 2006 Posts: 3
|
|
|
|
am really sorry it is the same code ur 100 % rite Mk sorry for the interruption |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
Hi all,
here is an example which will explain use of next sentence & continue
consider working-storage variable
01 WS-A PIC 9(02) VALUE 10.
01 WS-B PIC 9(02) VALUE 30.
Code: |
IF WS-A = 10
IF WS-B = 20
DISPLAY "WS-A : ", WS-A
ELSE
NEXT SENTENCE
END-IF
DISPLAY "RAGHAVENDRA"
END-IF. ------- Control passed
DISPLAy "SUCCESSFULL". |
On Executing above code, The Control will comes to NEXT SENTENCE because of Condition codes.
The NEXT SENTENCE will try to pass control to NEXT statement that is after period(ie after END-IF) so
Code: |
Output :
SUCCESSFULL |
------------------------------------------------------------------
Code: |
IF WS-A = 10
IF WS-B = 20
DISPLAY "WS-A : ", WS-A
ELSE
CONTINUE
END-IF ------- Control passed
DISPLAY "RAGHAVENDRA"
END-IF.
DISPLAy "SUCCESSFULL". |
On Executing above code, The Control will comes to NEXT SENTENCE because of Condition codes.
The CONTINUE will try to pass control to NEXT statement that is after SCOPE TERMINATOR (ie after END-IF) so
Code: |
Output :
RAGHVENDRA
SUCCESSFULL |
Hope you got |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Raghu,
Very well explained. But there is a typo in your post.
In the second example for CONTINUE
Quote: |
On Executing above code, The Control will comes to NEXT SENTENCE because of Condition codes |
It should actually be CONTINUE instead of NEXT SENTENCE. |
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
Aaru,
Thanks for correcting me |
|
Back to top |
|
|
suneelkanchimf
New User
Joined: 12 Sep 2005 Posts: 1
|
|
|
|
Nicely Explained.
Thanks a lot! |
|
Back to top |
|
|
|