View previous topic :: View next topic |
Author |
Message |
visa Beginner
Joined: 12 Sep 2006 Posts: 6 Topics: 5
|
Posted: Mon Nov 06, 2006 4:26 am Post subject: Right trim |
|
|
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 |
|
|
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Mon Nov 06, 2006 5:29 am Post subject: |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Mon Nov 06, 2006 7:42 am Post subject: |
|
|
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 |
|
|
visa Beginner
Joined: 12 Sep 2006 Posts: 6 Topics: 5
|
Posted: Tue Nov 07, 2006 5:46 am Post subject: |
|
|
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 |
|
|
|
|