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

Regarding Continue verb


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Mon Feb 18, 2008 11:14 pm
Reply with quote

Hi All,

Can any one tell me the functionality of the below two logics.

If Emp-id = '34587'
continue
else if emp-id='78657'
continue
else if emp-id='3145'
continue
else
next sentence
end-if
move emp-id emp-out
write emp-rec.

If emp-id = ''34587'
or '78657'
or '3145'
move emp-id emp-out
write emp-rec.

Thanks in Advance,
Varalakshmi.G
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Tue Feb 19, 2008 12:04 am
Reply with quote

Hi,

Did You try to execute it..if yes, what was the result?
Back to top
View user's profile Send private message
kishorimf

New User


Joined: 30 Nov 2007
Posts: 1
Location: California

PostPosted: Tue Feb 19, 2008 2:51 am
Reply with quote

varalakshmi.G wrote:
Hi All,

Can any one tell me the functionality of the below two logics.

If Emp-id = '34587'
continue
else if emp-id='78657'
continue
else if emp-id='3145'
continue
else
next sentence
end-if
move emp-id emp-out
write emp-rec.

If emp-id = ''34587'
or '78657'
or '3145'
move emp-id emp-out
write emp-rec.

Thanks in Advance,
Varalakshmi.G





In the first logic... if EMP id is "34587" or "78657" or "3145" emprec is written,if there are records other than these empid's then it will come out of the loop.

In second logic there is no condition to check if it come across a record other than the above three empid's.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Feb 19, 2008 3:18 am
Reply with quote

varalakshmi.G wrote:
If Emp-id = '34587'
continue
else if emp-id='78657'
continue
else if emp-id='3145'
continue
else
next sentence
end-if
move emp-id emp-out
write emp-rec.
Wouldn't that actually evaluate to:
Code:

If Emp-id = '34587'
  continue
else
  if emp-id='78657'
    continue
  else
    if emp-id='3145'
     continue
    else
     next sentence
    end-if
  move emp-id emp-out
  write emp-rec
  end-if
end-if
.
Back to top
View user's profile Send private message
shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Tue Feb 19, 2008 11:52 am
Reply with quote

Think its actually:

Code:

If Emp-id = ('34587' or  '78657' or '3145')
   continue
else
   next sentence
end-if

move emp-id emp-out
write emp-rec.




Regards,
Shitij
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Feb 19, 2008 6:26 pm
Reply with quote

shitij wrote:
Think its actually:

Code:

If Emp-id = ('34587' or  '78657' or '3145')
   continue
else
   next sentence
end-if

move emp-id emp-out
write emp-rec.
Why?
Without an explicit IF terminator, the implicit terminator is the period.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Feb 21, 2008 12:08 am
Reply with quote

Hi Varalakshmi.G,

The 2 "logics" produce identical results. Guess which one is preferred.

PS

This is probably the most straightforward:
Code:

If emp-id = ('34587' or  '78657' or '3145')
   move emp-id to emp-out
   write emp-rec
end-if
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
This topic is locked: you cannot edit posts or make replies. regarding COBOL WRITE verb (VB File H... COBOL Programming 9
This topic is locked: you cannot edit posts or make replies. Job to wait and continue based on reply COBOL Programming 5
No new posts Not enough virtual memory is availabl... IBM Tools 16
No new posts How to continue ftp line when the fil... JCL & VSAM 1
No new posts Logic of START verb with Read next COBOL Programming 6
Search our Forums:

Back to Top