Hi,
I am trying to run a program, where a method that is used in this class is defined.
CLASS classname:
CONSTRUCTOR classname():
method2().
END CONSTRUCTOR.
METHOD PRIVATE LOG method1():
.....
FIND FIRST tablename NO-LOCK.
.....
END METHOD.
METHOD method2():
method1().
END METHOD.
END CLASS.
The only error i can see in the logs is Find first/Last failed for table (565).
I am using Openedge 10.2B on windows 7.
But the surprising part is, it works just fine on Windows XP machine. Does anyone knows what is the reason like too many databases are getting connected in one time. Or how can I resolve it.
Regards,
Zeeshaan
Did you verify that there is a record in that table?
Try a FIND FIRST tablename NO-LOCK . from the procedure editor.
Try the FIND FIRST tablename NO-LOCK with the NO-ERROR option. Then check
IF NOT AVAILABLE tablename THEN MESSAGE “Record does not exists”.
Thanks for the reply, I have used NO-LOCK, but the same error is seen in the log file. If i use NO-ERROR and check for IF NOT AVAIL then I get the error message as record does not exists. But the program still hangs. I am going to change the programming style and use a new procedure instead of class and methods. And hope if that would help.
While this doesn't address the reason for the failure in your specific case, the first thing I would suggest is removing any logic from the constructor which can possibly fail. If it fails, you are left without a class instance which can be messy. Much better is to limit the constructor to the minimum necessary to have a valid instance of the class and then have an Initialize() method to do all the setup.
Before I had the method2() completely in construcotr, I removed the code and made it as method2().
Now, in the constructor I am just calling a method and nothing more. Like I have shown in my code, method2(). Then method2() calls 3 more methods where method1() is one of them. The method1() has the find statement for table, and when I run this program on a task scheduler in Windows 7 machine with o/e 10.2B. It gives me the failed error.
If I run the program with task scheduler on Windows xp machine with o/e 10.2B then it just runs perfectly. I really don't understand where the problem is.
Before I had the method2() completely in construcotr, I removed the code and made it as method2().
Moving it, but still calling it in the constructor, doesn't change my point. If you call it in the constructor and it fails, then you don't have a valid instance of the class and you are kind of stuck on recovery. If you call it in an Initialize() method, you can trap and make a graceful handling.
Reply by zeeshaanBefore I had the method2() completely in construcotr, I removed the code and made it as method2().
Now, in the constructor I am just calling a method and nothing more. Like I have shown in my code, method2(). Then method2() calls 3 more methods where method1() is one of them. The method1() has the find statement for table, and when I run this program on a task scheduler in Windows 7 machine with o/e 10.2B. It gives me the failed error.
If I run the program with task scheduler on Windows xp machine with o/e 10.2B then it just runs perfectly. I really don't understand where the problem is.
Stop receiving emails on this subject.Flag this post as spam/abuse.