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
 

 

Multi row fetch for a VARCHAR

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

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Tue Aug 26, 2008 12:22 pm    Post subject: Multi row fetch for a VARCHAR
Reply with quote

Hi All,

I am doing a multi row fetch from a table which has got a VARCHAR field of 255 maximum lenght. Now I am having a problem, like I am getting only lenth part populated for first occurance of the VARCHAR data. What happens is length part gets pushed into the data part by one byte, for all the remining occurance of this VARCHAR field alone. and lenth is not getting populated correctly!

Code:
Code:
 05  MY-FIELD           OCCURS 100 TIMES. 
   49  MY-FIELD-LENGTH         PIC S9(04) COMP.
   49  MY-FIELD-DATA            PIC  X(255). 

I am fetching into var MY-FIELD, the VARCHAR field. Can any body help be with the proble here. I have shown the lenth being entering into the data part below in hex:
Code:
 TESTDATA-11
0ECEECCEC6FF
B35234131011


Looking forward to your suggestions!
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Aug 26, 2008 1:53 pm    Post subject:
Reply with quote

what does your CURSOR DECLARE and FETCH look like?
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Mon Sep 01, 2008 12:19 pm    Post subject:
Reply with quote

Try SYNC with the length host variable.

05 MY-FIELD OCCURS 100 TIMES.
49 MY-FIELD-LENGTH PIC S9(04) COMP SYNC.
49 MY-FIELD-DATA PIC X(255).
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Wed Sep 03, 2008 5:27 pm    Post subject:
Reply with quote

Thanks a lot Umesh!

It worked out icon_biggrin.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Sep 03, 2008 6:24 pm    Post subject:
Reply with quote

Umesh,

that is definitely a keeper.
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 Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts Reading selected volumes of a multi-v... RickBig JCL & VSAM 6 Wed Jul 13, 2016 7:26 pm
No new posts JCL to fetch schedule status from act... parasmalik20 CA Products 1 Thu Jun 02, 2016 7:11 pm


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