IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SQLCODE -311


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kotesh

New User


Joined: 11 May 2005
Posts: 20

PostPosted: Mon Jul 18, 2011 2:54 pm
Reply with quote

SQLCODE IS -311SQLSTATE IS
DSNT408I SQLCODE = -311, ERROR: THE LENGTH OF INPUT HOST VARIABLE
NUMBER 13 IS NEGATIVE OR GREATER THAN THE MAXIMUM
DSNT418I SQLSTATE = 22501 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNXRIHB SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = -188 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'FFFFFF44' X'00000000' X'00000000'


how to resove this ,I have 10 columns in my talble
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jul 18, 2011 3:14 pm
Reply with quote

kotesh wrote:
SQLCODE IS -311SQLSTATE IS
DSNT408I SQLCODE = -311, ERROR: THE LENGTH OF INPUT HOST VARIABLE
NUMBER 13 IS NEGATIVE OR GREATER THAN THE MAXIMUM
DSNT418I SQLSTATE = 22501 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNXRIHB SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = -188 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'FFFFFF44' X'00000000' X'00000000'


how to resove this ,I have 10 columns in my talble


The error is self explanatory...
Code:

-311 THE LENGTH OF INPUT HOST VARIABLE NUMBER position-number IS             
       NEGATIVE OR GREATER THAN THE MAXIMUM                                 
                                                                             
Explanation:  When evaluated, the length specification for input host       
string variable, whose entry in the SQLDA is indicated by position-number,   
was negative or greater than the maximum.                                   
                                                                             
System Action:  The statement cannot be executed.                           
                                                                             
[b]Programmer Response:  Correct the program to ensure that the lengths of     
all host string variables are not negative or that they are not greater     
than the maximum allowed length.   [/b]                                         
                                                                             
SQLSTATE:  22501                                                             
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Jul 18, 2011 3:30 pm
Reply with quote

kotesh,

1. you should know better than to piggy-back onto an old thread that has nothing to do with your question.

2. but, since this thread was about NULL-indicators, etc..
and you say that you only have 10 columns,
yet db2 told you that your 13th was incorrect,

I will guess
that your syntax is bad (if you are using NULL-Indicators).

but, since you did not bother to provide a CUT&PASTE with CODE tags
you can read about BBocde here

we have no idea what your problem is (with your SQL, anyway).
Back to top
View user's profile Send private message
kotesh

New User


Joined: 11 May 2005
Posts: 20

PostPosted: Mon Jul 18, 2011 3:40 pm
Reply with quote

sorry I have 14 columns
Back to top
View user's profile Send private message
kotesh

New User


Joined: 11 May 2005
Posts: 20

PostPosted: Mon Jul 18, 2011 3:47 pm
Reply with quote

INSERT INTO TFACB12_CBRS_ASSET
( INV_COMP_NUM
,INV_FUND_NUM
,INV_ACCT_NUM
,CONTROL_NUM
,CBRS_CNTL_NUM
,INV_DLR_NUM
,BIN_NUM
,PROCESS_DT
,FIRM_NUM
,IN_OUT_IND
,REJECT_CD
,REJ_RSN_DESC
,CBRS_ASSET_REC
,LAST_CHG_TMS )
VALUES
( :CB12-INV-COMP-NUM
,:CB12-INV-FUND-NUM
,:CB12-INV-ACCT-NUM
,:CB12-CONTROL-NUM
,:CB12-CBRS-CNTL-NUM
,:CB12-INV-DLR-NUM
,:CB12-BIN-NUM
,:CB12-PROCESS-DT
,:CB12-FIRM-NUM
,:CB12-IN-OUT-IND
,:CB12-REJECT-CD
,:CB12-REJ-RSN-DESC
,:CB12-CBRS-ASSET-REC
,CURRENT TIMESTAMP)
Back to top
View user's profile Send private message
kotesh

New User


Joined: 11 May 2005
Posts: 20

PostPosted: Mon Jul 18, 2011 3:51 pm
Reply with quote

my file rec-length is BRSO-DATA-AREA-AT PIC X(1000).
and DB2 is CBRS_ASSET_REC VARCHAR(3000)
Back to top
View user's profile Send private message
kotesh

New User


Joined: 11 May 2005
Posts: 20

PostPosted: Mon Jul 18, 2011 4:12 pm
Reply with quote

am waiting for your reply any luck???
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Jul 18, 2011 4:19 pm
Reply with quote

you are actually still asking what is wrong?

well,
the 13th column is CBRS_ASSET_REC
the 13th hostvar is CB12-CBRS_ASSET_REC

i would suggest that the picture definiton of CB12-CBRS_ASSET_REC
does not match that of the ddl definition of CBRS_ASSET_REC.

Quote:
my file rec-length is BRSO-DATA-AREA-AT PIC X(1000).

that makes no sense at all.
what does BRSO-DATA-AREA-AT have to do with CB12-CBRS_ASSET_REC?

since CBRS_ASSET_REC is varchar,
to what value are you setting the varchar length?

have no idea what your host-variable set-up is, but:

CB12-CBRS_ASSET_REC is probably a group item.
CB12-CBRS_ASSET_REC_LEN
and
CB12-CBRS_ASSET_REC_TEXT are probably lvl-49's under the group item.

I hope you are populating CB12-CBRS_ASSET_REC_TEXT
and not
CB12-CBRS_ASSET_REC
with the data

and you are populating CB12-CBRS_ASSET_REC_LEN
with the length of the data you are moving to CB12-CBRS_ASSET_REC_TEXT.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Jul 18, 2011 7:08 pm
Reply with quote

Quote:
am waiting for your reply any luck???

do not pester,
replying is on voluntary basis, free of charge
we reply when and if we feel like, not when You want icon_evil.gif
if You have time constraints a forum is not the best place to ask for help!
Back to top
View user's profile Send private message
wdba

New User


Joined: 24 Apr 2013
Posts: 1
Location: USA

PostPosted: Tue Jan 13, 2015 2:49 am
Reply with quote

Thanks dbzTHEdinosauer. Your answer just helped me as well.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SQLCODE = -122 while using the scalar... DB2 4
No new posts SQLCODE = -16002 when using XMLEXISTS DB2 1
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts SQLCODE=-204 SQLSTATE=42704 DB2 4
No new posts Getting sqlcode 805 while executing R... DB2 10
Search our Forums:

Back to Top