Re: Catching output from RUN command (4GL)
Posted in 1993
Quoting Paul Roberts... } } In article <C1D1pp.AA0@dircon.co.uk> uaa1006@dircon.co.uk (Peter Miles) writes: } > } >Does anyone know if there is any way of capturing the output } >of a command run by the 4GL RUN command into an Informix 4GL } >variable? } > } } You can always do something (kind of klugey!) like this : } [ Interesting kludge deleted... ] If you want to stay with pure 4GL, Paul's idea is perfect. If you aren't afraid of C, you could do something like this: Mind you, this pseudo code (but you'll get the idea) runit(arg) { FILE *pp; char buf[513], txt[257]; popquote(buf, sizeof(buf)); /* Pop the run string off the stack */ pp = popen(buf, "r"); /* Open a pipe for read w/ run string */ fgets(txt, sizeof(txt), pp); /* Read a line from the pipe */ pclose(pp); /* Close the pipe */ retquote(txt); /* Push the txt string onto the stack */ return(1); /* Tell 4GL that you returned 1 arg */ } DAS -- David Snyder @ Snide Computer Services - Folcroft, PA Current Release is db4glgen-3.9 UUCP: ..!uunet!das13!dave INTERNET: dave.snyder@snide.com