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
 

 

INSERTING VARCHAR INTO DB2 TABLE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    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

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
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: 1187
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
Currently Banned

New User


Joined: 04 May 2008
Posts: 15
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: 1187
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
Currently Banned

New User


Joined: 04 May 2008
Posts: 15
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
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 Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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