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 -311

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: SQLCODE => :-311
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    Post subject: Re: SQLCODE => :-311
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Jul 18, 2011 7:08 pm    Post subject: Reply to: SQLCODE -311
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    Post subject: Reply to: SQLCODE -311
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    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