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

INSERTING VARCHAR INTO DB2 TABLE


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
siddhartha biswas
Currently Banned

New User


Joined: 04 May 2008
Posts: 15
Location: india

PostPosted: Mon Oct 20, 2008 6:03 pm
Reply with quote

A FIELD IN DB2 TADLE IS DECLARED AS VARCHAR 100. I NEED TO INSERT A STRING IN THIS FIELD. I HAVE A COPYBOOK WHICH IS DECLARED AS

10 ABC.
49 ABC-LEN PIC S9(4) USAGE COMP.
49 ABC-TEXT PIC X(100).


IF I MOVE THE STRING INTO 'ABC-TEXT' THEN AFTER INSERT ROUTINE THE FIELD IN THE TABLE IS BLANK.

IF I MOVE THE STRING INTO 'ABC' THEN AFTER INSERT ROUTINE I AM GETTING SQL ERROR -311.

PLEASE TELL ME A SOLUTION
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Mon Oct 20, 2008 6:14 pm
Reply with quote

Did you happen to notice that ABC has two subfields, ABC-LEN and ABC-TEXT? You need to populate both of them.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Mon Oct 20, 2008 6:16 pm
Reply with quote

Hi Siddartha,

Can you please populate ABC-LEN with the length of your text.
Back to top
View user's profile Send private message
siddhartha biswas
Currently Banned

New User


Joined: 04 May 2008
Posts: 15
Location: india

PostPosted: Mon Oct 20, 2008 6:24 pm
Reply with quote

THE STRIND TO BE INSERTED HAS GAPS/ SPACES IN BETWEEN SO CANT FIND THE LENGTH I GUESS...
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Mon Oct 20, 2008 6:26 pm
Reply with quote

Hi Siddartha,

Please do not use caps lock

Quote:
THE STRIND TO BE INSERTED HAS GAPS/ SPACES IN BETWEEN SO CANT FIND THE LENGTH I GUESS...


You just need to calculate the length of string which you want to insert in that column
Eg: If you want to enter " insert varchar in to db2 table" then populate
ABC-LEN with 30

Hope it will helpful
Back to top
View user's profile Send private message
siddhartha biswas
Currently Banned

New User


Joined: 04 May 2008
Posts: 15
Location: india

PostPosted: Mon Oct 20, 2008 7:01 pm
Reply with quote

It worked !! thanks a lot
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 Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top