View previous topic :: View next topic |
Author |
Message |
whizkid79 Beginner
Joined: 29 Sep 2004 Posts: 53 Topics: 14
|
Posted: Fri May 27, 2005 8:21 am Post subject: Infinite loop |
|
|
Hi,
I have an interview qn:
A program is of 5k lines of code... some where in the program it is going into loop for some records. How can we find the exact location of the program where it is going in the loop, With out putting the program in the Xpedetor and display statments in the program?
Note: The input file has millions of records
I did do a search on this topic but couldnt find one.
Thanks,
Whizkid79 |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri May 27, 2005 8:50 am Post subject: |
|
|
Quote: |
How can we find the exact location of the program where it is going in the loop, With out putting the program in the Xpedetor and display statments in the program?
|
Whizkid79,
Answer : Line no: 2336
If the interviewer tells that the answer is wrong , then ask him to prove that your answer is wrong which obvisouly he cannot.
I had this arguement with my brother about counting stars. He would randomly say a number and I like an idiot would start counting them to prove him wrong. I realized that after I counted more than 2000 stars.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
dtf Beginner
Joined: 10 Dec 2004 Posts: 110 Topics: 8 Location: Colorado USA
|
Posted: Fri May 27, 2005 1:27 pm Post subject: |
|
|
You may be able to narrow it down under certain circumstances by watching it execute in SDSF, and when you notice that the program is no longer performing I/O, (EXCP count is not increasing), cancel it with a dump. Then you would solve the dump to determine where you are in the program logic.
This has sometimes worked for me in the past, but is certainly not fullproof. It would not work in an instance where I/O is being done within the set of instructions that are in the "loop".
The fact that the question says the "EXACT" location, says to me that the question really cannot be answered. If I were as the question I would tell the interviewer that, and then proceed to tell him how I would "attempt" to narrow it down, and why that may or may not work.
________
Autozam Scrum
Last edited by dtf on Tue Feb 01, 2011 1:55 pm; edited 1 time in total |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Mon May 30, 2005 4:41 pm Post subject: |
|
|
The problem with these exercises is that the poser of the ques can say at any point, "No, you can't do that either".
Anyway, you can get the I/P rec involved in the loop and the one before and after. Create a file of those 3 and see if you can recreate the prob.
If you do, take a look at the recs an try to determine the difference(s) between the middle rec and the other 2. That may point you to the problem area of the code or pinpoint a flaw in the data, or both.
Come to think of it, you may even want to skip rerunning the app. _________________ Regards, Jack.
"A problem well stated is a problem half solved" -- Charles F. Kettering |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Mon May 30, 2005 4:46 pm Post subject: |
|
|
P.S.
With only 3 I/P recs they may even allow you to test w/EXPED and displays. _________________ Regards, Jack.
"A problem well stated is a problem half solved" -- Charles F. Kettering |
|
Back to top |
|
|
|
|