Re: unload in a program 4gl
Posted in 1999
On Wed, 24 Feb 1999, EUROTELA,S.A. wrote:
>I need to execute a [unload] from a program 4gl but it give error
>could you help me?
>The sentences that I use are:
> LET fichero=ascii 34,"datos.dat",ascii 34
> LET acc = " UNLOAD TO ",fichero clipped ," DELIMITER ",ascii 34,"|",ascii
>34,
> " SELECT * FROM gmacli01f01 "
> PREPARE e_acc FROM acc
> EXECUTE e_acc
> FREE e_acc
>
>What is wrong?... Thanks
UNLOAD is an I4GL statement, not an SQL statement, so you can't prepare
it. You can, however, write the SELECT part as a string, or as a direct
SELECT statement, so you could write:
LET fichero = "datos.dat"
UNLOAD TO fichero DELIMITER "|" SELECT * FROM gmacli01f01
Or, if you want the SELECT statement controlled dynamically, And the
delimiter to specified by a variable, you can do that, too:
LET sel_str = "SELECT * FROM gmacli01f01"
LET fichero = "datos.dat"
LET delimit = "|"
UNLOAD TO fichero DELIMITER delimit sel_str
Have fun.
Yours,
Jonathan Leffler (jleffler@informix.com) #include <wish/I/was/skiing.h>
Guardian of DBD::Informix v0.60 (v0.61_02) -- http://www.perl.com/CPAN
Informix IDN for D4GL & Linux -- http://www.informix.com/idn