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

Problem with NEXT SENTENCE


IBM Mainframe Forums -> ABENDS & Debugging
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Thilaga

New User


Joined: 29 Feb 2008
Posts: 5
Location: Chennai

PostPosted: Thu Mar 06, 2008 1:01 pm
Reply with quote

Hi,

i got an error message "IGYPS2059-E The "NEXT SENTENCE" phrase was invalid in this context. The phrase was discarded."

My code goes like:
IF IT-SUBLINE-1-3 = '999'
---
NEXT SENTENCE
ELSE
---
---
END-IF

So, i just got a doubt can we use NEXT SENTENCE with some other statements in the IF or ELSE part? or whether it should be the only statement in the block? Please help me..
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Mar 06, 2008 1:37 pm
Reply with quote

see this topic
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Mar 06, 2008 1:44 pm
Reply with quote

Hi,

Respecify and/or remove the indicated NEXT SENTENCE phrase in the indicated statement so that, if used at all, it is used only in the context of IF .
Back to top
View user's profile Send private message
Thilaga

New User


Joined: 29 Feb 2008
Posts: 5
Location: Chennai

PostPosted: Thu Mar 06, 2008 2:40 pm
Reply with quote

Hi Anuj,
"if used at all, it is used only in the context of IF ."

im not getting this point. here i used in the context of IF only right?

so, do u mean that NEXT SENTENCE should be the only statement in the IF or ELSE block?
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Thu Mar 06, 2008 4:26 pm
Reply with quote

[quote="Thilaga"]Hi,

i got an error message "IGYPS2059-E The "NEXT SENTENCE" phrase was invalid in this context. The phrase was discarded."

quote]

Can u copy and paste some more code after the End-if
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Mar 06, 2008 5:25 pm
Reply with quote

Code:

IF IT-SUBLINE-1-3 = '999'
---                                      <<<<<<<what is this?
NEXT SENTENCE
ELSE
---
---
END-IF



if you have code between the if and the next sentence, that is your problem. remove the next sentence.

next sentence and continue should be the only code within an execution block.
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Thu Mar 06, 2008 6:28 pm
Reply with quote

IF IT-SUBLINE-1-3 = '999'
Quote:
--- <<<<<<<what is this?
NEXT SENTENCE
ELSE
---
---
END-IF


Just a guess, are you executing a calculation statement between IF and ELSE . Something like:
A = b*c

In such case, the Verb COMPUTE is missing.


Check if any cobol VERB is missing before NEXT SENTENCE and after IF.

Thanks,
Ajay
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Mar 07, 2008 5:40 am
Reply with quote

Thilaga wrote:
i m not getting this point. here i used in the context of IF only right?

so, do u mean that NEXT SENTENCE should be the only statement in the IF or ELSE block?
Hi Thilaga,

Dick has already answered Your concern..
Quote:
if you have code between the if and the next sentence, that is your problem. remove the next sentence.
Thanks Dick.. icon_smile.gif
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 -> ABENDS & Debugging

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Need to add field to copybook, proble... COBOL Programming 14
Search our Forums:

Back to Top