You could validate the string to make sure it is a valid global reference. I'm sure there is a clever pattern match that would serve for most cases. If you want to handle variables in the string like "^VA(200,DUZ,0)" you might need a loop. The error trap is faster to build, easier to prove correct and complete, and a better solution.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Toppenberg Sent: Saturday, February 11, 2006 8:43 AM To: Hardhats Sourceforge Subject: [Hardhats-members] Protecting against indirection errors. I have a question about how to protect against indirection errors. Imagine this function MyFunct(pRef) new result set result=$get(@pRef) quit result Here are some possible inputs and results: pRef Input Output ------ ---------- #1 ^VA(200,1,0) IRM,[EMAIL PROTECTED] #2 ^VA(200,1) "" #3 ^VA(200,,0) <----- causes error. In entry #2: if the data does not exist, then $get() protects against a crash and returns a "" value. But in entry #3, the indirection variable is invalid and causes an error. Is there anyway for a function to protect itself against invalid indirection errors, short of setting up an error trap? I can't think of any reasonable way to try to validate input values other than perhaps a simple test to ensure pRef'="" (which would only catch one possible error). Thanks Kevin ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642 _______________________________________________ Hardhats-members mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hardhats-members ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 _______________________________________________ Hardhats-members mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hardhats-members
