Re: 4GL RUN command question
Posted in 1998
>Candy McCall wrote: > >Billy Wheeler asked for someone more awake. Here goes... ZZZzzzz... > >> >> Within a 4GL program, I want to run a shell >> script which will calculate an integer value. >> I then want to read that integer value into >> the 4GL program. Is it possible to >> read that value using the "RUN shell_script RETURNING >> integer_variable" command? > >The shell will return its status to 4GL (see manual). It does this with >the parameter to the exit command. As Billy says, it can be 0 to 255, >with 0 by convention meaning OK and the rest an error in the shell >script. > >> >> I've also thought of setting a value in a shell >> environment variable in the shell script and >> then reading the value using fgl_getenv(), but since >> the shell_script is a child process, I didn't think I could >> set a shell environment variable of the parent process >> (the 4GL program). > >Correct. A moment's thought will reveal the awful security risk if you >could do this. > >> >> A third way I've thought of is to place the integer variable >> in an ASCII file, then using the LOAD command, load >> the value into a temporary table. This is not the most >> elegant way of getting that value, but it will work. >> Does anyway know of a better way? > >Not elegant and not quick, as you will need two database connections. > >You could write to a file in the shell and then read (or load) that from >the 4GL caller - only one connection. There are file-reading functions >in the IIUG archives. > >> >> Thanks in advance, >> Candy >> -- >> Candy McCall >> ONLINE Computing, Inc. >> (candym@olcinc.com) > >Returning to the beginning, why do you want to do this? Calling a shell >script from 4GL just to do some sums seems strange. Is there some other >way? > >If you want a general expression evaluation, there has been some >discussion of that recently - see the usual dejanews. It occurs to me >that you could embed a tcl interpreter into your 4GL program. Don't ask >me how it's done, I just have a feeling that's what tcl was designed >for. Anyone else know more than I do (silly question)? > >-- >Peter Lancashire >Information Systems Specialist, Bayer plc >Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK >Tel: +44-1635-562258, Fax: +44-1635-562281 >--- >If all else fails, read the instructions and the release notes. >Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/ >--- > I'm trying to write a simple routine to check for the number of concurrent users running the application using the ps command. Candy -- Candy McCall ONLINE Computing, Inc. (candym@olcinc.com)