RE: LOAD In 4GL Problems
Posted in 2005
Art & Navdeep-
Navdeep never said what the behavior of his application was; he
just said "it did not work." I see no reason that his original syntax
without the prepare statement should not have worked, unless there was
another problem interfering with it. Navdeep: did the app give you any
error messages? Did you check the contents of g_filename to make sure
that the name of the load file actually was stored there? Is the file
in the same directory as the program trying to load it? Did you make
sure to execute this statement before the LOAD statement:
LET g_filename = ARG_VAL(1)
If not, the reason it won't work is because there is nothing in
g_filename for the app to load from. If the load file is not in the
same directory, you will need to supply a complete pathname and user a
bigger variable for g_filename. Also, assuming that g_filename is a
global, it may be getting reset after the ARG_VAL() loads it. It may
help to see a bigger section of your original (without the prepare)
code, i.e.: Where the g_filename is loaded, where the temp table is
created, etc.
--EEM
> -----Original Message-----
> From: ART KAGEL, BLOOMBERG/ 731 LEXIN [mailto:KAGEL@bloomberg.net]
> Sent: Wednesday, February 23, 2005 2:39 PM
> To: informix-list@iiug.org
> Subject: Re: LOAD In 4GL Problems
>
>
> How about this:
>
> LET mover = "ln -s ", g_filename, " tmpname"
> RUN mover
>
> LOAD FROM tmpname INSERT INTO t_sp>
> LET cleanup = "rm tmpname"
> RUN cleanup
>
> ...
>
> Art S. Kagel
>
> ----- Original Message -----
> From: Navdeep Virk <nvirk@msn.com>
> At: 2/22 21:36
>
> > Art and all ,
> >
> > I tried to load rows into a temp table in a 4GL program ,where I am
> passing
> > the filename as an argument .
> > So I used the following syntax.
> > DEFINE g_filename CHAR(10)
> > .....
> > LOAD FROM g_filename INSERT INTO t_sp ,where g_filename is a char> variable
> > and t_sp is a Temp table.
> >
> > This did not work ,
> >
> > So I tried
> >
> > LET g_stmt = "LOAD FROM ",g_filename, " INSERT INTO t_sp "
> >
> > PREPARE p_curs FROM g_stmt
> > EXECUTE p_curs
> >
> > did not work ,
> >
> > the third approach was
> >
> > LET g_stmt = "LOAD FROM ? INSERT INTO t_sp "
> > PREPARE p_curs FROM g_stmt
> > EXECUTE p_curs USING g_filename
> >
> > This also did not work .
> >
> > I can of course hard code the name of the load file ,also I can try
> fglgets
> > to read in the rows one by one to solve the problem.
> >
> > But my question is that is there no way the "load into a temp table"
> > achieved by passing a file as an argument and using prepare or
otherwise
> >
> >
> > TIA.
> >
> > Navdeep
>
>
>
> sending to informix-list
sending to informix-list