View previous topic :: View next topic
|
Author |
Message |
jkumarkb
New User
Joined: 28 Jun 2003 Posts: 7 Location: India
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Act according to the reason code. You did process the error with DSNTIAR, yes? |
|
Back to top |
|
|
jkumarkb
New User
Joined: 28 Jun 2003 Posts: 7 Location: India
|
|
|
|
Hi,
Not sure about DSNTIAR error process. The SQLERRMC gives me 16 as shown below.
SQL ERRMC 16 1
Regards,
Jay |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
jkumarkb
New User
Joined: 28 Jun 2003 Posts: 7 Location: India
|
|
|
|
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 |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Hi,
What is the PIC clause for EMPNO ?
Regards,
Chandan |
|
Back to top |
|
|
jkumarkb
New User
Joined: 28 Jun 2003 Posts: 7 Location: India
|
|
|
|
Hi,
Table declaration is EMPNO CHAR(6) NOT NULL and in DCL copybbok, it is EMPNO PIC X(6) |
|
Back to top |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
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 |
|
|
Raghu navaikulam
Active User
Joined: 27 Sep 2008 Posts: 193 Location: chennai
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
jkumarkb
New User
Joined: 28 Jun 2003 Posts: 7 Location: India
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
|