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

  1. Path: sparky!uunet!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!yale.edu!newsserver.jvnc.net!darwin.sura.net!europa.asd.contel.com!emory!emory!not-for-mail
  2. From: alan@effluvia.den.mmc.com (Alan Popiel)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re:  Catching output from RUN command (4GL)
  5. Date: 25 Jan 1993 11:18:06 -0500
  6. Organization: Mailing List Gateway
  7. Lines: 53
  8. Sender: walt@mathcs.emory.edu
  9. Distribution: world
  10. Message-ID: <1k13ruINNros@emory.mathcs.emory.edu>
  11. Reply-To: alan@effluvia.den.mmc.com (Alan Popiel)
  12. NNTP-Posting-Host: emory.mathcs.emory.edu
  13. X-Informix-List-ID: <list.1818>
  14.  
  15. ->From: uaa1006@dircon.co.uk (Peter Miles)
  16. ->Subject: Catching output from RUN command (4GL)
  17. ->Date: Sun, 24 Jan 1993 13:34:36 GMT
  18. ->Reply-To: uaa1006@dircon.co.uk (Peter Miles)
  19. ->
  20. ->Does anyone know if there is any way of capturing the output 
  21. ->of a command run by the 4GL RUN command into an Informix 4GL
  22. ->variable?
  23. ->
  24. ->EG I want to say something like:
  25. ->
  26. ->LET string=RUN "tail -1 /tmp/somefile"
  27. ->
  28. ->The output I want to catch will always be only one line long.
  29. ->I'm running i4gl version 4 (standard engine).
  30. ->
  31. ->Comments and suggestions gratefully received!
  32. ->
  33. ->Please Email me, as my newsfeed seems to be a bit shakey at 
  34. ->the moment.
  35. ->
  36. ->Thank you!
  37. ->                        -- Pete
  38. ->-- 
  39. ->Pete Miles            uaa1006@dircon.co.uk
  40. ->                ...uknet!dircon!uaa1006
  41.  
  42. Pete,
  43.  
  44. Your best bet seems to be writing a C subroutine that:
  45. 1. runs your command, 
  46. 2. picks up the result,
  47. 3. returns the result as its function value.
  48.  
  49. Here at Martin, we did something similar for 'sum' rather than 'tail', to 
  50. test checksums on files being copied across our coast-to-coast net.  (This 
  51. code is available on request.)
  52.  
  53. If you are using the interpreted (RDS) version of i4gl, then you will need 
  54. to rebuild your runner to include the new subroutine.  If you are using the 
  55. compiled version, just include the compiled subroutine in the list of .o 
  56. files to be linked.  More info on this is in section 1 of volume 1 of the 
  57. 4GL reference manual.
  58.  
  59. Regards,
  60. Alan
  61. +------------------------------+---------------------------------------+
  62. | R. Alan Popiel               | Internet: alan@den.mmc.com            |
  63. | Martin Marietta, LSC         | ( Please note: My opinions do not   ) |
  64. | P.O. Box 179, M/S 5422       | ( represent official Martin policy. ) |
  65. | Denver, Colorado 80201-0179  | Voice: 303-977-9998                   |
  66. +------------------------------+---------------------------------------+
  67.  
  68.