home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / 8967 < prev    next >
Encoding:
Text File  |  1993-01-09  |  2.5 KB  |  75 lines

  1. Newsgroups: comp.databases
  2. Path: sparky!uunet!uunet.ca!xenitec!tdkcs.waterloo.on.ca!timk
  3. From: timk@tdkcs.waterloo.on.ca (Tim Kuehn)
  4. Subject: Re: UDF problem in FoxBase+
  5. Organization: TDK Consulting Services
  6. Date: Sat, 9 Jan 1993 18:49:07 GMT
  7. Message-ID: <1993Jan9.184907.9482@tdkcs.waterloo.on.ca>
  8. References: <durai.123.726545367@ortta.umn.edu> <1993Jan9.090934.2183@netcom.com> <300@safn8.UUCP>
  9. Lines: 64
  10.  
  11. In article <300@safn8.UUCP> rey@safn2 (rey) writes:
  12. >In article <1993Jan9.090934.2183@netcom.com>, jamesc@netcom.com (James Chuang) writes:
  13. >> 
  14. >> Since you are using FoxBase+, I don't believe you declare UDF()s with a
  15. >> FUNCTION keyword.  This was introduced in dBase IV ver 1.0, which came
  16. >> after FoxBase+.  In FoxBase+, procedures and functions are declared the
  17. >> same way:
  18. >> 
  19. >>     PROCEDURE isok
  20. >> The only difference is that procedures can't accept a return value.
  21. >> So in your case, just change your declaration to procedure, adn you should
  22. >> be ok....
  23. >> 
  24. >> jamesc
  25. >
  26. >In SCO foxbase+ I do not recall a FUNCTION keyword, but PRODEDURE gives
  27. >the same functionality. RETURN is a keyword that returns a value, so
  28. >the procedure acts like a function. What did you mean "procedures can't accept
  29. >a return value"?
  30. >
  31. >Are SCO foxbase+ procedures recursive? can a UDF call itself?
  32.  
  33. Easy enough to test. Put the following code segment in a file and 
  34. "set procedure to" it, then "do main"
  35.  
  36. procedure main
  37.  
  38. do recurse with 1
  39. quit
  40.  
  41. procedure recurse
  42. parameters num
  43.  
  44. if (num > 5) then 
  45.     return num
  46. else
  47.     num = num + 1
  48.     do recurse with num
  49. endif
  50. return(num)
  51.  
  52. >Are parameters (arguments) on a stack, so that they can have
  53. >different values in a UDF from the caller, or are they PUBLIC?
  54.  
  55. Run the prior program and find out.
  56.  
  57. >Sorry so much of the thread is missing; but the original problem
  58. >was that functions (UDF) do not work.
  59.  
  60. What was the original context you were trying to use the UDF in? 
  61. If you have a file "udfunc.prg" which has "procedure udfunc" at the
  62. top, the UDF won't work.  (Don't know why though, although Fbase/+ 
  63. doesn't support multiple procedures in a single file that's not 
  64. "set procedure to"d.) Comment out the "procedure" line and it should
  65. behave itself.
  66.  
  67. >Reynolds McClatchey (Southern Aluminum Finishing Co, Atlanta, GA, USA)
  68. >uunet!safn2!reyi    rey@saf.com
  69.  
  70.  +-----------+-----------------------------------+---------------------------+
  71.  | Tim Kuehn | TDK Consulting Services           | timk@tdkcs.waterloo.on.ca |
  72.  | <><       | Ask me about news and mail in KW! | (519)-888-0766            |
  73.  +-----------+-----------------------------------+---------------------------+
  74.  
  75.