Results 1 to 5 of 5

Thread: Sqlerror 818

  1. #1
    Join Date
    Feb 2009
    Posts
    12

    Unanswered: 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

  2. #2
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    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.

  3. #3
    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.

  4. #4
    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).

  5. #5
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    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..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •