IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Difference bw NEXT SENTENCE and CONTINUE


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Siva Naga Krishna Kishore

New User


Joined: 22 Jan 2007
Posts: 1
Location: Chennai

PostPosted: Mon Jan 22, 2007 2:25 pm
Reply with quote

Hi,

Could any one clarifies me the difference between "NEXT SENTENCE" and "CONTINUE" phrases in COBOL.

Thanks & Regards,
Kishore Kothamasu.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jan 22, 2007 3:01 pm
Reply with quote

Continue continues with the next verb while next sentence skips to the next sentence, the next verb after a period.
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Mon Jan 22, 2007 4:00 pm
Reply with quote

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
View user's profile Send private message
muthukannan

New User


Joined: 03 Aug 2006
Posts: 42
Location: Chennai

PostPosted: Mon Jan 22, 2007 5:10 pm
Reply with quote

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
Code:
 MOVE 10 TO X
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
Code:
MOVE X TO Y
will be performed.

Correct me if am wrong.

MK icon_smile.gif
Back to top
View user's profile Send private message
kaarthik6_mf

New User


Joined: 27 Feb 2006
Posts: 3

PostPosted: Fri Sep 12, 2008 3:12 pm
Reply with quote

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
View user's profile Send private message
kaarthik6_mf

New User


Joined: 27 Feb 2006
Posts: 3

PostPosted: Fri Sep 12, 2008 3:14 pm
Reply with quote

am really sorry it is the same code ur 100 % rite Mk sorry for the interruption
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Fri Sep 12, 2008 3:18 pm
Reply with quote

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.


This May help you.

ibmmainframes.com/viewtopic.php?t=31198&highlight=next+sentence+continue
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Fri Sep 12, 2008 4:01 pm
Reply with quote

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
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Sep 12, 2008 4:18 pm
Reply with quote

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
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Fri Sep 12, 2008 4:52 pm
Reply with quote

Aaru,


Thanks for correcting me icon_razz.gif
Back to top
View user's profile Send private message
suneelkanchimf

New User


Joined: 12 Sep 2005
Posts: 1

PostPosted: Mon Sep 22, 2008 4:16 pm
Reply with quote

Nicely Explained.
Thanks a lot!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
No new posts Difference between CEE3250C and CEE3204S COBOL Programming 2
Search our Forums:

Back to Top