Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
INSERTING VARCHAR INTO DB2 TABLE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
siddhartha biswas

New User


Joined: 04 May 2008
Posts: 13
Location: india

PostPosted: Mon Oct 20, 2008 6:03 pm    Post subject: INSERTING VARCHAR INTO DB2 TABLE
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
References
Craq Giegerich

Senior Member


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

PostPosted: Mon Oct 20, 2008 6:14 pm    Post subject:
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: 1024
Location: Bangalore,India

PostPosted: Mon Oct 20, 2008 6:16 pm    Post subject:
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

New User


Joined: 04 May 2008
Posts: 13
Location: india

PostPosted: Mon Oct 20, 2008 6:24 pm    Post subject: Reply to: INSERTING VARCHAR INTO DB2 TABLE
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: 1024
Location: Bangalore,India

PostPosted: Mon Oct 20, 2008 6:26 pm    Post subject:
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

New User


Joined: 04 May 2008
Posts: 13
Location: india

PostPosted: Mon Oct 20, 2008 7:01 pm    Post subject: Reply to: INSERTING VARCHAR INTO DB2 TABLE
Reply with quote

It worked !! thanks a lot
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1