home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / database / informix / 3048 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.6 KB

  1. Path: sparky!uunet!gatech!emory!emory!not-for-mail
  2. From: dave.snyder@snide.com (Dave Snyder)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re: Catching output from RUN command (4GL)
  5. Date: 24 Jan 1993 22:13:03 -0500
  6. Organization: Mailing List Gateway
  7. Lines: 36
  8. Sender: walt@mathcs.emory.edu
  9. Distribution: world
  10. Message-ID: <1jvlrvINN9n@emory.mathcs.emory.edu>
  11. Reply-To: dave.snyder@snide.com (Dave Snyder)
  12. NNTP-Posting-Host: emory.mathcs.emory.edu
  13. X-Informix-List-ID: <list.1816>
  14.  
  15. Quoting Paul Roberts...
  16. } In article <C1D1pp.AA0@dircon.co.uk> uaa1006@dircon.co.uk (Peter Miles) writes:
  17. } >
  18. } >Does anyone know if there is any way of capturing the output 
  19. } >of a command run by the 4GL RUN command into an Informix 4GL
  20. } >variable?
  21. } >
  22. } You can always do something (kind of klugey!) like this :
  23.   [ Interesting kludge deleted... ]
  24.  
  25. If you want to stay with pure 4GL, Paul's idea is perfect.  If you aren't
  26. afraid of C, you could do something like this:
  27.  
  28. Mind you, this pseudo code (but you'll get the idea)
  29.  
  30. runit(arg)
  31. {
  32.     FILE    *pp;
  33.     char    buf[513], txt[257];
  34.  
  35.     popquote(buf, sizeof(buf));        /* Pop the run string off the stack */
  36.     pp = popen(buf, "r");        /* Open a pipe for read w/ run string */
  37.     fgets(txt, sizeof(txt), pp);    /* Read a line from the pipe */
  38.     pclose(pp);                /* Close the pipe */
  39.     retquote(txt);            /* Push the txt string onto the stack */
  40.     return(1);                /* Tell 4GL that you returned 1 arg */
  41. }
  42.  
  43. DAS
  44. -- 
  45. David Snyder @ Snide Computer Services - Folcroft, PA          Current Release
  46.                                                                is db4glgen-3.9
  47. UUCP:  ..!uunet!das13!dave   INTERNET:  dave.snyder@snide.com
  48.