Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Next sentence coding

Status
Not open for further replies.

sswf224

Programmer
Jan 15, 2009
4
GB
HELP me pls !

4.01 if fred = "N" or "n" or "Y" or "y"
4.02 next sentence
4.03 else
4.04 display "Cme on surely you know its Y or y or N or n "
4.05 display " "
4.06 display "try again !"
4.07 go to aaa-1
4.08 end-if.
^ Problem on line 4.08
** Warning 268 ** Improper context for NEXT SENTENCE

What is wrong with it ?

fred is defined as pic x.

aaa-1 is just above on line 3

 

Sort of answered myself - changed "next sentence" for "continue
 
NEXT SENTENCE is obsolete in current COBOL standards. Many compilers cannot handle it well.
 
Sane coding standards:

next sentence and end-if are mutual exclusive in 1 line,
even better in 1 section
even better in 1 program.

In the past I had to maintain old '74 programs. In the section were you made you changes it was good habit to convert all IF statements and add END-IF's and take the NEXT SENTENCES out.
 
In these days of no full stops (periods) in code, NEXT SENTENCE is very bad news as it will cause your program to drop to the next full stop, which quite conceivably is
a) not what you were expecting
and/or b) the end of the section/paragraph.

Avoid at all costs!

See faq209-1833 for further details if required
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top