Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

-206 SQL error code

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

New User


Joined: 19 Apr 2006
Posts: 63
Location: Chennai

PostPosted: Thu Aug 19, 2010 12:32 pm    Post subject: -206 SQL error code
Reply with quote

Hi,

I am reading date field from the file and using date filed retrieving records from the table, but inthe compilation i am getting -206 abend code.


definition:
declare <table name> Cursor for
select
field1,
field2
where (date-field1 = '01/01/0001'
and date-field2 = '01/01/0001')
and (date-field1 = ws-file-date
or date-field2 = ws-file-date)

i am getting for the fields ws-file-date.

Thanks in advance.

Regards,
Vijay
Back to top
View user's profile Send private message

Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Aug 19, 2010 12:45 pm    Post subject:
Reply with quote

how about using :ws-file-date and reading about host variables.
Back to top
View user's profile Send private message
vijayakumar.yellala

New User


Joined: 19 Apr 2006
Posts: 63
Location: Chennai

PostPosted: Thu Aug 19, 2010 12:50 pm    Post subject:
Reply with quote

already test that, that is not a host variable. its not worked
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Aug 19, 2010 12:51 pm    Post subject:
Reply with quote

BTW, your query will not retrieve any rows unless ws-file-date has '01/01/0001' in which case, the where clause is redundant.
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Aug 19, 2010 12:55 pm    Post subject:
Reply with quote

vijayakumar.yellala wrote:
already test that, that is not a host variable. its not worked


Tested what? if it did not work what was the error? Please post the error message completely.

And the variable in the SQL is a host variable. I am not bothered if you think otherwise. And as far as my knowledge goes, using a colon(':') before the host variable will definitely make it work.
Back to top
View user's profile Send private message
vijayakumar.yellala

New User


Joined: 19 Apr 2006
Posts: 63
Location: Chennai

PostPosted: Thu Aug 19, 2010 1:04 pm    Post subject:
Reply with quote

USING DB2ISDB AUTHORITY
STATEMENT=335
SQLCODE=-206
SQLSTATE=42703
TOKENS=WS-ACTIVITY-DATE
CSECT NAME=DSNXORSO
RDS CODE=-100

I have mentioned where clause wrongly.

right one is below.
where (date-field1 <> '01/01/0001'
and date-field2 <> '01/01/0001')
and (date-field1 = ws-file-date
or date-field2 = ws-file-date)

Regards
Vjay
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Aug 19, 2010 1:16 pm    Post subject:
Reply with quote

Are you sure you are showing us the query which is giving error?
Because, WS-ACTIVITY-DATE is not used in the sql you are showing.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Thu Aug 19, 2010 1:36 pm    Post subject:
Reply with quote

of course it is not verbatim:
you must have : before ws-activty-date as already stated is post 2
afaik you can't have a column with - in the name, so date-field1 is not very likely.
Back to top
View user's profile Send private message
vijayakumar.yellala

New User


Joined: 19 Apr 2006
Posts: 63
Location: Chennai

PostPosted: Thu Aug 19, 2010 6:41 pm    Post subject:
Reply with quote

Hi all,

I have mentioned below what i have tested.

option1: WHERE (RTL_SALE_DT <> '01-01-0001'
AND IN_SVC_DT <> '01-01-0001')
AND (RTL_SALE_DT = WS-ACTIVITY-DATE
OR IN_SVC_DT = WS-ACTIVITY-DATE)

error msg:
- BIND SQL ERROR
USING DB2ISDB AUTHORITY
PLAN=ZRS1055P
DBRM=ZRS1055
STATEMENT=353
SQLCODE=-206
SQLSTATE=42703
TOKENS=WS-ACTIVITY-DATE
CSECT NAME=DSNXORSO
RDS CODE=-100

Option 2:


WHERE (RTL_SALE_DT <> '01-01-0001'
AND IN_SVC_DT <> '01-01-0001')
AND (RTL_SALE_DT = :WS-ACTIVITY-DATE
OR IN_SVC_DT = :WS-ACTIVITY-DATE)

error msg:

UNDEFINED OR UNUSABLE HOST VARIABLE "WS-ACTIVITY-DATE"

even i have defined in the working storage:
01 WS-ACTIVITY-DATE.
05 WS-ACTIVITY-DATE-MM PIC X(02).
05 FILLER PIC X(01) VALUE '-'.
05 WS-ACTIVITY-DATE-DD PIC X(02).
05 FILLER PIC X(01) VALUE '-'.
05 FILLER PIC X(02) VALUE '20'.
05 WS-ACTIVITY-DATE-YY PIC X(02).

Thanks in Advance.

Regards,
Vijay
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Aug 19, 2010 7:07 pm    Post subject:
Reply with quote

The second sql is correct. The problem is with the declaration of the host variable WS-ACTIVITY-DATE. This should have a picture clause to be a usable host variable. Try giving PIC X(10) and check if it compiles.
Back to top
View user's profile Send private message
vijayakumar.yellala

New User


Joined: 19 Apr 2006
Posts: 63
Location: Chennai

PostPosted: Thu Aug 19, 2010 8:03 pm    Post subject:
Reply with quote

Thanks Bharath Bhat......
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 S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us