View previous topic :: View next topic
|
Author |
Message |
satishboddu
New User
Joined: 02 Aug 2011 Posts: 17 Location: India
|
|
|
|
Hi,
We are facing problems in inserting/fetching data into a VARCHAR column defined on a table using Multi row insert/fetch option.
Please let me know, will it be possible doing a multi row operation on VARCHAR column of DB2 table.
Thanks
Satish |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
instead of a generic whining...
it would have been better if You had told what kind of problem You faced
what also about looking at the manuals Yourself for the messages received |
|
Back to top |
|
|
satishboddu
New User
Joined: 02 Aug 2011 Posts: 17 Location: India
|
|
|
|
Code: |
EXEC SQL
FETCH NEXT ROWSET FROM GTT_CSR FOR 100 ROWS
INTO :WR-FIRST-REC
END-EXEC
05 WR-FIRST-REC.
10 WR-RULE-NO PIC X(03) VALUE SPACES OCCURS 100 TIMES.
10 WR-SEQ-NUM PIC X(04) VALUE SPACES OCCURS 100 TIMES.
10 WR-SELECT-VAR.
49 WR-SEL-LN PIC S9(04) USAGE COMP
OCCURS 100 TIMES.
49 WR-SELECT PIC X(470) VALUE SPACES
OCCURS 100 TIMES.
10 WR-WHERE PIC X(23) VALUE SPACES
OCCURS 100 TIMES.
10 WR-FROM PIC X(50) VALUE SPACES
OCCURS 100 TIMES. |
Please find above snippet, we tried to display data after fetch from this variables, we don't be able to see right data at VARCHAR column(data misplaced) while rest of all showing correct data as present in table.
Code: |
WS-SEL-LEN :094M
WS-SELECT :
CASE WHEN QTB_50_SUB
QTB_20_TMR_FED_W2_MAG_PIN_C = ' ') THEN CWA_RO_ZIP_5 ELSE CASE WHEN QTB_20_CO_L
<> 'Y
WS-WHERE : |
As we see in the above Display statement , the WS-SELECT show text starting at some random position instead of starting at 1st position.
This is the problem we are facing.
Pls suggest. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
suggest you go back to the manual.
your syntax is incorrect. |
|
Back to top |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Hi Satish,
While using VARCHAR column in multi fetch you need to give SYNC clause for length defination of varchar column.
So your defination for Varchar column should be liek below
Code: |
10 WR-SELECT-VAR OCCURS 100 TIMES.
49 WR-SEL-LN PIC S9(04) USAGE COMP SYNC.
49 WR-SELECT PIC X(470) VALUE SPACES . |
Please check this out and let us know if it works for you
Regards,
Chandan |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
Back to top |
|
|
satishboddu
New User
Joined: 02 Aug 2011 Posts: 17 Location: India
|
|
|
|
Thanks Chandan,
We are able to get correct results. Thank You so much.
|
|
Back to top |
|
|
|