|
On 16/06/2005, at 11:11 PM, Brian Piotrowski wrote:
I'm having two problems with it: 1) The error checking works, but when an error occurs, the program goesinto an endless loop and locks up. The only way I can stop it is to endthe session or cancel the program. 2) My SQL statement is written successfully, but no data is returned. Again, it appears to go into an endless loop. If anyone has any ideas, I'd really appreciate it. Thanks, and here's the code for your review:
This program is so poorly structured I'm not surprised it's behaving badly. Parts of it are alright but the do-everything FindKL subroutine is a bit of a mess. And a lot of the stuff in *INZSR doesn't seem to belong there either. Ask yourself these questions:
For problem 1:When an error occurs how is the error displayed to the user? How will they be able to respond to the error?
For problem 2:When records are written to the subfile how is it displayed to the user? How will they be able to specify another search?
The root cause is the same in both cases. You never display the screen to the user. The subfile control record is written only in *INZSR and SFLClear. The prompt is only written during *INZSR. After that you never display the results. Even though you write the error message you never read the screen which would stop your endless loop. Even when you populate the subfile you never display the control record which is why the data doesn't appear. Nor do you read from the control record which would also stop your endless loop.
Also,
If rrn = 0;sfldsp = *ON; <==== THIS IS WRONG BUT NOT THE CAUSE OF THE PROBLEM.else; lastrrn = rrn; endif;
Regards, Simon Coulter. -------------------------------------------------------------------- FlyByNight Software AS/400 Technical Specialists http://www.flybynight.com.au/ Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ Fax: +61 3 9419 0175 \ / X ASCII Ribbon campaign against HTML E-Mail / \ --------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.