MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DSNH312I - UNDEFINED OR UNUSABLE HOST VARIABLE

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
MFdigger
Beginner


Joined: 09 Sep 2005
Posts: 124
Topics: 52
Location: Chicago

PostPosted: Mon Apr 20, 2009 11:29 am    Post subject: DSNH312I - UNDEFINED OR UNUSABLE HOST VARIABLE Reply with quote

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?
Question
_________________
Tx
Digger
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Mon Apr 20, 2009 12:10 pm    Post subject: Reply with quote

MFdigger,

You sure do like to make things complicated don't you? Refer the variable directly

Code:

VIN_CD = :VINCD


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
View user's profile Send private message Send e-mail Visit poster's website
MFdigger
Beginner


Joined: 09 Sep 2005
Posts: 124
Topics: 52
Location: Chicago

PostPosted: Mon Apr 20, 2009 1:09 pm    Post subject: Reply with quote

Hi Kolusu

VINCD is not a unique in the program, 2 other copybooks has the same varibale name
_________________
Tx
Digger
Back to top
View user's profile Send private message
RonB
Beginner


Joined: 02 Dec 2002
Posts: 93
Topics: 0
Location: Orlando, FL

PostPosted: Mon Apr 20, 2009 4:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
MFdigger
Beginner


Joined: 09 Sep 2005
Posts: 124
Topics: 52
Location: Chicago

PostPosted: Mon Apr 20, 2009 4:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
RonB
Beginner


Joined: 02 Dec 2002
Posts: 93
Topics: 0
Location: Orlando, FL

PostPosted: Mon Apr 20, 2009 9:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
MFdigger
Beginner


Joined: 09 Sep 2005
Posts: 124
Topics: 52
Location: Chicago

PostPosted: Tue Apr 21, 2009 11:30 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group