IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Getting a compilation error for host variables


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Fri Aug 21, 2009 12:42 pm
Reply with quote

Hi,

I have a cobol db2 program which has the following db2 query embedded in it.

Code:
EXEC SQL                                           
   SELECT  ENTY_ID                                 
   INTO   :WS-ENTY-ID                               
   FROM    TEPPROD                                 
   WHERE   RTRIM(LTRIM(PROD_ID)) = :ROAS-MASTER-KEY
   AND     SRC_FRNCHS_VAL = 'MLFS'                 
END-EXEC                                           


The corresponding declaration of the host variables are as under (in working storage)

Code:
05  WS-ENTY-ID              PIC 9(09) VALUE ZERO.
02  ROAS-MASTER-KEY.                         
  05  ROAS-CURRENT-DAI.                       
      10  ROAS-CURRENT-DISTRICT PIC X(03).   
      10  ROAS-CURRENT-AGENCY   PIC X(03).   
      10  ROAS-CURRENT-INDEX    PIC X(01).   


The table fields types are
ENTY_ID --Integer
PROD_ID -- char 50
SRC_FRNCHS_VAL char 50.

While compilation I am getting an error of

Code:
UNDEFINED OR UNUSABLE HOST VARIABLE "WS-ENTY-ID"     
UNDEFINED OR UNUSABLE HOST VARIABLE "ROAS-MASTER-KEY"


Can anyone help on this.To me it seems that all the declarations have been made and with appropiate data types as well --still i am getting this error
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Aug 21, 2009 1:03 pm
Reply with quote

Hi Kamlesh,

If I am correct, the equivalent of integer in DB2 is S9(09) COMP in COBOL. Please verify with the manuals...

Secondly, regarding ROAS-MASTER-KEY field, again, if my memory is correct, group variables cannot be directly referred to in a Query. You may be required to redefine the variables to use it.
Back to top
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Fri Aug 21, 2009 4:44 pm
Reply with quote

Hi Binop,

Thanks ..it helped...got it resolved..
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Aug 21, 2009 4:46 pm
Reply with quote

Nice to hear that... icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts access the last host command CLIST & REXX 2
Search our Forums:

Back to Top