MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Right trim

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
visa
Beginner


Joined: 12 Sep 2006
Posts: 6
Topics: 5

PostPosted: Mon Nov 06, 2006 4:26 am    Post subject: Right trim Reply with quote

Hi all,

We are facing some problem with string manipulations. The problem is as follows.

We are getting a varchar(253) value from a DCLGEN variable into a working storage variable.

The obtained string contains data as follows

<start of string>Xxxxxxxxxxxxxxxxx yyyyyyyyyyyyy <end of string>

We need only
Back to top
View user's profile Send private message Send e-mail
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Mon Nov 06, 2006 5:29 am    Post subject: Reply with quote

Try to DISPLAY the variable's content, and take a look in HEX mode.

O.
________
VERMONT MEDICAL MARIJUANA DISPENSARY


Last edited by ofer71 on Thu Mar 17, 2011 10:53 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Nov 06, 2006 7:42 am    Post subject: Reply with quote

as ofer71 implied, it seems as if you are not aware of the delimiter (what separates x and y).

keep in mind, you host-variable size is 253. After the select, DB2 has only supplied data for the the length (of that particular column; next row could have a smaller or larger varchar). what that means is if your host-variable is 253 and you only receive 200, byte 201 to 253 contains whatever was left from last load of the field.

1. you need to determine what delimits x and y.

2. you need to use the length returned by DB2 for the current returned varchar.

3. why are you reversing? don't you have to reverse it again for your output?

4. when you know the delimiter, use it in an unstring to separate the x from the y. you can always place your own delimiter after the y (reference modification (length of varchar returned by DB2:1). your unstring needs 3 fields. the x container, the y container, the rest. your delimiting phrase for y can be a double - space or your delimiter.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
visa
Beginner


Joined: 12 Sep 2006
Posts: 6
Topics: 5

PostPosted: Tue Nov 07, 2006 5:46 am    Post subject: Reply with quote

hi all

i got the desired output..
in the IF condition where i'm checking for SPACEs i also have to check for LOW-VALUES.

anyone who is doin gsuch kind of thing please make this sure..

Thanks
visa
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group