Immediate help required on SYSTEM command
Posted in 2000
Topics: Error Codes & Troubleshooting, Platform-Specific Issues
Hi, I'm trying to call an executable using SYSTEM command in a stored procedure. My executable takes a command line argument. I have concatenated this command line argument to the executable name and calling the SYSTEM command. DEFINE str char(20); LET str = 'xyz'; SYSTEM 'myexecutable' || str; but when i execute this procedure, I'm always getting error code 668. When I run the executable from command line prompt, it works fine. I have double checked that my PATH and other informix related variables are set properly. I'm working on Informix 7.3 on AIX unix. Need your help in resolving this experts, Thanks, Vamsee. Sent via Deja.com http://www.deja.com/ Before you buy.
vamsee_2000@my-deja.com wrote in message <8o7aia$8sv$1@nnrp1.deja.com>...
>Hi, I'm trying to call an executable using SYSTEM command in a stored
>procedure. My executable takes a command line argument. I have
>concatenated this command line argument to the executable name and
>calling the SYSTEM command.
> DEFINE str char(20);
> LET str = 'xyz';
> SYSTEM 'myexecutable' || str;
SYSTEM 'myexecutable ' || str,
^
add a space after the name of
the executable.
Is this on a system which supports truss?
If so use
onstat -g glo
to list the process id's of the oninit processes.
It will not be the lio,pio,aio or net vp's which actually run the system
command.
For the others try:-
truss -aef -v all -o /tmp/1 -p <process-id>
when you run the stored procedure and look for fork()/exec()
system calls. Eventually you should be able to work out which
VP is running the program (I think it is either the misc or adm VPS)
>but when i execute this procedure, I'm always getting error code 668.
>When I run the executable from command line prompt, it works fine.
>I have double checked that my PATH and other informix related variables
>are set properly. I'm working on Informix 7.3 on AIX unix.
>Need your help in resolving this experts,
>Thanks,
>Vamsee.
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
>>>>> " " == vamsee 2000 <vamsee_2000@my-deja.com> writes: > Hi, I'm trying to call an executable using SYSTEM command in a > stored procedure. My executable takes a command line > argument. I have concatenated this command line argument to the > executable name and calling the SYSTEM command. DEFINE str > char(20); LET str = 'xyz'; SYSTEM 'myexecutable' || str; but > when i execute this procedure, I'm always getting error code > 668. When I run the executable from command line prompt, it > works fine. I have double checked that my PATH and other > informix related variables are set properly. I'm working on > Informix 7.3 on AIX unix. Need your help in resolving this > experts, Thanks, Vamsee. You don't mention if the PATH is set correctly to find this script *before* the INFORMIX server is started. Replace your script that you are attempting to call in your procedure with another one, say /tmp/printoutenv The executable file /tmp/printout looks like this: /bin/env | /bin/sort > /tmp/printoutenv.results Run your procedure. Look at the "results" file, can INFORMIX find the original script with this environment? HTH, Mark -- "Women prefer Democrats to men." -- Representative Tony Coelho (D-California)
vamsee_2000@my-deja.com wrote: > > Hi, I'm trying to call an executable using SYSTEM command in a stored > procedure. My executable takes a command line argument. I have > concatenated this command line argument to the executable name and > calling the SYSTEM command. > DEFINE str char(20); > LET str = 'xyz'; > SYSTEM 'myexecutable' || str; Should this be: SYSTEM 'myexecutable ' || str; Also note that this will run with the engine's environment and permissions NOT the user's! This will often effect whether it will run or not. If a different environment is needed have the SYSTEM command run a script instead the sets up the environment and/or PATH. Art S. Kagel > but when i execute this procedure, I'm always getting error code 668. > When I run the executable from command line prompt, it works fine. > I have double checked that my PATH and other informix related variables > are set properly. I'm working on Informix 7.3 on AIX unix. > Need your help in resolving this experts, > Thanks, > Vamsee. > > Sent via Deja.com http://www.deja.com/ > Before you buy.
Thanks everybody, I noticed that the enivironment i get at command line prompt (using command 'set' in ksh) is different from the one my stored procedure using. I'm trying set the environement correctly from inside the stored procedure by calling a shell script. Thanks, Vamsee. Sent via Deja.com http://www.deja.com/ Before you buy.