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
 
Facing bind problem when using host variable in SUBSTR

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

New User


Joined: 03 Nov 2005
Posts: 19

PostPosted: Tue Oct 30, 2007 7:28 pm    Post subject: Facing bind problem when using host variable in SUBSTR
Reply with quote

Hi All

Facing bind problem when using host variable in SUBSTR giving -206

In below query WS-VAR is hostvariable,but it is not a column name of table XYZ, I am moving value to WS-VAR based on my input which is from flat file.

I am using STATIC SQL. Is it possible to do like below with static SQL, If it is possible help me with some sample program and DCLGEN also

SELECT STATE
INTO :WS-ST
FROM XYZ
WHERE SUBSTR(STATE,:WS-VAR,2) = :A
AND B = :B
AND C = :C

Thanks In advance
Deva...
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Oct 30, 2007 7:35 pm    Post subject: Re: Facing bind problem when using host variable in SUBSTR
Reply with quote

deva wrote:
Hi All

Facing bind problem when using host variable in SUBSTR giving -206

In below query WS-VAR is hostvariable,but it is not a column name of table XYZ, I am moving value to WS-VAR based on my input which is from flat file.

I am using STATIC SQL. Is it possible to do like below with static SQL, If it is possible help me with some sample program and DCLGEN also

SELECT STATE
INTO :WS-ST
FROM XYZ
WHERE SUBSTR(STATE,:WS-VAR,2) = :A
AND B = :B
AND C = :C

Thanks In advance
Deva...


How is STATE defined and how is ws-var defined.
Back to top
View user's profile Send private message
deva

New User


Joined: 03 Nov 2005
Posts: 19

PostPosted: Tue Oct 30, 2007 8:44 pm    Post subject: Reply to: Facing bind problem when using host variable in SU
Reply with quote

STATE is table column,WS-STAT as CHAR, WS-VAR considered as CHAR
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Oct 30, 2007 8:55 pm    Post subject: Re: Reply to: Facing bind problem when using host variable i
Reply with quote

deva wrote:
STATE is table column,WS-STAT as CHAR, WS-VAR considered as CHAR

Where you are using ws-var in the sql an integer is required.
Back to top
View user's profile Send private message
deva

New User


Joined: 03 Nov 2005
Posts: 19

PostPosted: Tue Oct 30, 2007 9:44 pm    Post subject: Reply to: Facing bind problem when using host variable in SU
Reply with quote

In working storage section..

01 WS-VAR PIC 99.
01 WS-FIELDS.
05 WS-ST PIC XX.

In my program I am not using any DCLGEN. my main intension is can we able to pass value to host variable in substring. I am able to do this with dyanmic SQL, but which is expensive.

So I am looking for STATIC sql solution.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Oct 30, 2007 10:04 pm    Post subject: Re: Reply to: Facing bind problem when using host variable i
Reply with quote

deva wrote:
In working storage section..

01 WS-VAR PIC 99.
01 WS-FIELDS.
05 WS-ST PIC XX.

In my program I am not using any DCLGEN. my main intension is can we able to pass value to host variable in substring. I am able to do this with dyanmic SQL, but which is expensive.

So I am looking for STATIC sql solution.

I am not sure if you can do it or not. ws-var pic s9(9) comp might work or
WHERE STRPOS(STATE, :A) = :WS-VAR again with ws-var defined as comp might work.
Back to top
View user's profile Send private message
deva

New User


Joined: 03 Nov 2005
Posts: 19

PostPosted: Tue Oct 30, 2007 10:18 pm    Post subject: Reply to: Facing bind problem when using host variable in SU
Reply with quote

Hey Craq Now I am able to bind..Need to check my data

Thanks a lot for your help.
Deva...
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 LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm

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