Re: System Calls in stored procedures SE 7.2
Posted in 2000
Topics: Stored Procedures & SPL, Server Administration, Platform-Specific Issues
Kate Juliff wrote: > > I'm running SE 7.2 on AIX 4.3 > > I can created a stored procedure that makes a system call but cannot > give an argument to the system call. I have tried using the example in > the manual but it gives an error. > > Has any one been successful in doing something like this in a sp. > > system "echo" "blah" > As far as I know, you can only pass a single string or a string variable to a system command. What we do is to concatentate all required information into a string variable and SYSTEM the variable, e.g.. -------------------------------------------------------- create procedure "informix".jwc_test() define p_cmd char(512); define p_arg char(10); let p_arg = ' -rt '; let p_cmd = ' ll '||p_arg||' /home/informix > /home/informix/tmp11211' ; system p_cmd; end procedure; ------------------------------------------------------------ Remember, a SP probably will not have any active environment variables. Assume it knows nothing about current directory, etc. -- John Carlson Informix DBA WHSmith USA #include std_disclaimer.h /* These are my opinions, not my company's opinion */
In article <38ECAB5B.3837A8D2@bellsouth.net>, "Carlson@WHSmith" <carlson1@bellsouth.net> wrote: > As far as I know, you can only pass a single string or a string variable > to a system command. What we do is to concatentate all required > information into a string variable and SYSTEM the variable <CUT> Thanks. I got it working but now I have a more complicated problem. I have a db on my AIX machine. This db collects data from old CISAM files on a regular basic. I have some C ESQL programs that do this. They read the CISAM files and load the resulting data into my Informix DB. Now, I have written some stored procedures which call the programs compiled from C, ESQL and CISAM libraries. They all work OK. I can execute a sp that goes and fetches data from the CISAM files and loads it in to the db tables. BUT - I also need access to this data from an NT workstation. So using ODBC I call the sp on the AIX system. I can execute simple sps this way, but of course, as I'm connecting via ODBC with an Informix datasource, it gets horribly confused when it, in turn executes a program that has db calls. The sps work fine when executed on the AIX machine. But if they contain system calls to invioke ESQL-C-compiled programs they do not. I've set the environment variables etc. But when the program called from the sp tries to do a call to the db that the NT machine has connected to, it hangs. Has anyone any suggestions as to what I can try? Kate Sent via Deja.com http://www.deja.com/ Before you buy.