View previous topic :: View next topic
|
Author |
Message |
Vineet
New User
Joined: 14 Sep 2005 Posts: 20
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe not - you must control the process flow in your code. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
Back to top |
|
|
|