system - SPL
Posted in 2014
Topics: Stored Procedures & SPL
IDS 11.70.fc3xc Aix 7.1 Is there an easy way to pull back the output of a 'system' command in a stored procedure .. ie... system('ls *|wc -l'); Obviously that isn't what I would really want to do .. but if I can make that work .. then what I really want to do might ... thanks for any help ...
for more clarity ... let p_count=system('ls *|wc -l'); Obviously that syntax doesn't work ... but is there something that might ... From: "Peter_Logan@spartanstores.com" <Peter_Logan@spartanstores.com> To: ids@iiug.org, Date: 01/15/2014 12:36 PM Subject: system - SPL [32227] Sent by: ids-bounces@iiug.org IDS 11.70.fc3xc Aix 7.1 Is there an easy way to pull back the output of a 'system' command in a stored procedure .. ie... system('ls *|wc -l'); Obviously that isn't what I would really want to do .. but if I can make that work .. then what I really want to do might ... thanks for any help ... ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum.
You can have the command massage its output to look like a delimited file and create an external table to see the results. That won't work if multiple users need to run the command though. Alternative would be to have the command insert the results into a table that can be read by the calling procedure. You might key the result row with the procedure's session id - passed out on the command line that's been executed. Multi-line returns could be keyed by session id and a SERIAL column so the procedure can read the lines in order. Art Art S. Kagel, Principal Consultant Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Wed, Jan 15, 2014 at 12:36 PM, Peter_Logan@spartanstores.com < Peter_Logan@spartanstores.com> wrote: > IDS 11.70.fc3xc > Aix 7.1 > > Is there an easy way to pull back the output of a 'system' command in a > stored procedure .. ie... > > system('ls *|wc -l'); > > Obviously that isn't what I would really want to do .. but if I can make > that work .. then what I really want to do might ... > > thanks for any help ... > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --001a113406ccf2ce0504f006020d