By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,236 Members | 1,458 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,236 IT Pros & Developers. It's quick & easy.

DB2 Precompiler Problems !?

P: n/a
Hi Folks,

My Problem is:

My SQL Statement Structure:

SELECT TABLEA.FIELDA,
TABLEA.FIELDB,
TABLEA.FIELDC,
TABLEA.FIELDD,
TABLEA.FIELDE,
TABLEA.FIELDF,
TABLEA.FIELDG,
TABLEA.FIELDH,
TABLEA.FIELDI,
TABLEA.FIELDJ,
TABLEB.FIELDA,
TABLEA.FIELDK
INTO :mystruct->FIELDA,
:mystruct->FIELDB,
:mystruct->FIELDC,
:mystruct->FIELDD,
:mystruct->FIELDE,
:mystruct->FIELDF,
:mystruct->FIELDG,
:mystruct->FIELDH,
:mystruct->FIELDI,
:mystruct->FIELDJ,
:mystruct->FIELDK,
:mystruct->FIELDL
FROM TABLEA, TABLEB
WHERE TABLEB.FIELDM = :mystruct->FIELDM
AND TABLEA.FIELDH = TABLEB.FIELDA
AND TABLEA_DELKEY = 0
AND TABLEA_SYSSTATUS = 0
AND TABLEB_DELKEY = 0
AND TAVLEB_SYSSTATUS = 0
ORDER BY TABLEA.FIELDB DESC
FETCH FIRST ROW ONLY;

The Pc Db2 Compiler has no Problem Compiling this Statement
but the HOST (3270) DB2 Precompiler is not able to compile this
statement
Both Plattforms run DB2 Version 7 the Programmcode is written in C
Does anybody know why the 3270 Precompiler is unable to Compile this
statement ?

Thanks Rainer

Aug 10 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a

Can you give me the error message ?

Thanks Michael

Aug 10 '06 #2

P: n/a

Micha schrieb:
Can you give me the error message ?

Thanks Michael
Of Course:

CCN5256 (S) A parameter of type "char *" cannot be initialized with an
expression of type "unsigned char [5]".
line 3416.11: CCN6205 (I) The error occurred while converting to
parameter 1 of "strcpy(char *, const char *)".

line 3416 in my cpp source
is the SQL-Statement and with an other guy we found out that the 3270
DB2 Precompiler does not allow a Select INTO Statement with Order By

Same statement witout order by and fetch (no Compile Errors), but works
not correct

Aug 10 '06 #3

P: n/a

RainerF schrieb:
Micha schrieb:
Can you give me the error message ?

Thanks Michael

Of Course:

CCN5256 (S) A parameter of type "char *" cannot be initialized with an
expression of type "unsigned char [5]".
line 3416.11: CCN6205 (I) The error occurred while converting to
parameter 1 of "strcpy(char *, const char *)".

line 3416 in my cpp source
is the SQL-Statement and with an other guy we found out that the 3270
DB2 Precompiler does not allow a Select INTO Statement with Order By

Same statement witout order by and fetch (no Compile Errors), but works
not correct
I'm not sure, but it can be possible, that the precompiler on the host
don't understand the ">"-sign in the name of your host variables. Maybe
illegal?!
Try it with other name.

Aug 10 '06 #4

P: n/a

Micha schrieb:
RainerF schrieb:
Micha schrieb:
Can you give me the error message ?
>
Thanks Michael
Of Course:

CCN5256 (S) A parameter of type "char *" cannot be initialized with an
expression of type "unsigned char [5]".
line 3416.11: CCN6205 (I) The error occurred while converting to
parameter 1 of "strcpy(char *, const char *)".

line 3416 in my cpp source
is the SQL-Statement and with an other guy we found out that the 3270
DB2 Precompiler does not allow a Select INTO Statement with Order By

Same statement witout order by and fetch (no Compile Errors), but works
not correct

I'm not sure, but it can be possible, that the precompiler on the host
don't understand the ">"-sign in the name of your host variables. Maybe
illegal?!
Try it with other name.
i don't think so
this statement without order By and Fetch Compiles on the 3270
Environment without Problems,
Other SQL Like

OPEN CURSOR .... WITH HOLD FOR
SELECT ........
FROM ........
WHERE .......
ORDER BY

FETCH .....
INTO

also work fine

it seems that the generated Code is the Problem and that the PC
Precompiler on the Windowsplattform is working different to the 3270
PRECOMPILER.
But only if I try the Combination with INTO and ORDER BY !!!!

Aug 10 '06 #5

P: n/a
"RainerF" <ra*****************@chello.atwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
i don't think so
this statement without order By and Fetch Compiles on the 3270
Environment without Problems,
Other SQL Like

OPEN CURSOR .... WITH HOLD FOR
SELECT ........
FROM ........
WHERE .......
ORDER BY

FETCH .....
INTO

also work fine

it seems that the generated Code is the Problem and that the PC
Precompiler on the Windowsplattform is working different to the 3270
PRECOMPILER.
But only if I try the Combination with INTO and ORDER BY !!!!
A fetch with static SQL into a host variables can only retrieve one row, so
the precompiler probably thinks the ORDER BY is redundant (it does not
understand that you limited the number of rows fetched by the FETCH FIRST 1
ROW ONLY).

If you convert this to a cursor with ORDER BY and then do one fetch, it
should work OK.
Aug 10 '06 #6

P: n/a

Mark A schrieb:
"RainerF" <ra*****************@chello.atwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
i don't think so
this statement without order By and Fetch Compiles on the 3270
Environment without Problems,
Other SQL Like

OPEN CURSOR .... WITH HOLD FOR
SELECT ........
FROM ........
WHERE .......
ORDER BY

FETCH .....
INTO

also work fine

it seems that the generated Code is the Problem and that the PC
Precompiler on the Windowsplattform is working different to the 3270
PRECOMPILER.
But only if I try the Combination with INTO and ORDER BY !!!!

A fetch with static SQL into a host variables can only retrieve one row, so
the precompiler probably thinks the ORDER BY is redundant (it does not
understand that you limited the number of rows fetched by the FETCH FIRST 1
ROW ONLY).

If you convert this to a cursor with ORDER BY and then do one fetch, it
should work OK.
Yes I think so too, and will try it today, but i still do not
understand why the PC Precompiler has no Problems, if thats an Problem
it should be a Problem on both Compilers and not only on one or it
sohould work on both Compilers or ?

Aug 11 '06 #7

P: n/a
"RainerF" <ra*****************@chello.atwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
>
Yes I think so too, and will try it today, but i still do not
understand why the PC Precompiler has no Problems, if thats an Problem
it should be a Problem on both Compilers and not only on one or it
sohould work on both Compilers or ?
The DB2 for z/OS precompiler was written at the IBM software lab in Silicon
Valley (formerly known as the Santa Teresa Lab), and the DB2 LUW precompiler
was written at the IBM software lab in Toronto (and prior to that, at labs
in Austin, and Boca Raton).

DB2 for z/OS and DB2 for LUW are different products, but they try to
maintain consistency at the DML level. You might want to open a PMR on this
to see if IBM is willing to fix it (but probably not in time for your
requirements).
Aug 11 '06 #8

P: n/a

Mark A schrieb:
"RainerF" <ra*****************@chello.atwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...

Yes I think so too, and will try it today, but i still do not
understand why the PC Precompiler has no Problems, if thats an Problem
it should be a Problem on both Compilers and not only on one or it
sohould work on both Compilers or ?

The DB2 for z/OS precompiler was written at the IBM software lab in Silicon
Valley (formerly known as the Santa Teresa Lab), and the DB2 LUW precompiler
was written at the IBM software lab in Toronto (and prior to that, at labs
in Austin, and Boca Raton).

DB2 for z/OS and DB2 for LUW are different products, but they try to
maintain consistency at the DML level. You might want to open a PMR on this
to see if IBM is willing to fix it (but probably not in time for your
requirements).
Well as i Promised I tried the Open Curser and Fetch only the first
Line and now it works
correct as it is supposed to do
Thanks for the background information about the two Compilers Ithought
that both were written from the same team, well maybe i will write the
PRM but it is not necessary any more,

Aug 11 '06 #9

P: n/a
I think the bigger question is about the SQL (i.e. the SQL compiler)
being used, not the pre-compiler. DB2 for zOS, starting with V8 has been
doing a lot of catchup to DB2 for LUW in the SQL department. So it
depends on which version of DB2 for zOS you're on.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Aug 11 '06 #10

P: n/a

Serge Rielau schrieb:
I think the bigger question is about the SQL (i.e. the SQL compiler)
being used, not the pre-compiler. DB2 for zOS, starting with V8 has been
doing a lot of catchup to DB2 for LUW in the SQL department. So it
depends on which version of DB2 for zOS you're on.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Well we use DB2 Version 7 and the Programming Language is C/C++
Well I am not using ProgrammCode with special Windows Functionality,
cause the same Code is going to be compiled on Windows/Linux and IBM
3270 Operating System
we also try to use no special DB2 Features cause even the Database
should be customizable, DB2 , Oracle, ...

Aug 14 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.