The Clarion Advisor: Debug Redux

by Russell Eggen and Carl Barnes

Published 1999-07-20    Printer-friendly version

In an earlier Clarion Advisor article I looked at some alternative debugging techniques and asked readers if they had any tricks to share. They did, and I am again impressed by the inventiveness of Clarion developers.

Both Russ Eggen and Carl Barnes like to use INI files and the clipboard, though their approaches differ. Russ also offers a nifty technique for fixing SQL problems, and Carl explains how to use file logging to good advantage.

Russ Eggen

If you are processing (reports, process and browse populate functions) and need to find out what is going on behind the scenes, make your own dump log. You can use PUTINI (or use the ABC INIMgr) to write out your own statements. This make is far easier to look through the items that you are interested. And if you use the Defines tab on the project setting (to conditionally compile your code – ed.), you can turn this on or off as needed and not worry about stripping out the debug code when done.

If you are using SQL statements and the last statement comes back from the database with some error, it typically means that there is a syntax error on your part. Before sending the command via PROP:SQL, copy it to the clipboard. Since the clipboard has only the last thing sent to it, you can open up you favorite SQL command editor, paste and try to compile or execute (depending on tool used). This will expose the syntax error (like unknown column name in the case of misspellings, missing a closing quote, etc).

Carl Barnes

My favorite is to use PUTINI to write info I need to a text file. It's easy to code and since the file is kept closed you can display your information most any time. Plus PUTINI offers a lot of options in the way you can structure your information into sections, such as logging all the events.

ACCEPT
   evt += 1
   PUTINI('Events',evt,'Event=' & event() |
     & '  Field=' & field() ,'./0debug')
END

Another option is to use SETCLIPBOARD() to put some information you want to know in the clipboard. Then you can use the Clipboard viewer to watch for changes. This does have the limitation of only showing the last entry and not a log. There are some clipboard savers that will retain previous clipboard contents. PC Magazine has a number of clipboard viewers: .

The Clarion file drivers support logging activity to a text file. There is more on this in the C5 Programmer's guide (see "Logging"). Logging can be turned on for all files by adding entries to your Win.INI file. This is useful when a user has some sort of crash happening during start up and you're not sure what file is the problem.

;add to Win.Ini
[CWdriver]          e.g. [CWTopSpeed]
Profile=[1|0]       1=on, 0=off
Details=[1|0]
Trace=[1|0]
TraceFile=[Pathname]

There is also "On Demand" logging that can be turned on and off using the property syntax. You can even add your own comments to the log file to help you know what your code is trying to do. This is useful when some complex file access code is not working and you would like to see what it is really doing. For example I had to write code that synchronizes one file with two others.

Myfile{PROP:Profile}='\MyFile.log'!Turns Clarion I/O logging on
MyFile{PROP:Details}=1        !Turns Record Buffer logging on
! Write the string to the log file
MyFile{PROP:Log}='Starting Big Post ' & clock() 
DO BigProcessRtn
MyFile{PROP:Details}=0        !Turns Record Buffer logging off
MyFile{PROP:Profile}=''           !Turns Clarion I/O logging off

Be sure to try logging and turn on all the options to see the amount of data you can get about file access. I turn it on now and then to see what is happening during the startup of my programs. Don't forget to turn it off; the log files can take a lot of space and slow things down.


Russ Eggen has been using Clarion since 1986. Until about 1996, he was using it for business applications, mostly accounting programs. Afterwards he joined Topspeed as a consultant, and later as an instructor. He was a founding member of SoftVelocity when that company formed from Topspeed in May 2000. He left SoftVelocity in January 2001 and now works for his own company, RadFusion Inc. He still teaches and lectures, and is currently working on a new book and setting up a local Clarion classroom. Russ enjoys flying, scuba, and applied philosophy, and with great effort you might coax him into political discussions.

Carl Barnes is an independent consultant working in the Chicago area. He has been using Clarion since 1990, is a member of Team TopSpeed and a TopSpeed Certified Support Professional. He is the author of a number of Clarion utilities including CW Assistant, The CHM help class CHM4Clarion, and Clarion Source Search.

Printer-friendly version

Reader Comments

To add a comment to this article you must log in.

 
 

Search

 

Advanced Search
Topical Index

Related Articles

Subscribe to
ClarionMag

One year: $184

(includes all back issues since '99)

Renewals from $134

Two years: $274

Renewals from $224

More Info

Subscribe Now!

ClarionMag Blog

RSS Feeds

Updates via Email

Enter your Email


Powered by FeedBlitz

Quick Links