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

Predefine Function or Verb in COBOL


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

New User


Joined: 14 Sep 2005
Posts: 20

PostPosted: Fri Jun 15, 2007 12:42 pm
Reply with quote

Hi All,

I am having a query. Is there any Predefine function or Verb in COBOL which can bring the control out of any construct i.e. If Statement. For Example I am having following condition, its for COBOL/DB2 Pgm.

Main-Processing-Para
If (Some Condition)
Para-1
Para-2
Else
Para-3
Para-4
Para-5
Para-6
Para-7
End-if.
Para-8
Para-9.

I want that if from Para3 To Para7, if SQLCODE = +100 is encountered in any Para then remaning Paras should get skipped i.e. If SQLCODE=+100 in Para4 then Para5 To Para7 to get Skipped & Control to set at Para8. One Solution is 'Go To'. I want t to Know any Function or Verb.

Thanks

Vineet Anand
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 15, 2007 12:48 pm
Reply with quote

Hello,

I believe not - you must control the process flow in your code.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Jun 15, 2007 2:11 pm
Reply with quote

Adding another condition statement should help you in such case. If there are to many nested Ifs then cosider using EVALUATE. Please let us know if I missed something..
Back to top
View user's profile Send private message
Pons

New User


Joined: 25 May 2007
Posts: 61
Location: Coimbatore

PostPosted: Fri Jun 15, 2007 3:21 pm
Reply with quote

I think you may use the Next Sentense verb.

If SQLCODE = +100
NEXT SENTENCE
end-if

you must code this for each para except last para.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jun 16, 2007 5:06 am
Reply with quote

Hello,

There are several simple ways to code to get the desired result.

I still believe there is no builtin-in function that will let you "bail out" in the middle of a process. All of the suggestions above are ways to implement such code.

Maybe that is what the original request is asking for, but i did not think so icon_confused.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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top