Don't you hate it when you have a super long one-time conversion program, add some new 1-time crap over time, and then all of the sudden when ready to run you get this error message, AND CAN'T SEE WHERE THIS MISSING/ERRANT STRUCTURE IS?
I'd be surprised if we haven't all been there at some point in our dev lives.
It pays to take the time and do good modular design instead of this way-too-long PRG run on crap. hahaha
I wrote something ages ago to deal with that type of thing. Basically renders to HTML and puts the matched branching statements into div blocks which were collapsible. Made it easy to find the issue.
Yes been there !!
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Thursday, 13 July 2017 11:41 PM To: profoxtech@leafe.com Subject: "An IF | ELSE | ENDIF statement is missing"
Don't you hate it when you have a super long one-time conversion program, add some new 1-time crap over time, and then all of the sudden when ready to run you get this error message, AND CAN'T SEE WHERE THIS MISSING/ERRANT STRUCTURE IS?
I'd be surprised if we haven't all been there at some point in our dev lives.
It pays to take the time and do good modular design instead of this way-too-long PRG run on crap. hahaha
[excessive quoting removed by server]
On 2017-07-13 09:50, Darren wrote:
I wrote something ages ago to deal with that type of thing. Basically renders to HTML and puts the matched branching statements into div blocks which were collapsible. Made it easy to find the issue.
Yes been there !!
You should upload that to the ProFox downloads page for the community's benefit! ;-)
I could do that - not right now though - just on midnight here and about to hit the hay.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Thursday, 13 July 2017 11:57 PM To: profoxtech@leafe.com Subject: RE: "An IF | ELSE | ENDIF statement is missing"
On 2017-07-13 09:50, Darren wrote:
I wrote something ages ago to deal with that type of thing. Basically renders to HTML and puts the matched branching statements into div blocks which were collapsible. Made it easy to find the issue.
Yes been there !!
You should upload that to the ProFox downloads page for the community's benefit! ;-)
[excessive quoting removed by server]
And another tool I have which helps is to add comments to the end of the terminating commands - e.g. ENDIF, ENDFOR, ENDDO, EXIT etc. which help to identify the branch / loop.
Viz.
Without terminating comments...
DO WHILE .T.
*- Operate between 1am and 3pm local sydney time IF NOT BETWEEN(HOUR(DATETIME()), 1, 15) && 01:00:00 to 14:59:59
=messagebox("This function is designed to run between 1am and 3pm local time (Sydney)" + CHR(13) + CHR(13) + ; "The program will now terminate", 48, "Outside of times of operation", 10000)
EXIT
ENDIF
SELECT w_bnTrack SCAN FOR rssAvailable
*- Check if this track has runs today. SELECT w_usdRace LOCATE FOR track_code = w_bnTrack.livetkcode IF NOT FOUND() SELECT w_bnTrack LOOP ENDIF
... With terminating comments...
DO WHILE .T.
*- Operate between 1am and 3pm local sydney time IF NOT BETWEEN(HOUR(DATETIME()), 1, 15) && 01:00:00 to 14:59:59
=messagebox("This function is designed to run between 1am and 3pm local time (Sydney)" + CHR(13) + CHR(13) + ; "The program will now terminate", 48, "Outside of times of operation", 10000)
EXIT && DO WHILE .T.
ENDIF && NOT BETWEEN(HOUR(DATETIME()), 1, 15) && 01:00:00 to 14:59:59
SELECT w_bnTrack SCAN FOR rssAvailable
*- Check if this track has runs today. SELECT w_usdRace LOCATE FOR track_code = w_bnTrack.livetkcode IF NOT FOUND() SELECT w_bnTrack LOOP ENDIF && NOT FOUND()
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Thursday, 13 July 2017 11:41 PM To: profoxtech@leafe.com Subject: "An IF | ELSE | ENDIF statement is missing"
Don't you hate it when you have a super long one-time conversion program, add some new 1-time crap over time, and then all of the sudden when ready to run you get this error message, AND CAN'T SEE WHERE THIS MISSING/ERRANT STRUCTURE IS?
I'd be surprised if we haven't all been there at some point in our dev lives.
It pays to take the time and do good modular design instead of this way-too-long PRG run on crap. hahaha
[excessive quoting removed by server]
A technique I've used in the past for complex structures - definitely worth the effort!
John Weller 01380 723235 07976 393631
And another tool I have which helps is to add comments to the end of the terminating commands - e.g. ENDIF, ENDFOR, ENDDO, EXIT etc. which help to identify the branch / loop.
you don't need the comment markers - this works just fine: x=1 IF x=1 WAIT WINDOW 'true' ENDIF x=1
Darren wrote: ....... With terminating comments...
... IF NOT BETWEEN(HOUR(DATETIME()), 1, 15) && 01:00:00 to 14:59:59
=messagebox(.... ENDIF && NOT BETWEEN(HOUR(DATETIME()), 1, 15) && 01:00:00 to 14:59:59
Yep I know - but with the && the syntax colouring in the editor makes it a whole lot easier to read.
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of AndyHC Sent: Sunday, 16 July 2017 10:27 PM To: profoxtech@leafe.com Subject: Re: "An IF | ELSE | ENDIF statement is missing"
you don't need the comment markers - this works just fine: x=1 IF x=1 WAIT WINDOW 'true' ENDIF x=1
Darren wrote: ....... With terminating comments...
... IF NOT BETWEEN(HOUR(DATETIME()), 1, 15) && 01:00:00 to 14:59:59
=messagebox(.... ENDIF && NOT BETWEEN(HOUR(DATETIME()), 1, 15) && 01:00:00 to
14:59:59
[excessive quoting removed by server]
Sometimes, the Beautify command can help with this. The indenting helps me find where I'm off track or at least isolate the general area where the problem starts.
Paul H. Tarver Tarver Program Consultants, Inc. Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Thursday, July 13, 2017 8:41 AM To: profoxtech@leafe.com Subject: "An IF | ELSE | ENDIF statement is missing"
Don't you hate it when you have a super long one-time conversion program, add some new 1-time crap over time, and then all of the sudden when ready to run you get this error message, AND CAN'T SEE WHERE THIS MISSING/ERRANT STRUCTURE IS?
I'd be surprised if we haven't all been there at some point in our dev lives.
It pays to take the time and do good modular design instead of this way-too-long PRG run on crap. hahaha
[excessive quoting removed by server]
Apart from all of the above, my pet hate is mistakenly using ERRANT instead of ERRING. ERRING means in error and ERRANT means on a mission (as in "A Knight Errant"). I'm sure as children we all had to run ERRANDS (same root).
Laurie
On 13 July 2017 at 16:00, Paul H. Tarver paul@tpcqpc.com wrote:
Sometimes, the Beautify command can help with this. The indenting helps me find where I'm off track or at least isolate the general area where the problem starts.
Paul H. Tarver Tarver Program Consultants, Inc. Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Thursday, July 13, 2017 8:41 AM To: profoxtech@leafe.com Subject: "An IF | ELSE | ENDIF statement is missing"
Don't you hate it when you have a super long one-time conversion program, add some new 1-time crap over time, and then all of the sudden when ready to run you get this error message, AND CAN'T SEE WHERE THIS MISSING/ERRANT STRUCTURE IS?
I'd be surprised if we haven't all been there at some point in our dev lives.
It pays to take the time and do good modular design instead of this way-too-long PRG run on crap. hahaha
[excessive quoting removed by server]
Errant is correct. It has two meanings as an adjective:
1. erring or straying from the proper course or standards. "he could never forgive his daughter's errant ways" synonyms: offending, guilty, culpable, misbehaving, delinquent, lawbreaking
2. archaic/literary: traveling in search of adventure. "that same lady errant," "a knight errant" synonyms: traveling, wandering, itinerant, roaming, roving, voyaging
Mike
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: Thursday, July 13, 2017 11:32 AM To: profoxtech@leafe.com Subject: Re: "An IF | ELSE | ENDIF statement is missing"
Apart from all of the above, my pet hate is mistakenly using ERRANT instead of ERRING. ERRING means in error and ERRANT means on a mission (as in "A Knight Errant"). I'm sure as children we all had to run ERRANDS (same root).
Laurie
On 13 July 2017 at 16:00, Paul H. Tarver paul@tpcqpc.com wrote:
Sometimes, the Beautify command can help with this. The indenting helps me find where I'm off track or at least isolate the general area where the problem starts.
Paul H. Tarver Tarver Program Consultants, Inc. Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: Thursday, July 13, 2017 8:41 AM To: profoxtech@leafe.com Subject: "An IF | ELSE | ENDIF statement is missing"
Don't you hate it when you have a super long one-time conversion program, add some new 1-time crap over time, and then all of the sudden when ready to run you get this error message, AND CAN'T SEE WHERE THIS MISSING/ERRANT STRUCTURE IS?
I'd be surprised if we haven't all been there at some point in our dev lives.
It pays to take the time and do good modular design instead of this way-too-long PRG run on crap. hahaha
[excessive quoting removed by server]
Not to hijack this thread, but Python's indentation-as-syntax eliminates problems like this. I know this doesn't solve the problem at hand, just pointing out how another language handles this situation.
Malcolm
Mike,
Thanks for for your clarification. Errant (in the sense of erring) comes from the Latin "errare", to err. Errant (in the sense of on a mission) comes from Old French (travelling). English has plenty of words which are spelt the same but have different meanings, e.g. cleave.
Laurie
On 13 July 2017 at 18:51, Malcolm Greene profox@bdurham.com wrote:
Not to hijack this thread, but Python's indentation-as-syntax eliminates problems like this. I know this doesn't solve the problem at hand, just pointing out how another language handles this situation.
Malcolm
[excessive quoting removed by server]
On 13 July 2017 at 18:51, Malcolm Greene profox@bdurham.com wrote:
Not to hijack this thread, but Python's indentation-as-syntax eliminates problems like this. I know this doesn't solve the problem at hand, just pointing out how another language handles this situation.
It makes it worse! It's the number one reason I don't like Python!
I was recently writing some Python code on my Raspberry PI. I got so frustrated I ended up re-writing in C.
Not to hijack this thread, but were you two talking about Monty and the errant for the Holy Grail? :)
Paul H. Tarver Tarver Program Consultants, Inc. Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Paul Hill Sent: Thursday, July 13, 2017 2:11 PM To: profoxtech@leafe.com Subject: Re: "An IF | ELSE | ENDIF statement is missing"
On 13 July 2017 at 18:51, Malcolm Greene profox@bdurham.com wrote:
Not to hijack this thread, but Python's indentation-as-syntax eliminates problems like this. I know this doesn't solve the problem at hand, just pointing out how another language handles this situation.
It makes it worse! It's the number one reason I don't like Python!
I was recently writing some Python code on my Raspberry PI. I got so frustrated I ended up re-writing in C.
-- Paul
[excessive quoting removed by server]
Hey Paul - I think your reply is more in the way of Derailment instead of HiJacking! :-)
I must admit - sometimes when I want a little break from work - I come hang out here in the land of ProFox - just for the entertainment value it affords me!
Regards, Kurt Wendt Senior Systems Analyst
Tel. +1-212-747-9100 www.GlobeTax.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Paul H. Tarver Sent: Thursday, July 13, 2017 4:14 PM To: profoxtech@leafe.com Subject: RE: "An IF | ELSE | ENDIF statement is missing"
Not to hijack this thread, but were you two talking about Monty and the errant for the Holy Grail? :)
Paul H. Tarver Tarver Program Consultants, Inc. Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Paul Hill Sent: Thursday, July 13, 2017 2:11 PM To: profoxtech@leafe.com Subject: Re: "An IF | ELSE | ENDIF statement is missing"
On 13 July 2017 at 18:51, Malcolm Greene profox@bdurham.com wrote:
Not to hijack this thread, but Python's indentation-as-syntax eliminates problems like this. I know this doesn't solve the problem at hand, just pointing out how another language handles this situation.
It makes it worse! It's the number one reason I don't like Python!
I was recently writing some Python code on my Raspberry PI. I got so frustrated I ended up re-writing in C.
-- Paul
[excessive quoting removed by server]
Sorry but I couldn't resist. :)
I thought everyone knew FOX = FUN!
Paul H. Tarver Tarver Program Consultants, Inc. Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt Sent: Thursday, July 13, 2017 3:27 PM To: profoxtech@leafe.com Subject: RE: "An IF | ELSE | ENDIF statement is missing"
Hey Paul - I think your reply is more in the way of Derailment instead of HiJacking! :-)
I must admit - sometimes when I want a little break from work - I come hang out here in the land of ProFox - just for the entertainment value it affords me!
Regards, Kurt Wendt Senior Systems Analyst
Tel. +1-212-747-9100 www.GlobeTax.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Paul H. Tarver Sent: Thursday, July 13, 2017 4:14 PM To: profoxtech@leafe.com Subject: RE: "An IF | ELSE | ENDIF statement is missing"
Not to hijack this thread, but were you two talking about Monty and the errant for the Holy Grail? :)
Paul H. Tarver Tarver Program Consultants, Inc. Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Paul Hill Sent: Thursday, July 13, 2017 2:11 PM To: profoxtech@leafe.com Subject: Re: "An IF | ELSE | ENDIF statement is missing"
On 13 July 2017 at 18:51, Malcolm Greene profox@bdurham.com wrote:
Not to hijack this thread, but Python's indentation-as-syntax eliminates problems like this. I know this doesn't solve the problem at hand, just pointing out how another language handles this situation.
It makes it worse! It's the number one reason I don't like Python!
I was recently writing some Python code on my Raspberry PI. I got so frustrated I ended up re-writing in C.
-- Paul
[excessive quoting removed by server]
On Thu, Jul 13, 2017 at 9:40 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
It pays to take the time and do good modular design instead of this way-too-long PRG run on crap. hahaha
So, wait, you're saying that if you create functions/modules/methods that are short, do only one thing, having clearly defined input and output ranges and values, can be tested in isolation, have clear entry and exit points, have a consistent error handling, are orchestrated together,... in other words, good coding is easier to debug?
Hunh. I learn something new on this forum every day.
On 2017-07-13 16:34, Ted Roche wrote:
On Thu, Jul 13, 2017 at 9:40 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
It pays to take the time and do good modular design instead of this way-too-long PRG run on crap. hahaha
So, wait, you're saying that if you create functions/modules/methods that are short, do only one thing, having clearly defined input and output ranges and values, can be tested in isolation, have clear entry and exit points, have a consistent error handling, are orchestrated together,... in other words, good coding is easier to debug?
Hunh. I learn something new on this forum every day.
We've all been there: "Oh this is a quick one-time only kind of thing. I'll just write some quick code." ...and then it morphs into something larger and hairier before long.
I was wondering if Intellisense would help (IFELSE).
Laurie
On 14 July 2017 at 12:32, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
On 2017-07-13 16:34, Ted Roche wrote:
On Thu, Jul 13, 2017 at 9:40 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
It pays to take the time and do good modular design instead of this way-too-long PRG run on crap. hahaha
So, wait, you're saying that if you create functions/modules/methods that are short, do only one thing, having clearly defined input and output ranges and values, can be tested in isolation, have clear entry and exit points, have a consistent error handling, are orchestrated together,... in other words, good coding is easier to debug?
Hunh. I learn something new on this forum every day.
We've all been there: "Oh this is a quick one-time only kind of thing. I'll just write some quick code." ...and then it morphs into something larger and hairier before long.
[excessive quoting removed by server]
I feel your pain!
I TRY and keep the rule that no tabbed programming structure (if... endif, do case.. endcase etc.) should span more than a page..... but must admit I fail regularly!!!
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: 14 July 2017 13:03 To: ProFox Email List profox@leafe.com Subject: Re: "An IF | ELSE | ENDIF statement is missing"
On 2017-07-14 07:39, Laurie Alvey wrote:
I was wondering if Intellisense would help (IFELSE).
No. Intellisense doesn't prevent you from writing sloppy way-too-long code. lol
[excessive quoting removed by server]
Thor comes with a bunch of utility PRGs that might help with this. And you can create your own variations of pretty much all the Thor utilities if it doesn't work precisely as you want.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Dave Crozier Sent: Friday, July 14, 2017 8:37 AM To: profoxtech@leafe.com Subject: RE: "An IF | ELSE | ENDIF statement is missing"
I feel your pain!
I TRY and keep the rule that no tabbed programming structure (if... endif, do case.. endcase etc.) should span more than a page..... but must admit I fail regularly!!!
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: 14 July 2017 13:03 To: ProFox Email List profox@leafe.com Subject: Re: "An IF | ELSE | ENDIF statement is missing"
On 2017-07-14 07:39, Laurie Alvey wrote:
I was wondering if Intellisense would help (IFELSE).
No. Intellisense doesn't prevent you from writing sloppy way-too-long code. lol
[excessive quoting removed by server]
Does Beautify not do What you want? Koen
Op vr 14 jul. 2017 om 17:17 schreef Richard Kaye rkaye@invaluable.com
Thor comes with a bunch of utility PRGs that might help with this. And you can create your own variations of pretty much all the Thor utilities if it doesn't work precisely as you want.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Dave Crozier Sent: Friday, July 14, 2017 8:37 AM To: profoxtech@leafe.com Subject: RE: "An IF | ELSE | ENDIF statement is missing"
I feel your pain!
I TRY and keep the rule that no tabbed programming structure (if... endif, do case.. endcase etc.) should span more than a page..... but must admit I fail regularly!!!
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com Sent: 14 July 2017 13:03 To: ProFox Email List profox@leafe.com Subject: Re: "An IF | ELSE | ENDIF statement is missing"
On 2017-07-14 07:39, Laurie Alvey wrote:
I was wondering if Intellisense would help (IFELSE).
No. Intellisense doesn't prevent you from writing sloppy way-too-long code. lol
[excessive quoting removed by server]
On Thu, Jul 13, 2017 at 9:40 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
Don't you hate it when you have a super long one-time conversion program,
This is another good justification for printouts. Every few months, we print out long listings, break out the multi-colored highlighters, and mark up the code until we find the dangling reference.
On 2017-07-14 08:59, Ted Roche wrote:
On Thu, Jul 13, 2017 at 9:40 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
Don't you hate it when you have a super long one-time conversion program,
This is another good justification for printouts. Every few months, we print out long listings, break out the multi-colored highlighters, and mark up the code until we find the dangling reference.
Turned out I had an unmatched #IF/#ENDIF after I had commented out some older code. Problem solved (for now).