Re: SPL/environment variables (and an apology)
Posted in 1996
This is a multi-part message in MIME format. --------------426DEB415A5008BC13714243 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Richard Thomas wrote: > > Hi everyone, > > I've written a couple of Stored Procedures that run an ACE report > that sends its output to printer. They compile OK, and run without any > errors in the debug file, but nothing comes out of the printer. This had > me foxed for a while, but yesterday I added a 'system "env >> > debugfile"' to one of them, and the environment bears no relation to my > environment. So, my question is, how can I get environment variables > into the SP. I'm fine with general ones like INFORMIXDIR - just source > a command file, but what about user-specific ones like DBPRINT? As far > as I can see, there are 2 alternatives: > > 1. Change the ACE report so that it outputs to a file, and run the SP > and print the file from a shell script. > > 2. Call a shell script from the SP which sets the DBPRINT variable: > > #!/bin/csh > grep DBPRINT ~/.login >> tfile > source tfile > > I prefer option 2, but it's still messy - isn't there an easier way to > do this? > > TIA, > > Richard. > > Now for the apology. If any of you received bounced mail from my > address when you posted to the list recently, I'm sorry. My company > is in the process of relocation, and all our unix servers (except the > internet firewall) were moved the weekend before last. "Fear not", said > our sysadmin, "Any mail received will just sit on the firewall machine > until the other servers are up and running". WRONG!!! Servers came up > Monday lunchtime and surprise, surprise, I'd got no mail between 5.30pm > Thurday and 12.30pm Monday. Last Friday they moved the firewall machine > without telling us, so that gave us another few hours downtime. --------------426DEB415A5008BC13714243 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="richard.txt" Hi Richard, I think that you neither have to change your ACE Report nor do you have to write yet another shell script. The Informix Server simply changes the user-id of this shell to the one of the user who executed the procedure and invokes a new shell. I've made a test with my korn-shell, setting an environment variable once in the .profile and once in the .kshrc file. Well, both versions work. Maybe the reason is your C-shell. If there is no other way, you should place the setting of additional environment variables into your procedure like shown below. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=- create procedure DirectPrnt( dest_vc char(15) ) define call_vc char(90); let call_vc = "/bin/sh -c '" || 'DBPRINT="lp -d' || dest_vc || '";export DBPRINT;sacego -q acefile.ace'; system call_vc; end procedure; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=- Stefan. ************************************************************** * SEB Weideneder / Munich * e-mail: stefan@weideneder.de * Fax: +49 89 3617015 ************************************************************** --------------426DEB415A5008BC13714243--