View previous topic :: View next topic |
Author |
Message |
MFdigger Beginner
Joined: 09 Sep 2005 Posts: 124 Topics: 52 Location: Chicago
|
Posted: Mon Apr 20, 2009 11:29 am Post subject: DSNH312I - UNDEFINED OR UNUSABLE HOST VARIABLE |
|
|
Hi All
The host variable defined in the following query in the cobol program is showing an error msg as below, and also some of the other queries also are showing with same err msg.
Code: |
DSNH312I E DSNHSMUD LINE 4595 COL 28 UNDEFINED OR UNUSABLE HOST VARIABLE "SXXKM11"
DSNH312I E DSNHSMUD LINE 4595 COL 36 UNDEFINED OR UNUSABLE HOST VARIABLE "VINCD"
|
Code: |
EXEC SQL
DECLARE @S01020001 CURSOR FOR
SELECT
COUNT(*),
MAX(MULTI_RPR_ATMPT_FL)
FROM BTS09120 T1
WHERE
VIN_CD = :SXXKM11.VINCD
END-EXEC.
|
The copy book SXXKM11 has the following structure with VINCD defined at level 15.
Code: |
01 SXXKM11.
05 xxxx...
10 xxx...
10 ...
...
05 USER-FIELDS.
10 xxx...
15 xx...
10 xxx...
15 xx...
10 xxx...
15 xx...
10 ...
...
10 VINCD-G.
15 VINCD PIC X(17)
|
When I comment out the copybook in the program and declared a temp-variable as shown below and changed the host variable in the above query with the :VINCD-TP2, there is no pre-compiler error msg.
Code: |
01 VINCD-TEMP.
05 VINCD-TP.
10 VINCD-TP1.
15 VINCD-TP2 PIC X(17).
|
Not sure, what could be the problem here? every thing seems to be the same in declartion wise. Could some have any suggestions on this?
 _________________ Tx
Digger |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Mon Apr 20, 2009 12:10 pm Post subject: |
|
|
MFdigger,
You sure do like to make things complicated don't you? Refer the variable directly
Remember that the names of host variables should be unique within the program, even if the host variables are in different blocks, functions, or subroutines. |
|
Back to top |
|
 |
MFdigger Beginner
Joined: 09 Sep 2005 Posts: 124 Topics: 52 Location: Chicago
|
Posted: Mon Apr 20, 2009 1:09 pm Post subject: |
|
|
Hi Kolusu
VINCD is not a unique in the program, 2 other copybooks has the same varibale name _________________ Tx
Digger |
|
Back to top |
|
 |
RonB Beginner
Joined: 02 Dec 2002 Posts: 93 Topics: 0 Location: Orlando, FL
|
Posted: Mon Apr 20, 2009 4:25 pm Post subject: |
|
|
Perhaps the fact that you refer to it as a COPYBOOK reveals the problem, Are you trying to bring SCCKM11 into your program via COPY or INCLUDE. If you are using COPY, then the DB2 pre-compiler won't find it - you must use INCLUDE instead. _________________ A computer once beat me at chess, but it was no match for me at kick boxing. |
|
Back to top |
|
 |
MFdigger Beginner
Joined: 09 Sep 2005 Posts: 124 Topics: 52 Location: Chicago
|
Posted: Mon Apr 20, 2009 4:50 pm Post subject: |
|
|
Hi Ron,
Thank you for the advice. I tried using INCLUDE too. But was facing with the same issue
01 MP01-SCCKM11-IOAREA.
EXEC SQL
INCLUDE SXXKM11
END-EXEC. _________________ Tx
Digger |
|
Back to top |
|
 |
RonB Beginner
Joined: 02 Dec 2002 Posts: 93 Topics: 0 Location: Orlando, FL
|
Posted: Mon Apr 20, 2009 9:51 pm Post subject: |
|
|
Do you see the expanded SXXKM11 in the listing produced by the DB2 Pre-Compiler? If not, perhaps the library where it resides was not provided to the DB2 Pre-Compiler. _________________ A computer once beat me at chess, but it was no match for me at kick boxing. |
|
Back to top |
|
 |
MFdigger Beginner
Joined: 09 Sep 2005 Posts: 124 Topics: 52 Location: Chicago
|
Posted: Tue Apr 21, 2009 11:30 am Post subject: |
|
|
Hi Ron,
I could see the copy book SXXKM11 expanded in the listing produced in the spool by the DB2 Pre-compiler. _________________ Tx
Digger |
|
Back to top |
|
 |
|
|