If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Sqlerror 818

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-09, 05:25
Yan302 Yan302 is offline
Registered User
 
Join Date: Feb 2009
Posts: 12
Sqlerror 818

Hi all,

I've got sql error code 818 and I don't understand why.

Here is the sequence of commands I ran:

("cl" is the compiler of Microsoft Visual Studio)

db2 connect to sample

db2 prep gdk_PERSON.sqc bindfile
db2 bind gdk_PERSON.bnd
cl -Zi -LD /DDKTARGET_NT -I. -I../runtime -I/include -c gdk_PERSON.c

db2 prep gdk_PERSONZ.sqc bindfile
db2 bind gdk_PERSONZ.bnd
cl -Zi -LD /DDKTARGET_NT -I. -I../runtime -I/include -c gdk_PERSONZ.c

db2 prep gdk_POLY.sqc bindfile
db2 bind gdk_POLY.bnd
cl -Zi -LD /DDKTARGET_NT -I. -I../runtime -I/include -c gdk_POLY.c

db2 prep gdk_PZZY.sqc bindfile
db2 bind gdk_PZZY.bnd
cl -Zi -LD /DDKTARGET_NT -I. -I../runtime -I/include -c gdk_PZZY.c

db2 prep gdk_tables.sqc bindfile
db2 bind gdk_tables.bnd
cl -Zi -LD /DDKTARGET_NT -I. -I../runtime -I/include -c gdk_tables.c

lib /OUT:gdk.lib gdk_PERSON.obj gdk_PERSONZ.obj gdk_POLY.obj gdk_PZZY.obj gdk_tables.obj

cl -Zi -LD /DDKTARGET_NT /MD /Fedbntry.dll ../runtime/dk_dllentry.obj gen/runtime/gdk.lib ../lib/datakom.lib "C:\Program Files\IBM\SQLLIB\lib\db2api.lib"
(which create a dll named dbntry.dll)


Then, I've got a COBOL program (compiled with Microfocus products) that uses this dll making access to the database. This database contains 4 tables: PERSON, PERSONZ, POLY and PZZY).
If in the COBOL program I run a command on the PERSON table, I got sqlcode error 818 ; but if I run the same command on table PERSONZ it goes well.

I found that this error occurs when the timestamps generated by the precompiler and the "binder" are not the same so I've tried to precompile/bind/compile/link again, but only things that refer to PERSON:

db2 prep gdk_PERSON.sqc bindfile
db2 bind gdk_PERSON.bnd
cl -Zi -LD /DDKTARGET_NT -I. -I../runtime -I/include -c gdk_PERSON.c
lib /OUT:gdk.lib gdk_PERSON.obj gdk_PERSONZ.obj gdk_POLY.obj gdk_PZZY.obj gdk_tables.obj
cl -Zi -LD /DDKTARGET_NT /MD /Fedbntry.dll ../runtime/dk_dllentry.obj gen/runtime/gdk.lib ../lib/datakom.lib "C:\Program Files\IBM\SQLLIB\lib\db2api.lib"

and so it goes well on table PERSON but no more on table PERSONZ.

I'm completely disappointed about this problem. Does someone see a trouble in the command sequence I used?

Any idea or help is welcome.

Thanks in advance,

Yan
Reply With Quote
  #2 (permalink)  
Old 02-09-09, 05:37
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
How do you compile & run the COBOL?

My guess is "int" or "gnt". Try to compile the cobol to an object and link this together with the C dll's to 1 ".exe".
Another option, more complex I'm afraid, if to link your modules into your MF runtime environment.
Reply With Quote
  #3 (permalink)  
Old 02-09-09, 06:37
Yan302 Yan302 is offline
Registered User
 
Join Date: Feb 2009
Posts: 12
Thanks for your answer.

the COBOL code is compile and execute with :

ccbl32 -Ga bpre.cob
crun32.exe -b bpre.acu

The link with the dll is not necessary. At the execution if we have a call to "DBNTRY" and that there is no DBNTRY procedure in the cobol code, a dbntry.dll file is searched by the runtime of microfocus.

The same sequence of commands has been tested with oracle and mySql without error. So it seems that the problem come from a DB2 specificity that I don't know.
Reply With Quote
  #4 (permalink)  
Old 02-10-09, 05:18
Yan302 Yan302 is offline
Registered User
 
Join Date: Feb 2009
Posts: 12
Hi all,

I've found the problem. The package names in DB/2 are limited to 8 characters. So there were a conflit between gdk_PERS(ON) and gdk_PERS(ONZ).
Reply With Quote
  #5 (permalink)  
Old 02-10-09, 17:04
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Quote:
Originally Posted by Yan302
The package names in DB/2 are limited to 8 characters.
Asif you're back on a S/36 coding RPG..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On