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

  1. Path: sparky!uunet!olivea!gossip.pyramid.com!pyramid!infmx!proberts
  2. From: proberts@informix.com (Paul Roberts)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re: Catching output from RUN command (4GL)
  5. Message-ID: <1993Jan24.222617.19612@informix.com>
  6. Date: 24 Jan 93 22:26:17 GMT
  7. References: <C1D1pp.AA0@dircon.co.uk>
  8. Sender: news@informix.com (Usenet News)
  9. Organization: Informix Software, Inc.
  10. Lines: 36
  11.  
  12. In article <C1D1pp.AA0@dircon.co.uk> uaa1006@dircon.co.uk (Peter Miles) writes:
  13. >
  14. >Does anyone know if there is any way of capturing the output 
  15. >of a command run by the 4GL RUN command into an Informix 4GL
  16. >variable?
  17. >
  18. >EG I want to say something like:
  19. >
  20. >LET string=RUN "tail -1 /tmp/somefile"
  21. >
  22. >The output I want to catch will always be only one line long.
  23. >I'm running i4gl version 4 (standard engine).
  24. >
  25. >Comments and suggestions gratefully received!
  26.  
  27. You can always do something (kind of klugey!) like this :
  28.  
  29. run "tail -1 /tmp/somefile > /tmp/t1"
  30. run "paste -d'|' /tmp/t1 /dev/null > /tmp/t2"
  31.  
  32. ### (i.e. stick a "|" onto the end of your one-line file)
  33.  
  34. create temp table temp1 ( a char(80) )
  35.  
  36. load from "/tmp/t2" insert into temp1
  37.  
  38. select a
  39.   into string_var
  40.   from temp1
  41.  
  42. drop table temp1
  43. run "rm /tmp/t1 /tmp/t2"
  44.  
  45. I have done this kind of thing, and it does work. 
  46.  
  47. Paul
  48.