Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Error in evaluate statement with Next sentence

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sbalajibe

New User


Joined: 15 Aug 2005
Posts: 62

PostPosted: Tue Feb 14, 2006 2:43 pm    Post subject: Error in evaluate statement with Next sentence
Reply with quote

Hi All,


can u please help me out ... i am getting error in the following evaluate statement on NEXT SENTENCE ..

EVALUATE TRUE

WHEN SQLCODE = 00

NEXT SENTENCE

WHEN OTHER

<do error routine?>

END-EVALAUTE.



thanks in advance
Balaji
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Tue Feb 14, 2006 2:48 pm    Post subject:
Reply with quote

It would be helpfull if you can give us the exact error message. Thanks. :-)

O.
Back to top
View user's profile Send private message
sbalajibe

New User


Joined: 15 Aug 2005
Posts: 62

PostPosted: Tue Feb 14, 2006 2:49 pm    Post subject:
Reply with quote

Hi Ofer71 ,
i am getting error like

?The "NEXT SENTENCE" phrase was invalid in this context


thanks
Balaji
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Tue Feb 14, 2006 4:14 pm    Post subject:
Reply with quote

As far as I know (and I'm not a COBOL expert) - The NEXT SENTENCE clause is part of the SEARCH and IF statements only.

O.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Feb 14, 2006 10:30 pm    Post subject: Re: Next sentence....
Reply with quote

Code "CONTINUE" in place of "NEXT SENTENCE"... that will solve your problem...

Regards,

Priyesh.
Back to top
View user's profile Send private message
lordholnapult
Currently Banned

New User


Joined: 01 Feb 2006
Posts: 5
Location: Italy

PostPosted: Sun Feb 19, 2006 7:04 am    Post subject:
Reply with quote

I think NEXT SENTENCE was a cobol '86 code version of the CONTINUE code command, created in COBOL 2.
or am I Wrong ?

icon_wink.gif
Back to top
View user's profile Send private message
cevelavl

New User


Joined: 20 Feb 2006
Posts: 4

PostPosted: Mon Feb 20, 2006 4:36 pm    Post subject: Re: Next sentence....
Reply with quote

1) Clause NEXT SENTENCE is valid only in IF and SEARCH statements.
2) Non-conditional statement CONTINUE from ANSI Cobol 85 is possible everywhere.
3) So it can be in EVALUATE statement and in other conditional statements inclusive IF and SEARCH too.
Back to top
View user's profile Send private message
DARAPRADEEP

New User


Joined: 13 Apr 2005
Posts: 7

PostPosted: Tue Feb 21, 2006 10:05 am    Post subject: Re: Error in evaluate statement with Next sentence
Reply with quote

hi,
you can code like this

EVALUATE TRUE

WHEN SQLCODE not = 00

<do error routine?>
WHEN OTHER

CONTINUE

END-EVALUATE.

I think if the condetions are one or two use IF is better.

thanks,
pradeep.
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Tue Feb 21, 2006 11:36 am    Post subject:
Reply with quote

Hi frnds,

Let me add this point to your discussion.

CONTINUE is a replacement of NEXT SENTENCE in COBOL-II. As older one NEXT SENTENCE doesn?t understands key worlds like END-IF, END-SEARCH, END-STRING, etc which are used to terminate a sentence. In Cobol-I only way to terminate a sentence was '.' .

Now coming to why EVALUATE doesn?t supports NEXT SENTENCE? Reason is -- the EVALUATE statement was introduced with COBOL-II.

Using NEXT SENTENCE in place of CONTINUE can be dangerous if you are using COBOL-II.

I have not tried explaining everything...but I hope it will help you guys.

Correction's always welcome.
Back to top
View user's profile Send private message
small_world

New User


Joined: 22 Jul 2005
Posts: 24
Location: pune

PostPosted: Tue Feb 21, 2006 12:36 pm    Post subject:
Reply with quote

COBOL II introduced the CONTINUE verb, which means "do nothing."
But wait a minute -- isn't that what NEXT SENTENCE means?

No, not quite. NEXT SENTENCE is actually an unconditional branch to whatever follows the next period. In effect, it is a restricted form of GO TO.

Consider the following fragment:

[ warning: bad code ahead ]

IF NOT INPUT-EOF
IF INPUT-REC-TYPE = '55'
PERFORM 2100-PROCESS-WTN
ELSE
NEXT SENTENCE
END-IF
ADD +1 TO INPUT-COUNT.


Quick, now: when INPUT-REC-TYPE is '00', what happens to INPUT-COUNT? Answer: nothing. NEXT SENTENCE branches around the ADD statement.
If you're used to thinking of NEXT SENTENCE as "do nothing," this result may come as a surprise. Before COBOL II, we not only didn't have CONTINUE, we also didn't have END-IF, or any of its kindred. The kind of situation shown above didn't arise.

With COBOL II and its successors, however, these situations can arise. Our old reflexes are no longer reliable.

Conclusions
Do not code NEXT SENTENCE. Ever.
If you really mean "do nothing," code CONTINUE.

If you really mean "branch to the next sentence," code a GO TO, or otherwise rearrange the code. If you insist on a GO TO, code it explicitly -- don't disguise it.

icon_wink.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us