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
 

 

VARCHAR definition..if length is not given what will happen?

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

New User


Joined: 20 Jun 2007
Posts: 2
Location: noida

PostPosted: Thu Jul 29, 2010 4:56 pm    Post subject: VARCHAR definition..if length is not given what will happen?
Reply with quote

Hi,

Define host variables for VARCHAR cols in DB2 as fallows:

01 varchar.
49 len pic 9(4) comp.
49 data pic x(200).

My Question's are:

1) Can I define the length variable other than 'COMP' picture clause mentioned above in Sql DB2?

2) What happened If I have not given the length parameter in the Varchar definition?? What abend code it will send?? Should it will take the default length??

vverma9,Mumbai
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Jul 29, 2010 5:40 pm    Post subject:
Reply with quote

1) no
2) won't work.
don't know,don't care.
no
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Fri Jul 30, 2010 4:18 pm    Post subject:
Reply with quote

I have seen few working codes handling varchar without the length variable. This would work only for selects. I had to modify one such program and I followed the variable definitions. The update and inserts were not appropriate without the length variable.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jul 30, 2010 6:00 pm    Post subject:
Reply with quote

you can not reference the 49 levels in sql, you must reference the group item.

and as Bharath Bhat said,
with select, db2 sets the length-variable.

UPDATE, INSERT you have to set the host variable to an appropriate value
before invoking the SQL
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jul 30, 2010 6:54 pm    Post subject:
Reply with quote

On an update or insert DB2 will use the first 2 bytes as the length!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jul 30, 2010 7:01 pm    Post subject:
Reply with quote

dbz wrote:
you can not reference the 49 levels in sql, you must reference the group item
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 How to see VIEW definition from BMC c... rohanthengal DB2 1 Thu May 04, 2017 1:50 pm
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm


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