473,383 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Cobol precompiler query

I am getting a precompiler error which I don't understand.

In my Cobol program I have the following code

01 TESTDB.
03 ADDR.
EXEC SQL INCLUDE 'ADDR.cop' END-EXEC.

In the ADDR.cop file I have the following

05 ADDR-LASTNAME PIC X(20).
05 ADDR-FIRSTNAME PIC X(20).
05 ADDR-AGE PIC S9(2) COMP-3.
I then use these in a fetch

EXEC SQL FETCH ADDR_1 INTO
:TESTDB.ADDR.ADDR-LASTNAME
,:TESTDB.ADDR.ADDR-FIRSTNAME
,:TESTDB.ADDR.ADDR-AGE
END-EXEC

When I precompile this I get

60 SQL4007N The host structure "ADDR" has no fields.
59 SQL4007N The host structure "TESTDB" has no fields.
61 SQL0062W Starting INCLUDE of file
"/home/steve/testdb2cobol/dbfields/ADDR.cop".

and then

233 SQL4002N "TESTDB.ADDR.ADDR-AGE" and
"TESTDB.ADDR.ADDR-FIRSTNAME" are undeclared host variables
that cannot both be used as descriptor names in a single
SQL statement.

I don't understand why they are not declared.

Any ideas?


--
Steve

Jun 29 '07 #1
7 4625
>>On 6/29/2007 at 6:35 AM, in message
<5e*************@mid.individual.net>,
Steve Rainbird<ne*********@rainbird.me.nospam.ukwrote:
I am getting a precompiler error which I don't understand.

In my Cobol program I have the following code

01 TESTDB.
03 ADDR.
EXEC SQL INCLUDE 'ADDR.cop' END-EXEC.

In the ADDR.cop file I have the following

05 ADDR-LASTNAME PIC X(20).
05 ADDR-FIRSTNAME PIC X(20).
05 ADDR-AGE PIC S9(2) COMP-3.
I then use these in a fetch

EXEC SQL FETCH ADDR_1 INTO
:TESTDB.ADDR.ADDR-LASTNAME
,:TESTDB.ADDR.ADDR-FIRSTNAME
,:TESTDB.ADDR.ADDR-AGE
END-EXEC

When I precompile this I get

60 SQL4007N The host structure "ADDR" has no fields.
59 SQL4007N The host structure "TESTDB" has no fields.
61 SQL0062W Starting INCLUDE of file
"/home/steve/testdb2cobol/dbfields/ADDR.cop".

and then

233 SQL4002N "TESTDB.ADDR.ADDR-AGE" and
"TESTDB.ADDR.ADDR-FIRSTNAME" are undeclared host
variables
that cannot both be used as descriptor names in a
single
SQL statement.

I don't understand why they are not declared.

Any ideas?
I believe that the precompiler is not recognising the 01 and 03 levels,
because they are not in the copybook. I think you either need to place them
in the copybook or do the following:

EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 TESTDB.
03 ADDR.
EXEC SQL INCLUDE 'ADDR.cop' END-EXEC.
EXEC SQL END DECLARE SECTION END-EXEC.

Frank

Jun 29 '07 #2
"Frank Swarbrick" <Fr*************@efirstbank.comwrote in message
news:46******************@efirstbank.com...
>>>On 6/29/2007 at 6:35 AM, in message
<5e*************@mid.individual.net>,
Steve Rainbird<ne*********@rainbird.me.nospam.ukwrote:
>I am getting a precompiler error which I don't understand.

In my Cobol program I have the following code

01 TESTDB.
03 ADDR.
EXEC SQL INCLUDE 'ADDR.cop' END-EXEC.

In the ADDR.cop file I have the following

05 ADDR-LASTNAME PIC X(20).
05 ADDR-FIRSTNAME PIC X(20).
05 ADDR-AGE PIC S9(2) COMP-3.
I then use these in a fetch

EXEC SQL FETCH ADDR_1 INTO
:TESTDB.ADDR.ADDR-LASTNAME
,:TESTDB.ADDR.ADDR-FIRSTNAME
,:TESTDB.ADDR.ADDR-AGE
END-EXEC

When I precompile this I get

60 SQL4007N The host structure "ADDR" has no fields.
59 SQL4007N The host structure "TESTDB" has no fields.
61 SQL0062W Starting INCLUDE of file
"/home/steve/testdb2cobol/dbfields/ADDR.cop".

and then

233 SQL4002N "TESTDB.ADDR.ADDR-AGE" and
"TESTDB.ADDR.ADDR-FIRSTNAME" are undeclared host
variables
that cannot both be used as descriptor names in a
single
SQL statement.

I don't understand why they are not declared.

Any ideas?

I believe that the precompiler is not recognising the 01 and 03 levels,
because they are not in the copybook. I think you either need to place
them
in the copybook or do the following:

EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 TESTDB.
03 ADDR.
EXEC SQL INCLUDE 'ADDR.cop' END-EXEC.
EXEC SQL END DECLARE SECTION END-EXEC.

Frank

That is exactly what I have got. Although the BEGIN DECLARE is a bit before
these statements.
--
Steve

Jun 29 '07 #3
"Steve Rainbird" <ne*********@rainbird.me.nospam.ukwrote in message
news:5e*************@mid.individual.net...
"Frank Swarbrick" <Fr*************@efirstbank.comwrote in message
news:46******************@efirstbank.com...
>>>>On 6/29/2007 at 6:35 AM, in message
<5e*************@mid.individual.net>,
Steve Rainbird<ne*********@rainbird.me.nospam.ukwrote:
>>I am getting a precompiler error which I don't understand.

In my Cobol program I have the following code

01 TESTDB.
03 ADDR.
EXEC SQL INCLUDE 'ADDR.cop' END-EXEC.

In the ADDR.cop file I have the following

05 ADDR-LASTNAME PIC X(20).
05 ADDR-FIRSTNAME PIC X(20).
05 ADDR-AGE PIC S9(2) COMP-3.
I then use these in a fetch

EXEC SQL FETCH ADDR_1 INTO
:TESTDB.ADDR.ADDR-LASTNAME
,:TESTDB.ADDR.ADDR-FIRSTNAME
,:TESTDB.ADDR.ADDR-AGE
END-EXEC

When I precompile this I get

60 SQL4007N The host structure "ADDR" has no fields.
59 SQL4007N The host structure "TESTDB" has no fields.
61 SQL0062W Starting INCLUDE of file
"/home/steve/testdb2cobol/dbfields/ADDR.cop".

and then

233 SQL4002N "TESTDB.ADDR.ADDR-AGE" and
"TESTDB.ADDR.ADDR-FIRSTNAME" are undeclared host
variables
that cannot both be used as descriptor names in a
single
SQL statement.

I don't understand why they are not declared.

Any ideas?

I believe that the precompiler is not recognising the 01 and 03 levels,
because they are not in the copybook. I think you either need to place
them
in the copybook or do the following:

EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 TESTDB.
03 ADDR.
EXEC SQL INCLUDE 'ADDR.cop' END-EXEC.
EXEC SQL END DECLARE SECTION END-EXEC.

Frank


That is exactly what I have got. Although the BEGIN DECLARE is a bit
before these statements.
--
Steve


Would someone be so kind as to try and compile this test program for me?

IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 TESTDB.
03 ADDR.
EXEC SQL INCLUDE 'ADDR.cop' END-EXEC.
EXEC SQL END DECLARE SECTION END-EXEC.
PROCEDURE DIVISION.
A10.
EXEC SQL DECLARE ADDR_1 CURSOR FOR
SELECT ADDR_LASTNAME
FROM ADDR
END-EXEC.
EXEC SQL OPEN ADDR_1 END-EXEC
EXEC SQL FETCH ADDR_1 INTO
:ADDR-LASTNAME
END-EXEC
EXEC SQL CLOSE ADDR_1 END-EXEC
STOP RUN.
~
ADDR.cop should contain the following
05 ADDR-LASTNAME PIC X(20).

Mine does not seem to be recognising the INCLUDE. Does yours compile?

TIA
--
Steve

Jul 2 '07 #4
>>On 7/3/2007 at 2:27 AM, in message
<11**********************@w5g2000hsg.googlegroups. com>, Bernard
Dhooghe<dh******@yahoo.comwrote:
>
Which Cobol Compiler is it?

What command is used to precompile?
The COBOL compiler does not matter. It's the DB2 pre-compile that has the
issue.

Frank

Jul 3 '07 #5
>>On 7/3/2007 at 1:48 AM, in message
<5e*************@mid.individual.net>,
Steve Rainbird<ne*********@rainbird.me.nospam.ukwrote:
Thanks Frank,

I would open a PMR but don't yet have a service agreement. :(

I am currently investigating migrating some Oracle Cobol to run against
DB2
and have just downloaded DB2 for Linux on a trial basis.
Spoil sport.

We are in the midst of purchasing DB2, so if I remember to do it I'll see if
I can open a PMR on this.

In the mean time, for your testing I'd just in-line the entire copybook into
the .sqc program.

Frank

Jul 3 '07 #6
"Frank Swarbrick" <Fr*************@efirstbank.comwrote in message
news:46******************@efirstbank.com...
>>>On 7/3/2007 at 1:48 AM, in message
<5e*************@mid.individual.net>,
Steve Rainbird<ne*********@rainbird.me.nospam.ukwrote:
>Thanks Frank,

I would open a PMR but don't yet have a service agreement. :(

I am currently investigating migrating some Oracle Cobol to run against
DB2
and have just downloaded DB2 for Linux on a trial basis.

Spoil sport.

We are in the midst of purchasing DB2, so if I remember to do it I'll see
if
I can open a PMR on this.

In the mean time, for your testing I'd just in-line the entire copybook
into
the .sqc program.

Frank
thanks,

I have written a pre-pre-compiler to copy in the INCLUDE files. :)

--
Steve

Jul 3 '07 #7
>>On 7/3/2007 at 11:02 AM, in message
<5e*************@mid.individual.net>,
Steve Rainbird<ne*********@rainbird.me.nospam.ukwrote:
"Frank Swarbrick" <Fr*************@efirstbank.comwrote in message
news:46******************@efirstbank.com...
>>>>On 7/3/2007 at 1:48 AM, in message
<5e*************@mid.individual.net>,
Steve Rainbird<ne*********@rainbird.me.nospam.ukwrote:
>>Thanks Frank,

I would open a PMR but don't yet have a service agreement. :(

I am currently investigating migrating some Oracle Cobol to run against
DB2
and have just downloaded DB2 for Linux on a trial basis.

Spoil sport.

We are in the midst of purchasing DB2, so if I remember to do it I'll
see
>if
I can open a PMR on this.

In the mean time, for your testing I'd just in-line the entire copybook
into
the .sqc program.

Frank

thanks,

I have written a pre-pre-compiler to copy in the INCLUDE files. :)
That works! Have fun!

Frank
Jul 5 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: VictorReinhart | last post by:
Hi, For Oracle 9i, the sample make file for the Oracle Pro*COBOL precompiler has a hard-coded list of programs in it. Has anyone created a generic make file (ie, without a hardcoded list of...
0
by: Alain Reymond | last post by:
Bonjour, Is there an embedded sql precompiler for MF Cobol for Postgres or such a project ? Regards. Alain
30
by: Stuart Turner | last post by:
Hi Everyone, I'm working hard trying to get Python 'accepted' in the organisation I work for. I'm making some good in-roads. One chap sent me the text below on his views of Python. I wondered...
0
by: nedbollard | last post by:
Hi, Having checked out a declared (rather than created) temporary table successfully in SPUFI, I have hit a problem in running the same SQL in the cobol prog I am ameding to use it. I have:...
2
by: singlal | last post by:
Hi, my question was not getting any attention because it moved to 2nd page; so posting it again. Sorry for any inconvenience but I need to get it resolved fast. Need your help! ...
10
by: RainerF | last post by:
Hi Folks, My Problem is: My SQL Statement Structure: SELECT TABLEA.FIELDA, TABLEA.FIELDB, TABLEA.FIELDC, TABLEA.FIELDD,
7
by: misha | last post by:
Hello. I was wandering if someone could explain to me (or point to some manual) the process of mapping the addresses of host variables by DB2. Especially I would like to know when DB2 decides to...
22
by: JohnQ | last post by:
Is the C++ precompiler the same as a C precompiler? If not, how much different is it? John
0
by: tickle | last post by:
Need to convert this PL/SQL script to Dynamic SQL Method 2 * copybook - celg02u3.sql SIR 24265 * * updates dt_deny for all rows in * * ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.