Please Help! Why am I getting this 4gl error???
Posted in 1999
A 4GL program failed to compile with error -4320 ("The symbol 'systables' is not the name of a table in the specified database") on any DEFINE ... RECORD LIKE table.* statement, even though dbaccess could reach the database. Art Kagel first wrongly blamed use of a system catalog table and suggested spelling out the record fields. Jonathan Leffler and Richard Spitz gave the real cause: the DATABASE statement was inside MAIN, making it procedural/runtime-only. Moving DATABASE above MAIN makes it non-procedural so the compiler can read the schema, and LIKE then works (including on systables). Art conceded his answer was wrong.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration
Respectful wrote:
>
> The problem I'm having is as below. It applies to any table I choose. I
> can access this database fine with dbaccess. Please help!
>
> Informix Dynamic Server Version 7.30.UC5, AIX
> INFORMIX-4GL Version 7.20.UE1
>
> main
>
> database mydatabase
>
> call a()
>
> end main
>
> function a()
>
> define r record like systables.*
> |
> | The symbol "systables" is not the name of a table in the
> | specified database.
> | See error number -4320.
> end function
Because systables is a system catalog table the compiler is not permitting
you to use it in a LIKE clause. Just create an explicit RECORD definition
and you can go on from there:
define r record
tabname char(18),
owner char(8),
partnum integer,
tabid integer,
rowsize smallint,
ncols smallint,
nindexes smallint,
nrows integer,
created date,
version integer,
tabtype char(1),
locklevel char(1),
npused integer,
fextsize integer,
nextsize integer,
flags smallint,
site char(18),
dbname char(18)
end record
This is preferred to the LIKE clause anyway. While it is true that if the
table structure changes this version may not compile, it WILL continue to
work as expected until then and while the LIKE version of the code will
continue to compile it may not continue to function as expected if a column
definition changes! At least this way if that drastic a change occurs you
will know about it and minor changes will not break the code.
Art S. Kagel
The problem I'm having is as below. It applies to any table I choose. I
can access this database fine with dbaccess. Please help!
Informix Dynamic Server Version 7.30.UC5, AIX
INFORMIX-4GL Version 7.20.UE1
main
database mydatabase
call a()
end main
function a()
define r record like systables.*
|
| The symbol "systables" is not the name of a table in the
| specified database.
| See error number -4320.
end function
Thanks Art
The problem is if I also have
define a record like mytable.*, for example, I get the same error.
Even if I have a preceding database statement.
Art S. Kagel <kagel@bloomberg.net> wrote in message
news:37AF2B0B.A5CE51EA@bloomberg.net...
> Respectful wrote:
> >
> > The problem I'm having is as below. It applies to any table I choose.
I
> > can access this database fine with dbaccess. Please help!
> >
> > Informix Dynamic Server Version 7.30.UC5, AIX
> > INFORMIX-4GL Version 7.20.UE1
> >
> > main
> >
> > database mydatabase
> >
> > call a()
> >
> > end main
> >
> > function a()
> >
> > define r record like systables.*
> > |
> > | The symbol "systables" is not the name of a table in the
> > | specified database.
> > | See error number -4320.
>
> > end function
>
> Because systables is a system catalog table the compiler is not permitting
> you to use it in a LIKE clause. Just create an explicit RECORD definition
> and you can go on from there:
>
> define r record
> tabname char(18),
> owner char(8),
> partnum integer,
> tabid integer,
> rowsize smallint,
> ncols smallint,
> nindexes smallint,
> nrows integer,
> created date,
> version integer,
> tabtype char(1),
> locklevel char(1),
> npused integer,
> fextsize integer,
> nextsize integer,
> flags smallint,
> site char(18),
> dbname char(18)
> end record
>
> This is preferred to the LIKE clause anyway. While it is true that if the
> table structure changes this version may not compile, it WILL continue to
> work as expected until then and while the LIKE version of the code will
> continue to compile it may not continue to function as expected if a
column
> definition changes! At least this way if that drastic a change occurs you
> will know about it and minor changes will not break the code.
>
> Art S. Kagel
Respectful wrote:
> Thanks Art
>
> The problem is if I also have
>
> define a record like mytable.*, for example, I get the same error.
>
> Even if I have a preceding database statement.
>
> Art S. Kagel <kagel@bloomberg.net> wrote:
> > Respectful wrote:
> > > The problem I'm having is as below. It applies to any table
> > > I choose. I can access this database fine with dbaccess.
> > >
> > > Informix Dynamic Server Version 7.30.UC5, AIX
> > > INFORMIX-4GL Version 7.20.UE1
> > >
> > > main
> > >
> > > database mydatabase
> > >
> > > call a()
> > >
> > > end main
> > >
> > > function a()
> > >
> > > define r record like systables.*
> > > |
> > > | The symbol "systables" is not the name of a table in the
> > > | specified database.
> > > | See error number -4320.
> >
> > > end function
> >
> > Because systables is a system catalog table the compiler is not
> > permitting you to use it in a LIKE clause. Just create an
> > explicit RECORD definition and you can go on from there:
The bigger problem is that the database statement is inside the MAIN
function, not outside. That makes it into a procedural database
statement. If it was before MAIN, it would be a non-procedural
database statement. The database would still be selected when the
program started, but it would also be accessed at compile time which
allows you to write LIKE declarations.
I don't think there's any limit on using the system catalogue in a
LIKE clause, but I could have forgotten such minutiae.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN
#include <disclaimer.h>
thanks guys! was that the dumbest question of the day?
Respectful <please_reply@newsgroup.com> wrote in message
news:7on8r3$5da@newsstand.cit.cornell.edu...
> The problem I'm having is as below. It applies to any table I choose. I
> can access this database fine with dbaccess. Please help!
>
> Informix Dynamic Server Version 7.30.UC5, AIX
> INFORMIX-4GL Version 7.20.UE1
>
>
> main
>
> database mydatabase
>
> call a()
>
> end main
>
> function a()
>
> define r record like systables.*
> |
> | The symbol "systables" is not the name of a table in the
> | specified database.
> | See error number -4320.
>
> end function
>
>
>
Respectful wrote:
>
> thanks guys! was that the dumbest question of the day?
Naw, but it did garner the dumbest answer of the day <he admits sheepishly>.
:-(
Jonathan you have forgotten nothing, but I seem to have create new and
interesting memories in my dotage. There is no problem at all with using
system tables in LIKE clauses as 'Respectful' has discovered.
Art S. Kagel
> Respectful <please_reply@newsgroup.com> wrote in message
> news:7on8r3$5da@newsstand.cit.cornell.edu...
> > The problem I'm having is as below. It applies to any table I choose. I
> > can access this database fine with dbaccess. Please help!
> >
> > Informix Dynamic Server Version 7.30.UC5, AIX
> > INFORMIX-4GL Version 7.20.UE1
> >
> >
> > main
> >
> > database mydatabase
> >
> > call a()
> >
> > end main
> >
> > function a()
> >
> > define r record like systables.*
> > |
> > | The symbol "systables" is not the name of a table in the
> > | specified database.
> > | See error number -4320.
> >
> > end function
> >
> >
> >
"Art S. Kagel" wrote: > Respectful wrote: > > main > > > > database mydatabase > > > > call a() > > > > end main > > > > function a() > > > > define r record like systables.* > > | > > | The symbol "systables" is not the name of a table in the > > | specified database. > > | See error number -4320. > > > end function > > Because systables is a system catalog table the compiler is not permitting > you to use it in a LIKE clause. Just create an explicit RECORD definition > and you can go on from there: I beg to differ, Art. The problem is not with using "systables", but with the location of the "database mydatabase" statement. Since it is in the "main" function of the program, it is local to that function and cannot be used by other functions for purposes of using the LIKE syntax. The "database mydatabase" statement must be the first statement of the program (or module? not quite sure about that), preceding any "main" or "function" definitions. Then the LIKE syntax will work like a charm. Regards, Richard -- +--------------------------+------------------------------------------+ | Dr. Richard Spitz | INTERNET: spitz@ana.med.uni-muenchen.de | | EDV-Gruppe Anaesthesie | Tel : +49-89-7095-6110 | | Klinikum Grosshadern | FAX : +49-89-7095-6420 <-- NEW!!! | | 81366 Munich, Germany | GSM : +49-172-8933578 | +--------------------------+------------------------------------------+
In article <7op5o8$jqt@newsstand.cit.cornell.edu>, Respectful <please_reply@newsgroup.com> wrote: >thanks guys! was that the dumbest question of the day? The day ain't over yet... [-: