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
 

 

SQLCODE -330 with DB2 V9

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

New User


Joined: 28 Jun 2003
Posts: 7
Location: India

PostPosted: Tue Jul 30, 2013 1:19 am    Post subject: SQLCODE -330 with DB2 V9
Reply with quote

Hi,

I am using DB2 V9 and getting SQLCODE -330 (A STRING CANNOT BE USED BECAUSE IT CANNOT BE PROCESSED) for the below code.

MOVE 'ABCD12' TO EMPNO.

EXEC SQL
SELECT WORKDEPT
INTO :WORKDEPT
FROM EMP
WHERE EMPNO = :EMPNO
END-EXEC.

When I hard code the value of EMPNO in the embedded SQL, like below, it gives me SQLCODE 0.

EXEC SQL
SELECT WORKDEPT
INTO :WORKDEPT
FROM EMP
WHERE EMPNO = 'ABCD12'
END-EXEC.

Can someone help me out on this?

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

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Jul 30, 2013 1:26 am    Post subject:
Reply with quote

Act according to the reason code. You did process the error with DSNTIAR, yes?
Back to top
View user's profile Send private message
jkumarkb

New User


Joined: 28 Jun 2003
Posts: 7
Location: India

PostPosted: Tue Jul 30, 2013 1:44 am    Post subject:
Reply with quote

Hi,

Not sure about DSNTIAR error process. The SQLERRMC gives me 16 as shown below.

SQL ERRMC 16 1

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Jul 30, 2013 2:32 am    Post subject: Reply to: SQLCODE -330 with DB2 V9
Reply with quote

DSNTIAR gives you the formatted error message, with all tokens replced by current values.

From the DB2 10 for z/OS info center, SQL statements on COBOL programs.
Quote:
DSNTIAR syntax:

CALL 'DSNTIAR' USING sqlca message lrecl.

The DSNTIAR parameters have the following meanings:
sqlca
An SQL communication area.
message
An output area, in VARCHAR format, in which DSNTIAR places the message text. The first halfword contains the length of the remaining area; its minimum value is 240.

The output lines of text, each line being the length specified in lrecl, are put into this area. For example, you could specify the format of the output area as:
Code:
01  ERROR-MESSAGE.
        02  ERROR-LEN   PIC S9(4)  COMP VALUE +1320.
        02  ERROR-TEXT  PIC X(132) OCCURS 10 TIMES
                                   INDEXED BY ERROR-INDEX.
77  ERROR-TEXT-LEN      PIC S9(9)  COMP VALUE +132.

CALL 'DSNTIAR' USING SQLCA ERROR-MESSAGE ERROR-TEXT-LEN.

where ERROR-MESSAGE is the name of the message output area containing 10 lines of length 132 each, and ERROR-TEXT-LEN is the length of each line.
lrecl
A fullword containing the logical record length of output messages, between 72 and 240.

An example of calling DSNTIAR from an application appears in the DB2 sample assembler program DSN8BC3, which is contained in the library DSN81010.
Back to top
View user's profile Send private message
jkumarkb

New User


Joined: 28 Jun 2003
Posts: 7
Location: India

PostPosted: Tue Jul 30, 2013 9:50 am    Post subject: Reply to: SQLCODE -330 with DB2 V9
Reply with quote

Hi,

Thank you for the reply.

I have already got the details of the error from SQLCA. Just now used CALL 'DSNTIAR' to get the below details.


ERROR MESSAGE: DSNT408I SQLCODE = -330, ERROR: A STRING CANNOT BE USED BECAUSE IT CANNOT BE PROCESSED. REASON 16, CHARACTER , HOST VARIABLE 1 DSNT418I SQLSTATE = 22021 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNXRIHB SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 580 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'00000244' X'00000000' X'00000000' X'FFFFFFFF' X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION

I am still getting -330 when I use string value in the select. My concern is how to resolve the issue.

Regards,
Jay
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Tue Jul 30, 2013 12:14 pm    Post subject:
Reply with quote

Hi,

What is the PIC clause for EMPNO ?

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

New User


Joined: 28 Jun 2003
Posts: 7
Location: India

PostPosted: Tue Jul 30, 2013 5:48 pm    Post subject:
Reply with quote

Hi,

Table declaration is EMPNO CHAR(6) NOT NULL and in DCL copybbok, it is EMPNO PIC X(6)
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Tue Jul 30, 2013 6:37 pm    Post subject:
Reply with quote

Hi,

If this is the case in which way you have mentioned in previous posts, then it should not happen..

As per my opinion you should get in touch with IBM support provided all metioned information is correct.

may be other senior members of forum will be in position to guide you correctly

Regards,
Chandan
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 186
Location: chennai

PostPosted: Tue Jul 30, 2013 9:36 pm    Post subject: Reply to: SQLCODE -330 with DB2 V9
Reply with quote

Hi Jay,
Since you are getting a REASON CODE of 16, it may be related to invalid MIXED data. Form the DB2 manual "If the reason-code is 16 and the string is described as MIXED data, either change its description or the string to conform to the rules for well-formed mixed data."

Please conform this with your seniors/peers if you are not able to sort it out.

Regards
Raghunathan
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Tue Jul 30, 2013 10:58 pm    Post subject:
Reply with quote

Reason code is 16.
I did some reading and I think this may have to do with MIXED DATA parameter under DSNTIPF.

If this parameter is set to YES, the string data may be interpreted as MIXED. Do check with your DBA about installation defaults.

I haven't meddled with CCSID field before but check if you have CCSID(37) while compiling your program.
Back to top
View user's profile Send private message
jkumarkb

New User


Joined: 28 Jun 2003
Posts: 7
Location: India

PostPosted: Wed Jul 31, 2013 1:00 pm    Post subject:
Reply with quote

Hi,

This is what I got from the DBA for the Database installation.

8 DSNHMCIM SCCSID=1047, X
9 MCCSID=65534, X
0 GCCSID=65534, X
1 MIXED=NO


And from Pre-compiler output of the program, it gives CCSID(500).

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

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Wed Jul 31, 2013 7:14 pm    Post subject:
Reply with quote

CCSID(500) may be the issue.
Please go through this link to find out more about CCSID values and their significance.
I ought to do some further reading before I can provide a conclusive answer but looks like your precompiler value is not matching with the system default.

The default value is the subsystem EBCDIC CCSID (DECP value SCCSID if MIXED=NO or MCCSID if MIXED=YES).
Check if your precompiler overrides the installation default. My shop default is CCSID 37, indicating EBCDIC encoding.
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 SQLCODE-000000080N priya91 DB2 1 Mon Feb 01, 2016 4:35 pm
No new posts Need to understand SQLCODE = 12 rohanthengal DB2 3 Thu Nov 05, 2015 11:22 am
No new posts SQLCODE -922 in Batch-Cics program tr... kishpra CICS 2 Thu Sep 10, 2015 12:36 pm
No new posts SQLCODE -450 for stored procedure spoorni DB2 3 Fri Jan 16, 2015 2:45 am
No new posts -81 SQLCODE returned when Remote Stor... kameswaramanoj.Akella DB2 1 Wed Dec 03, 2014 5:36 am


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