View previous topic :: View next topic
|
Author |
Message |
vimalprabhakaran
New User
Joined: 13 Feb 2006 Posts: 13
|
|
|
|
I am facing problem with a VARCHAR variable.
I have a VARCHAR variable as below
5 INV_DE_VALUE (25) CHAR(254) VAR,
I need to insert a value from position 5 to 15 of this VARCHAR.
So, i used it as
SUBSTR(INV_DE_VALUE(INDEX),5,10) = DCLDUNS.NBR
But when i try to display the value of INV_DE_VALUE(INDEX) it is shown as spaces.
Can any one help me to solve this issue.
what i need is, i have to insert a value to the 5th position of a VARCHAR variable. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Are you talking about VARYING attribute of a variable? |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
First, SUBSTR(var,5,10) accesses positions 5-14, but you said you want 5-15.
Second, what value/length was there before your SUBSTR assignment? Please display it.
Third, please show the value of DCLDUNS.NBR. |
|
Back to top |
|
|
vimalprabhakaran
New User
Joined: 13 Feb 2006 Posts: 13
|
|
|
|
Gnanas SNG wrote: |
Are you talking about VARYING attribute of a variable? |
Yes i meant the VARYING (VAR) |
|
Back to top |
|
|
vimalprabhakaran
New User
Joined: 13 Feb 2006 Posts: 13
|
|
|
|
Phrzby Phil wrote: |
First, SUBSTR(var,5,10) accesses positions 5-14, but you said you want 5-15.
i need to start from position5 and length is 10 (from pos 5 to pos 14). u r right.
Second, what value/length was there before your SUBSTR assignment? Please display it.
the length was 0.
Third, please show the value of DCLDUNS.NBR. |
DCLDUNS.NBR has the value "8743782958" |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
So I think length is still zero.
Did you display blanks or nothing? To answer, display '*' || var || '*'. |
|
Back to top |
|
|
vimalprabhakaran
New User
Joined: 13 Feb 2006 Posts: 13
|
|
|
|
Phrzby Phil wrote: |
So I think length is still zero.
Did you display blanks or nothing? To answer, display '*' || var || '*'. |
I displayed the variable, but it was displayed as spaces. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
How many? Please display as "code" your output. The more info you can give in any one post, the better.
How about also setting a var to the length of your string and showing that as well? |
|
Back to top |
|
|
|