public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Error during Pro*C compilation
@ 2006-06-06 16:57 Rachit.Verma
  2006-06-06 17:18 ` Sven Eschenberg
  0 siblings, 1 reply; 5+ messages in thread
From: Rachit.Verma @ 2006-06-06 16:57 UTC (permalink / raw)
  To: gcc-help

Hi,

We are compiling the sample Pro*C programs provided by Oracle and are using
GCC 3.3.2. Our database is Oracle 10.2.0 and environment is on IBM AIX 5.3.
We are successfully able to convert the .pc to .c file and then .c to .o,
but while linking the .o file to generate executable, we are getting the
following output/error:


$ make -f demo_proc.mk build OBJS=sample1.o EXE=sample1

        /bin/make -f
/fsoracle/product/10.2.0/precomp/demo/proc/demo_proc.mk PROCFLAGS=""
PCCSRC=sample1 I_SYM=include= pc1

        proc  iname=sample1 include=.
include=/fsoracle/product/10.2.0/precomp/public
include=/fsoracle/product/10.2.0/rdbms/public
include=/fsoracle/product/10.2.0/rdbms/demo
include=/fsoracle/product/10.2.0/plsql/public
include=/fsoracle/product/10.2.0/network/public

Pro*C/C++: Release 10.2.0.2.0 - Production on Tue Jun 6 16:28:13 2006

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

System default option values taken from:
/fsoracle/product/10.2.0/precomp/admin/pcscfg.cfg

        /usr/local/bin/gcc  -O3  -q64 -DSS_64BIT_SERVER -qwarn64 -qinfo=uni
-DAIXRIOS -I. -I/fsoracle/product/10.2.0/precomp/public
-I/fsoracle/product/10.2.0/rdbms/public
-I/fsoracle/product/10.2.0/rdbms/demo
-I/fsoracle/product/10.2.0/plsql/public
-I/fsoracle/product/10.2.0/network/public     -c sample1.c

gcc: unrecognized option `-q64'
gcc: unrecognized option `-qwarn64'
gcc: unrecognized option `-qinfo=uni'

sample1.c: In function `main':
sample1.c:241: warning: return type of `main' is not `int'

        /usr/local/bin/gcc  -o sample1 sample1.o
-L/fsoracle/product/10.2.0/lib/ -lclntsh  -lld -lm `cat
/fsoracle/product/10.2.0/lib/sysliblist`  -lm  -lc_r -lpthreads

ld: 0711-736 ERROR: Input file /lib/crt0_64.o:

        XCOFF64 object files are not allowed in 32-bit mode.

collect2: ld returned 8 exit status

make: The error code from the last command is 1.





Stop.


Are we using the correct version of GCC? Is a 64 bit version of GCC
available for use with IBM AIX 5.3? Could you please suggest the possible
solution to this problem? Please let me know in case you require any more
details.


Warm Regards,
______________________________________________
Rachit Verma
External: 01455 89 5644
______________________________________________








Unless expressly stated to the contrary, the views expressed in this email
are not necessarily the views of National Grid plc or any of its
subsidiaries or affiliates (Group Companies), and the Group Companies,
their directors, officers and employees make no representation and accept
no liability for its accuracy or completeness. 

This e-mail, and any attachments are strictly confidential and intended for
the addressee(s) only. The content may also contain legal, professional or
other privileged information. If you are not the intended recipient, please
notify the sender immediately and then delete the e-mail and any
attachments.  You should not disclose, copy or take any action in reliance
on this transmission.

You may report the matter by calling us on 0800 085 4806.

Please ensure you have adequate virus protection before you open or detach
any documents from this transmission.  The Group Companies do not accept
any liability for viruses. An e-mail reply to this address may be subject
to monitoring for operational reasons or lawful business practices.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error during Pro*C compilation
  2006-06-06 16:57 Error during Pro*C compilation Rachit.Verma
@ 2006-06-06 17:18 ` Sven Eschenberg
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Eschenberg @ 2006-06-06 17:18 UTC (permalink / raw)
  To: Rachit.Verma; +Cc: gcc-help

Hi,

let's have a look at the output you posted:

gcc: unrecognized option `-q64'
gcc: unrecognized option `-qwarn64'
gcc: unrecognized option `-qinfo=uni'


Some Options are not recognized, obviously they have to do with 64-Bit 
support, especially, ifg we consider:

ld: 0711-736 ERROR: Input file /lib/crt0_64.o:

        XCOFF64 object files are not allowed in 32-bit mode.

collect2: ld returned 8 exit status


A short google search gives us the following page:

http://www-128.ibm.com/developerworks/eserver/articles/gnu.html

You might want to check the page, but there is one thing, that jumps 
quite at you:

To compile an application in 64 bit mode, one should use the option 
|-maix64|, which enables the 64-bit AIX ABI such as: 64-bit pointers, 
64-bit long type, and the infrastructure needed to support them. 
Specifying |-maix64| implies |-mpowerpc64| and |-mpowerpc|, while 
|-maix32| disables the 64-bit ABI and implies |-mno-powerpc64|. GCC 
defaults to -maix32.

Which would let me conclude:

the 3 unrecognized options are intended for 64-bit mode on another (the 
native) compiler or rather maybe linker and that maybe the -maix64 
option is missing.

check the makefile, the native compiler's options and see if this helps 
you ....

-Sven


Rachit.Verma@uk.ngrid.com wrote:
> Hi,
>
> We are compiling the sample Pro*C programs provided by Oracle and are using
> GCC 3.3.2. Our database is Oracle 10.2.0 and environment is on IBM AIX 5.3.
> We are successfully able to convert the .pc to .c file and then .c to .o,
> but while linking the .o file to generate executable, we are getting the
> following output/error:
>
>
> $ make -f demo_proc.mk build OBJS=sample1.o EXE=sample1
>
>         /bin/make -f
> /fsoracle/product/10.2.0/precomp/demo/proc/demo_proc.mk PROCFLAGS=""
> PCCSRC=sample1 I_SYM=include= pc1
>
>         proc  iname=sample1 include=.
> include=/fsoracle/product/10.2.0/precomp/public
> include=/fsoracle/product/10.2.0/rdbms/public
> include=/fsoracle/product/10.2.0/rdbms/demo
> include=/fsoracle/product/10.2.0/plsql/public
> include=/fsoracle/product/10.2.0/network/public
>
> Pro*C/C++: Release 10.2.0.2.0 - Production on Tue Jun 6 16:28:13 2006
>
> Copyright (c) 1982, 2005, Oracle.  All rights reserved.
>
> System default option values taken from:
> /fsoracle/product/10.2.0/precomp/admin/pcscfg.cfg
>
>         /usr/local/bin/gcc  -O3  -q64 -DSS_64BIT_SERVER -qwarn64 -qinfo=uni
> -DAIXRIOS -I. -I/fsoracle/product/10.2.0/precomp/public
> -I/fsoracle/product/10.2.0/rdbms/public
> -I/fsoracle/product/10.2.0/rdbms/demo
> -I/fsoracle/product/10.2.0/plsql/public
> -I/fsoracle/product/10.2.0/network/public     -c sample1.c
>
> gcc: unrecognized option `-q64'
> gcc: unrecognized option `-qwarn64'
> gcc: unrecognized option `-qinfo=uni'
>
> sample1.c: In function `main':
> sample1.c:241: warning: return type of `main' is not `int'
>
>         /usr/local/bin/gcc  -o sample1 sample1.o
> -L/fsoracle/product/10.2.0/lib/ -lclntsh  -lld -lm `cat
> /fsoracle/product/10.2.0/lib/sysliblist`  -lm  -lc_r -lpthreads
>
> ld: 0711-736 ERROR: Input file /lib/crt0_64.o:
>
>         XCOFF64 object files are not allowed in 32-bit mode.
>
> collect2: ld returned 8 exit status
>
> make: The error code from the last command is 1.
>
>
>
>
>
> Stop.
>
>
> Are we using the correct version of GCC? Is a 64 bit version of GCC
> available for use with IBM AIX 5.3? Could you please suggest the possible
> solution to this problem? Please let me know in case you require any more
> details.
>
>
> Warm Regards,
> ______________________________________________
> Rachit Verma
> External: 01455 89 5644
> ______________________________________________
>
>
>
>
>
>
>
>
> Unless expressly stated to the contrary, the views expressed in this email
> are not necessarily the views of National Grid plc or any of its
> subsidiaries or affiliates (Group Companies), and the Group Companies,
> their directors, officers and employees make no representation and accept
> no liability for its accuracy or completeness. 
>
> This e-mail, and any attachments are strictly confidential and intended for
> the addressee(s) only. The content may also contain legal, professional or
> other privileged information. If you are not the intended recipient, please
> notify the sender immediately and then delete the e-mail and any
> attachments.  You should not disclose, copy or take any action in reliance
> on this transmission.
>
> You may report the matter by calling us on 0800 085 4806.
>
> Please ensure you have adequate virus protection before you open or detach
> any documents from this transmission.  The Group Companies do not accept
> any liability for viruses. An e-mail reply to this address may be subject
> to monitoring for operational reasons or lawful business practices.
>   

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error during Pro*C compilation
@ 2006-06-07 13:25 Rachit.Verma
  0 siblings, 0 replies; 5+ messages in thread
From: Rachit.Verma @ 2006-06-07 13:25 UTC (permalink / raw)
  To: Sven Eschenberg; +Cc: gcc-help


Sven,

You are correct. I found that we get an error during compilation whenever
the following statement occurs :

EXEC SQL WHENEVER NOT FOUND DO break;
for... loop..

This error is resolved if this piece of code is modified to:

EXEC SQL WHENEVER NOT FOUND DO break;
for...loop..
EXEC SQL WHENEVER NOT FOUND CONTINUE;

I have been able to compile the code successfully and generate the
executable using GCC. Thanks for the advice.


Apart from this, there was one more important statement that I had noticed
in the IBM website, earlier forwarded by yourself.
(http://www-128.ibm.com/developerworks/eserver/articles/gnu.html). IBM
mentions that "You cannot use the GNU linker on AIX as this will cause
incorrectly linked binaries. By default, the AIX linker is used when using
GCC on AIX. You should only use the default AIX linker. ".

I modified the linking statement to use the default linker (ld) instead to
GCC and was also able to generate the executable. However, as of now, I am
looking at one of the GCC make files that could do all these manual
activities for me. Could you please let me know whether do we get GCC make
file with the GCC compiler? If yes, which is the location that I need to
search in?


Warm Regards,
______________________________________________
Rachit Verma

External: +44 1455 89 5644
______________________________________________





                                                                                                                                        
                      Sven Eschenberg                                                                                                   
                      <eschenb@cs.uni-fr                                                                                                
                      ankfurt.de>               To:       Rachit.Verma@uktransco.com                                                    
                                                cc:       gcc-help@gcc.gnu.org                                                          
                      07/06/06 14:03            Subject:  Re: Error during Pro*C compilation                                            
                                                                                                                                        
                                                                                                                                        




Hi Rachit,

Okay, obviously, from what I can see, there is an exit condition
(ocurrance of some sql error) which is supposed to end some iteration
(thus the break).

What I cannot tell, or am not sure about:

It looks like the there is no iterating loop, which the break belongs
too, at least not in this source file. On the other hand, from what I
know, break is only available within looping control structures. Since I
don't know Pro*C and which non standard options it provides, I can only
guess that the statement is meant to break out of the function thus
avoiding the return value true. So maybe, a simple modification from:
if (sqlca.sqlcode == 1403) break;
into
if (sqlca.sqlcode == 1403) return FALSE;

might fix the code and do what is meant to do. But, it's pretty hard to
tell, without any surrounding code. So, I guess, you need to dig into
the code a little and analyze it to find out, if the break at this
position actually resembles a return FALSE. In the Pro*C source you
attached, I cannot see any specific error checking after the actual
insertion. If the if/break statement was created during conversion, it
might just be an error in the conversion process?


Regards

-Sven

Rachit.Verma@uk.ngrid.com wrote:
> Sven,
>
> Thanks a lot of the piece of advice. That helped to solve our problem and
> we were successfully able to compile the sample file provided by Oracle.
>
> Now, while compiling our application related code, we are successfully
able
> to convert .pc to .c. While compiling .c file, we are getting the
following
> error:
>
> Code.c: In function `ProcessSelectList':
> Code.c:2240: warning: passing arg 2 of `sqlprc' from incompatible pointer
> type
> Code.c:2240: warning: passing arg 3 of `sqlprc' from incompatible pointer
> type
> Code.c: In function `WriteResultToTable':
> Code.c:3806: error: break statement not within loop or switch
> Code.c: In function `strtok2':
> Code.c:4462: warning: comparison of distinct pointer types lacks a cast
>
> When I saw my Pro*C code, I could not find an equivalent 'break'
statement.
> Attached below is the Pro*C section of the code where this error is
> generated:
>
> (See attached file: ProC.txt)
>
> Attached below is the section of the C file that is generated.
>
> (See attached file: ConvertedC.txt)
>
> Could you please let us know any work around or rather a possible reason
> for this error? Do we need to include any flag in this case also in order
> to compile the C file successfully?
>
>
> Warm Regards,
> ______________________________________________
> Rachit Verma
> External: +44 1455 89 5644
> ______________________________________________
>
>
>
>
>
>

>                       Sven Eschenberg

>                       <eschenb@cs.uni-fr

>                       ankfurt.de>               To:
Rachit.Verma@uktransco.com

>                                                 cc:
gcc-help@gcc.gnu.org

>                       06/06/06 18:13            Subject:  Re: Error
during Pro*C compilation
>

>

>





Unless expressly stated to the contrary, the views expressed in this email
are not necessarily the views of National Grid plc or any of its
subsidiaries or affiliates (Group Companies), and the Group Companies,
their directors, officers and employees make no representation and accept
no liability for its accuracy or completeness. 

This e-mail, and any attachments are strictly confidential and intended for
the addressee(s) only. The content may also contain legal, professional or
other privileged information. If you are not the intended recipient, please
notify the sender immediately and then delete the e-mail and any
attachments.  You should not disclose, copy or take any action in reliance
on this transmission.

You may report the matter by calling us on 0800 085 4806.

Please ensure you have adequate virus protection before you open or detach
any documents from this transmission.  The Group Companies do not accept
any liability for viruses. An e-mail reply to this address may be subject
to monitoring for operational reasons or lawful business practices.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error during Pro*C compilation
  2006-06-07  8:55 Rachit.Verma
@ 2006-06-07 13:10 ` Sven Eschenberg
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Eschenberg @ 2006-06-07 13:10 UTC (permalink / raw)
  To: Rachit.Verma; +Cc: gcc-help

Hi Rachit,

Okay, obviously, from what I can see, there is an exit condition 
(ocurrance of some sql error) which is supposed to end some iteration 
(thus the break).

What I cannot tell, or am not sure about:

It looks like the there is no iterating loop, which the break belongs 
too, at least not in this source file. On the other hand, from what I 
know, break is only available within looping control structures. Since I 
don't know Pro*C and which non standard options it provides, I can only 
guess that the statement is meant to break out of the function thus 
avoiding the return value true. So maybe, a simple modification from:
if (sqlca.sqlcode == 1403) break;
into
if (sqlca.sqlcode == 1403) return FALSE;

might fix the code and do what is meant to do. But, it's pretty hard to 
tell, without any surrounding code. So, I guess, you need to dig into 
the code a little and analyze it to find out, if the break at this 
position actually resembles a return FALSE. In the Pro*C source you 
attached, I cannot see any specific error checking after the actual 
insertion. If the if/break statement was created during conversion, it 
might just be an error in the conversion process?


Regards

-Sven

Rachit.Verma@uk.ngrid.com wrote:
> Sven,
>
> Thanks a lot of the piece of advice. That helped to solve our problem and
> we were successfully able to compile the sample file provided by Oracle.
>
> Now, while compiling our application related code, we are successfully able
> to convert .pc to .c. While compiling .c file, we are getting the following
> error:
>
> Code.c: In function `ProcessSelectList':
> Code.c:2240: warning: passing arg 2 of `sqlprc' from incompatible pointer
> type
> Code.c:2240: warning: passing arg 3 of `sqlprc' from incompatible pointer
> type
> Code.c: In function `WriteResultToTable':
> Code.c:3806: error: break statement not within loop or switch
> Code.c: In function `strtok2':
> Code.c:4462: warning: comparison of distinct pointer types lacks a cast
>
> When I saw my Pro*C code, I could not find an equivalent 'break' statement.
> Attached below is the Pro*C section of the code where this error is
> generated:
>
> (See attached file: ProC.txt)
>
> Attached below is the section of the C file that is generated.
>
> (See attached file: ConvertedC.txt)
>
> Could you please let us know any work around or rather a possible reason
> for this error? Do we need to include any flag in this case also in order
> to compile the C file successfully?
>
>
> Warm Regards,
> ______________________________________________
> Rachit Verma
> External: +44 1455 89 5644
> ______________________________________________
>
>
>
>
>
>                                                                                                                                         
>                       Sven Eschenberg                                                                                                   
>                       <eschenb@cs.uni-fr                                                                                                
>                       ankfurt.de>               To:       Rachit.Verma@uktransco.com                                                    
>                                                 cc:       gcc-help@gcc.gnu.org                                                          
>                       06/06/06 18:13            Subject:  Re: Error during Pro*C compilation                                            
>                                                                                                                                         
>                                                                                                                                         
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error during Pro*C compilation
@ 2006-06-07  8:55 Rachit.Verma
  2006-06-07 13:10 ` Sven Eschenberg
  0 siblings, 1 reply; 5+ messages in thread
From: Rachit.Verma @ 2006-06-07  8:55 UTC (permalink / raw)
  To: Sven Eschenberg; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 8322 bytes --]


Sven,

Thanks a lot of the piece of advice. That helped to solve our problem and
we were successfully able to compile the sample file provided by Oracle.

Now, while compiling our application related code, we are successfully able
to convert .pc to .c. While compiling .c file, we are getting the following
error:

Code.c: In function `ProcessSelectList':
Code.c:2240: warning: passing arg 2 of `sqlprc' from incompatible pointer
type
Code.c:2240: warning: passing arg 3 of `sqlprc' from incompatible pointer
type
Code.c: In function `WriteResultToTable':
Code.c:3806: error: break statement not within loop or switch
Code.c: In function `strtok2':
Code.c:4462: warning: comparison of distinct pointer types lacks a cast

When I saw my Pro*C code, I could not find an equivalent 'break' statement.
Attached below is the Pro*C section of the code where this error is
generated:

(See attached file: ProC.txt)

Attached below is the section of the C file that is generated.

(See attached file: ConvertedC.txt)

Could you please let us know any work around or rather a possible reason
for this error? Do we need to include any flag in this case also in order
to compile the C file successfully?


Warm Regards,
______________________________________________
Rachit Verma
External: +44 1455 89 5644
______________________________________________





                                                                                                                                        
                      Sven Eschenberg                                                                                                   
                      <eschenb@cs.uni-fr                                                                                                
                      ankfurt.de>               To:       Rachit.Verma@uktransco.com                                                    
                                                cc:       gcc-help@gcc.gnu.org                                                          
                      06/06/06 18:13            Subject:  Re: Error during Pro*C compilation                                            
                                                                                                                                        
                                                                                                                                        




Hi,

let's have a look at the output you posted:

gcc: unrecognized option `-q64'
gcc: unrecognized option `-qwarn64'
gcc: unrecognized option `-qinfo=uni'


Some Options are not recognized, obviously they have to do with 64-Bit
support, especially, ifg we consider:

ld: 0711-736 ERROR: Input file /lib/crt0_64.o:

        XCOFF64 object files are not allowed in 32-bit mode.

collect2: ld returned 8 exit status


A short google search gives us the following page:

http://www-128.ibm.com/developerworks/eserver/articles/gnu.html

You might want to check the page, but there is one thing, that jumps
quite at you:

To compile an application in 64 bit mode, one should use the option
|-maix64|, which enables the 64-bit AIX ABI such as: 64-bit pointers,
64-bit long type, and the infrastructure needed to support them.
Specifying |-maix64| implies |-mpowerpc64| and |-mpowerpc|, while
|-maix32| disables the 64-bit ABI and implies |-mno-powerpc64|. GCC
defaults to -maix32.

Which would let me conclude:

the 3 unrecognized options are intended for 64-bit mode on another (the
native) compiler or rather maybe linker and that maybe the -maix64
option is missing.

check the makefile, the native compiler's options and see if this helps
you ....

-Sven


Rachit.Verma@uk.ngrid.com wrote:
> Hi,
>
> We are compiling the sample Pro*C programs provided by Oracle and are
using
> GCC 3.3.2. Our database is Oracle 10.2.0 and environment is on IBM AIX
5.3.
> We are successfully able to convert the .pc to .c file and then .c to .o,
> but while linking the .o file to generate executable, we are getting the
> following output/error:
>
>
> $ make -f demo_proc.mk build OBJS=sample1.o EXE=sample1
>
>         /bin/make -f
> /fsoracle/product/10.2.0/precomp/demo/proc/demo_proc.mk PROCFLAGS=""
> PCCSRC=sample1 I_SYM=include= pc1
>
>         proc  iname=sample1 include=.
> include=/fsoracle/product/10.2.0/precomp/public
> include=/fsoracle/product/10.2.0/rdbms/public
> include=/fsoracle/product/10.2.0/rdbms/demo
> include=/fsoracle/product/10.2.0/plsql/public
> include=/fsoracle/product/10.2.0/network/public
>
> Pro*C/C++: Release 10.2.0.2.0 - Production on Tue Jun 6 16:28:13 2006
>
> Copyright (c) 1982, 2005, Oracle.  All rights reserved.
>
> System default option values taken from:
> /fsoracle/product/10.2.0/precomp/admin/pcscfg.cfg
>
>         /usr/local/bin/gcc  -O3  -q64 -DSS_64BIT_SERVER -qwarn64
-qinfo=uni
> -DAIXRIOS -I. -I/fsoracle/product/10.2.0/precomp/public
> -I/fsoracle/product/10.2.0/rdbms/public
> -I/fsoracle/product/10.2.0/rdbms/demo
> -I/fsoracle/product/10.2.0/plsql/public
> -I/fsoracle/product/10.2.0/network/public     -c sample1.c
>
> gcc: unrecognized option `-q64'
> gcc: unrecognized option `-qwarn64'
> gcc: unrecognized option `-qinfo=uni'
>
> sample1.c: In function `main':
> sample1.c:241: warning: return type of `main' is not `int'
>
>         /usr/local/bin/gcc  -o sample1 sample1.o
> -L/fsoracle/product/10.2.0/lib/ -lclntsh  -lld -lm `cat
> /fsoracle/product/10.2.0/lib/sysliblist`  -lm  -lc_r -lpthreads
>
> ld: 0711-736 ERROR: Input file /lib/crt0_64.o:
>
>         XCOFF64 object files are not allowed in 32-bit mode.
>
> collect2: ld returned 8 exit status
>
> make: The error code from the last command is 1.
>
>
>
>
>
> Stop.
>
>
> Are we using the correct version of GCC? Is a 64 bit version of GCC
> available for use with IBM AIX 5.3? Could you please suggest the possible
> solution to this problem? Please let me know in case you require any more
> details.
>
>
> Warm Regards,
> ______________________________________________
> Rachit Verma
> External: 01455 89 5644
> ______________________________________________
>
>
>
>
>
>
>
>
> Unless expressly stated to the contrary, the views expressed in this
email
> are not necessarily the views of National Grid plc or any of its
> subsidiaries or affiliates (Group Companies), and the Group Companies,
> their directors, officers and employees make no representation and accept
> no liability for its accuracy or completeness.
>
> This e-mail, and any attachments are strictly confidential and intended
for
> the addressee(s) only. The content may also contain legal, professional
or
> other privileged information. If you are not the intended recipient,
please
> notify the sender immediately and then delete the e-mail and any
> attachments.  You should not disclose, copy or take any action in
reliance
> on this transmission.
>
> You may report the matter by calling us on 0800 085 4806.
>
> Please ensure you have adequate virus protection before you open or
detach
> any documents from this transmission.  The Group Companies do not accept
> any liability for viruses. An e-mail reply to this address may be subject
> to monitoring for operational reasons or lawful business practices.
>





Unless expressly stated to the contrary, the views expressed in this email
are not necessarily the views of National Grid plc or any of its
subsidiaries or affiliates (Group Companies), and the Group Companies,
their directors, officers and employees make no representation and accept
no liability for its accuracy or completeness. 

This e-mail, and any attachments are strictly confidential and intended for
the addressee(s) only. The content may also contain legal, professional or
other privileged information. If you are not the intended recipient, please
notify the sender immediately and then delete the e-mail and any
attachments.  You should not disclose, copy or take any action in reliance
on this transmission.

You may report the matter by calling us on 0800 085 4806.

Please ensure you have adequate virus protection before you open or detach
any documents from this transmission.  The Group Companies do not accept
any liability for viruses. An e-mail reply to this address may be subject
to monitoring for operational reasons or lawful business practices.

[-- Attachment #2: ProC.txt --]
[-- Type: application/octet-stream, Size: 1831 bytes --]

BOOL WriteResultToTable(char *sFlag, char *sValue1, char *sValue2)
{
	struct tm *tmCurTime;
	time_t binTime;
	char sDateNow[DATE_LEN],
	sTimeNow[TIME_LEN];
	
	EXEC SQL BEGIN DECLARE SECTION;

		VARCHAR v_DateTime[DATE_TIME];
		VARCHAR v_SerialNumber[SERIAL_NUM_LEN];
		VARCHAR v_Key1[KEY_LEN];
		VARCHAR v_Key2[KEY_LEN];
		VARCHAR v_Result[RESULT_LEN];
		VARCHAR v_InterfaceId[INTERFACE_LEN];
		VARCHAR v_Direction[DIR_LEN];

	EXEC SQL END DECLARE SECTION;

	EXEC SQL WHENEVER SQLERROR DO OracleSQLError("Error:WriteResultToTable");

	strcpy((char *)v_InterfaceId.arr, pcInterfaceId);
	v_InterfaceId.len=strlen((char *)v_InterfaceId.arr);

	sprintf((char *)v_SerialNumber.arr,"%d", nSerialNum);
	v_SerialNumber.len=strlen((char *)v_SerialNumber.arr);

	strcpy((char *)v_Key1.arr, sValue1);
	v_Key1.len=strlen((char *)v_Key1.arr);

	strcpy((char *)v_Key2.arr, sValue2);
	v_Key2.len=strlen((char *)v_Key2.arr);

	strcpy((char *)v_Result.arr, sFlag);
	v_Result.len=strlen((char *)v_Result.arr);

	strcpy((char *)v_Direction.arr, "I");
	v_Direction.len=strlen((char *)v_Direction.arr);

	time(&binTime);		 /* Get number of seconds since 00:00:00 GMT, 1,1,70*/
	tmCurTime = localtime(&binTime);	/* Convert to local time*/

	strftime(sDateNow, 11, "%Y/%m/%d", tmCurTime); /* Sort out the Date*/
	strftime(sTimeNow, 9, "%H:%M:%S", tmCurTime);  /* Sort out the Time*/

	sprintf((char *)v_DateTime.arr,"%s%s",sDateNow, sTimeNow);
	v_DateTime.len=strlen((char *)v_DateTime.arr);

	EXEC SQL INSERT INTO nff_result (
			DATETIME,
			SERIALNUMBER,
			KEY1,
			KEY2,
			RESULT,
			INTERFACENUMBER,
			DIRECTION)
		VALUES(to_date(:v_DateTime,'YYYY/MM/DD HH24:MI:SS'),
			:v_SerialNumber,
			:v_Key1,
			:v_Key2,
			:v_Result,
			:v_InterfaceId,
			:v_Direction);

	return TRUE;
}

[-- Attachment #3: ConvertedC.txt --]
[-- Type: application/octet-stream, Size: 5817 bytes --]

BOOL WriteResultToTable(char *sFlag, char *sValue1, char *sValue2)
{
	struct tm *tmCurTime;
	time_t binTime;
	char sDateNow[DATE_LEN],
	sTimeNow[TIME_LEN];
	
	/* EXEC SQL BEGIN DECLARE SECTION; */ 


		/* VARCHAR v_DateTime[DATE_TIME]; */ 
struct { unsigned short len; unsigned char arr[30]; } v_DateTime;

		/* VARCHAR v_SerialNumber[SERIAL_NUM_LEN]; */ 
struct { unsigned short len; unsigned char arr[10]; } v_SerialNumber;

		/* VARCHAR v_Key1[KEY_LEN]; */ 
struct { unsigned short len; unsigned char arr[200]; } v_Key1;

		/* VARCHAR v_Key2[KEY_LEN]; */ 
struct { unsigned short len; unsigned char arr[200]; } v_Key2;

		/* VARCHAR v_Result[RESULT_LEN]; */ 
struct { unsigned short len; unsigned char arr[2]; } v_Result;

		/* VARCHAR v_InterfaceId[INTERFACE_LEN]; */ 
struct { unsigned short len; unsigned char arr[4]; } v_InterfaceId;

		/* VARCHAR v_Direction[DIR_LEN]; */ 
struct { unsigned short len; unsigned char arr[2]; } v_Direction;


	/* EXEC SQL END DECLARE SECTION; */ 


//	EXEC SQL WHENEVER SQLERROR DO OracleSQLError("Error:WriteResultToTable");

	strcpy((char *)v_InterfaceId.arr, pcInterfaceId);
	v_InterfaceId.len=strlen((char *)v_InterfaceId.arr);

	sprintf((char *)v_SerialNumber.arr,"%d", nSerialNum);
	v_SerialNumber.len=strlen((char *)v_SerialNumber.arr);

	strcpy((char *)v_Key1.arr, sValue1);
	v_Key1.len=strlen((char *)v_Key1.arr);

	strcpy((char *)v_Key2.arr, sValue2);
	v_Key2.len=strlen((char *)v_Key2.arr);

	strcpy((char *)v_Result.arr, sFlag);
	v_Result.len=strlen((char *)v_Result.arr);

	strcpy((char *)v_Direction.arr, "I");
	v_Direction.len=strlen((char *)v_Direction.arr);

	time(&binTime);		 /* Get number of seconds since 00:00:00 GMT, 1,1,70*/
	tmCurTime = localtime(&binTime);	/* Convert to local time*/

	strftime(sDateNow, 11, "%Y/%m/%d", tmCurTime); /* Sort out the Date*/
	strftime(sTimeNow, 9, "%H:%M:%S", tmCurTime);  /* Sort out the Time*/

	sprintf((char *)v_DateTime.arr,"%s%s",sDateNow, sTimeNow);
	v_DateTime.len=strlen((char *)v_DateTime.arr);

	/* EXEC SQL INSERT INTO nff_result (
			DATETIME,
			SERIALNUMBER,
			KEY1,
			KEY2,
			RESULT,
			INTERFACENUMBER,
			DIRECTION)
		VALUES(to_date(:v_DateTime,'YYYY/MM/DD HH24:MI:SS'),
			:v_SerialNumber,
			:v_Key1,
			:v_Key2,
			:v_Result,
			:v_InterfaceId,
			:v_Direction); */ 

{
 struct sqlexd sqlstm;
 sqlorat((void **)0, &sqlctx, &oraca);
 sqlstm.sqlvsn = 12;
 sqlstm.arrsiz = 8;
 sqlstm.sqladtp = &sqladt;
 sqlstm.sqltdsp = &sqltds;
 sqlstm.stmt = "insert into nff_result (DATETIME,SERIALNUMBER,KEY1,KEY2,RESU\
LT,INTERFACENUMBER,DIRECTION) values (to_date(:b0,'YYYY/MM/DD HH24:MI:SS'),:b1\
,:b2,:b3,:b4,:b5,:b6)";
 sqlstm.iters = (unsigned int  )1;
 sqlstm.offset = (unsigned int  )391;
 sqlstm.cud = sqlcud0;
 sqlstm.sqlest = (unsigned char  *)&sqlca;
 sqlstm.sqlety = (unsigned short)256;
 sqlstm.occurs = (unsigned int  )0;
 sqlstm.sqhstv[0] = (unsigned char  *)&v_DateTime;
 sqlstm.sqhstl[0] = (unsigned long )32;
 sqlstm.sqhsts[0] = (         int  )0;
 sqlstm.sqindv[0] = (         short *)0;
 sqlstm.sqinds[0] = (         int  )0;
 sqlstm.sqharm[0] = (unsigned long )0;
 sqlstm.sqadto[0] = (unsigned short )0;
 sqlstm.sqtdso[0] = (unsigned short )0;
 sqlstm.sqhstv[1] = (unsigned char  *)&v_SerialNumber;
 sqlstm.sqhstl[1] = (unsigned long )12;
 sqlstm.sqhsts[1] = (         int  )0;
 sqlstm.sqindv[1] = (         short *)0;
 sqlstm.sqinds[1] = (         int  )0;
 sqlstm.sqharm[1] = (unsigned long )0;
 sqlstm.sqadto[1] = (unsigned short )0;
 sqlstm.sqtdso[1] = (unsigned short )0;
 sqlstm.sqhstv[2] = (unsigned char  *)&v_Key1;
 sqlstm.sqhstl[2] = (unsigned long )202;
 sqlstm.sqhsts[2] = (         int  )0;
 sqlstm.sqindv[2] = (         short *)0;
 sqlstm.sqinds[2] = (         int  )0;
 sqlstm.sqharm[2] = (unsigned long )0;
 sqlstm.sqadto[2] = (unsigned short )0;
 sqlstm.sqtdso[2] = (unsigned short )0;
 sqlstm.sqhstv[3] = (unsigned char  *)&v_Key2;
 sqlstm.sqhstl[3] = (unsigned long )202;
 sqlstm.sqhsts[3] = (         int  )0;
 sqlstm.sqindv[3] = (         short *)0;
 sqlstm.sqinds[3] = (         int  )0;
 sqlstm.sqharm[3] = (unsigned long )0;
 sqlstm.sqadto[3] = (unsigned short )0;
 sqlstm.sqtdso[3] = (unsigned short )0;
 sqlstm.sqhstv[4] = (unsigned char  *)&v_Result;
 sqlstm.sqhstl[4] = (unsigned long )4;
 sqlstm.sqhsts[4] = (         int  )0;
 sqlstm.sqindv[4] = (         short *)0;
 sqlstm.sqinds[4] = (         int  )0;
 sqlstm.sqharm[4] = (unsigned long )0;
 sqlstm.sqadto[4] = (unsigned short )0;
 sqlstm.sqtdso[4] = (unsigned short )0;
 sqlstm.sqhstv[5] = (unsigned char  *)&v_InterfaceId;
 sqlstm.sqhstl[5] = (unsigned long )6;
 sqlstm.sqhsts[5] = (         int  )0;
 sqlstm.sqindv[5] = (         short *)0;
 sqlstm.sqinds[5] = (         int  )0;
 sqlstm.sqharm[5] = (unsigned long )0;
 sqlstm.sqadto[5] = (unsigned short )0;
 sqlstm.sqtdso[5] = (unsigned short )0;
 sqlstm.sqhstv[6] = (unsigned char  *)&v_Direction;
 sqlstm.sqhstl[6] = (unsigned long )4;
 sqlstm.sqhsts[6] = (         int  )0;
 sqlstm.sqindv[6] = (         short *)0;
 sqlstm.sqinds[6] = (         int  )0;
 sqlstm.sqharm[6] = (unsigned long )0;
 sqlstm.sqadto[6] = (unsigned short )0;
 sqlstm.sqtdso[6] = (unsigned short )0;
 sqlstm.sqphsv = sqlstm.sqhstv;
 sqlstm.sqphsl = sqlstm.sqhstl;
 sqlstm.sqphss = sqlstm.sqhsts;
 sqlstm.sqpind = sqlstm.sqindv;
 sqlstm.sqpins = sqlstm.sqinds;
 sqlstm.sqparm = sqlstm.sqharm;
 sqlstm.sqparc = sqlstm.sqharc;
 sqlstm.sqpadto = sqlstm.sqadto;
 sqlstm.sqptdso = sqlstm.sqtdso;
 sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
 if (sqlca.sqlcode == 1403) break;	***********This is where error is coming********
 if (sqlca.sqlcode < 0) OracleSQLError("ConnectToDatabase");
}



	return TRUE;
}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-06-07 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-06 16:57 Error during Pro*C compilation Rachit.Verma
2006-06-06 17:18 ` Sven Eschenberg
2006-06-07  8:55 Rachit.Verma
2006-06-07 13:10 ` Sven Eschenberg
2006-06-07 13:25 Rachit.Verma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).