Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need More Clarification on 'IN'

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 237

PostPosted: Thu Apr 22, 2010 2:20 pm    Post subject: Need Clarification on 'IN'
Reply with quote

Need Clarification on 'IN'
Hi Dick Brenholtz,

I used host variable-array in the below SQL statements, but i got compilation error as 'UNUSABLE HOST VARIABLE'. <my DB2 version is 9.5>, Is host variable array is applicable only for multi-row fetch and insert then i tried for select,

EXEC SQL
DECLARE CSR1 CURSOR
SELECT C1 FROM TAB1
WHERE C2 IN(:WS-VAR-GRP)
END-EXEC

Declaration for WS-VAR-GRP
01 WS-VAR-GRP.
03 WS-VAR-ARR OCCURS 20 TIMES.
05 WS-VAR PIC S9(9) COMP.

in my previous posting i didn't get the compilation when i declared as,

Declaration for WS-VAR-GRP
01 WS-VAR-GRP.
05 WS-VAR1 PIC S9(9) COMP.
05 WS-VAR2 PIC S9(9) COMP.
.
.
.
05 WS-VAR20 PIC S9(9) COMP.

Is any slack variable(assumption) or any other stuff which prevents to operate on host variable array?

Please clarify.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Thu Apr 22, 2010 4:56 pm    Post subject:
Reply with quote

DB2 can interpret things like
Code:

01 WS-VAR-GRP.
    05 filler  PIC S9(9) COMP.
    05 filler  PIC S9(9) COMP.
    05 filler  PIC S9(9) COMP.


but does not like it when you use the OCCURS clause.

so, if you need a cobol internal table
have the table redefine the group item
Code:

01 WS-VAR-GRP.
    05 filler  PIC S9(9) COMP.
    05 filler  PIC S9(9) COMP.
...
    05 filler  PIC S9(9) COMP.

01 ws-var-tab.
    05  ws-var-item occurs 20 times.
         10  ws-var-element PIC s9(9) comp.



the other thread mentioned this -
you can not use a host variable array in an IN clause
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need clarification of VSAM FCT and DF... pkmurali CICS 15 Sun Apr 10, 2016 1:06 am
No new posts Clarification regarding BUFNI & B... thirumalasetty JCL & VSAM 14 Tue Jun 17, 2014 8:22 pm
No new posts DB2 9 - Utilities - COPY,REORG Clarif... gylbharat DB2 3 Mon Oct 22, 2012 12:30 pm
No new posts Clarification on INDEX & SET stat... yugendran COBOL Programming 2 Sat Feb 11, 2012 5:32 pm
No new posts Evaluate statement - clarification Vijay Subramaniyan COBOL Programming 2 Fri Feb 03, 2012 1:53 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us