Re: Catching output from RUN command (4GL)
Answered: amber (solid confidence) — Message quotes the full original question about capturing 4GL RUN command output into a variable and gives a specific, workable answer (C subroutine returning a function value, with RDS vs. compiled-runner notes); not confirmed by the asker.
Advisory only.
Posted in 1993
->From: uaa1006@dircon.co.uk (Peter Miles) ->Subject: Catching output from RUN command (4GL) ->Date: Sun, 24 Jan 1993 13:34:36 GMT ->Reply-To: uaa1006@dircon.co.uk (Peter Miles) -> ->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? -> ->EG I want to say something like: -> ->LET string=RUN "tail -1 /tmp/somefile" -> ->The output I want to catch will always be only one line long. ->I'm running i4gl version 4 (standard engine). -> ->Comments and suggestions gratefully received! -> ->Please Email me, as my newsfeed seems to be a bit shakey at ->the moment. -> ->Thank you! -> -- Pete ->-- ->Pete Miles uaa1006@dircon.co.uk -> ...uknet!dircon!uaa1006 Pete, Your best bet seems to be writing a C subroutine that: 1. runs your command, 2. picks up the result, 3. returns the result as its function value. Here at Martin, we did something similar for 'sum' rather than 'tail', to test checksums on files being copied across our coast-to-coast net. (This code is available on request.) If you are using the interpreted (RDS) version of i4gl, then you will need to rebuild your runner to include the new subroutine. If you are using the compiled version, just include the compiled subroutine in the list of .o files to be linked. More info on this is in section 1 of volume 1 of the 4GL reference manual. Regards, Alan +------------------------------+---------------------------------------+ | R. Alan Popiel | Internet: alan@den.mmc.com | | Martin Marietta, LSC | ( Please note: My opinions do not ) | | P.O. Box 179, M/S 5422 | ( represent official Martin policy. ) | | Denver, Colorado 80201-0179 | Voice: 303-977-9998 | +------------------------------+---------------------------------------+