Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Insert a value from position 5 to 15 of this VARCHAR

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER
Author Message
vimalprabhakaran

New User


Joined: 13 Feb 2006
Posts: 12

PostPosted: Wed May 21, 2008 5:34 pm    Post subject: Insert a value from position 5 to 15 of this VARCHAR
Reply with quote

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
View user's profile Send private message
References
Gnanas SNG

Senior Member


Joined: 06 Sep 2007
Posts: 445
Location: India

PostPosted: Wed May 21, 2008 5:39 pm    Post subject:
Reply with quote

Are you talking about VARYING attribute of a variable?
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 497
Location: Richmond, Virginia

PostPosted: Wed May 21, 2008 5:58 pm    Post subject:
Reply with quote

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
View user's profile Send private message
vimalprabhakaran

New User


Joined: 13 Feb 2006
Posts: 12

PostPosted: Wed May 21, 2008 7:50 pm    Post subject:
Reply with quote

Gnanas SNG wrote:
Are you talking about VARYING attribute of a variable?


Yes i meant the VARYING (VAR)
Back to top
View user's profile Send private message
vimalprabhakaran

New User


Joined: 13 Feb 2006
Posts: 12

PostPosted: Wed May 21, 2008 7:53 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 497
Location: Richmond, Virginia

PostPosted: Wed May 21, 2008 8:10 pm    Post subject:
Reply with quote

So I think length is still zero.

Did you display blanks or nothing? To answer, display '*' || var || '*'.
Back to top
View user's profile Send private message
vimalprabhakaran

New User


Joined: 13 Feb 2006
Posts: 12

PostPosted: Thu May 22, 2008 11:12 am    Post subject:
Reply with quote

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
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 497
Location: Richmond, Virginia

PostPosted: Thu May 22, 2008 6:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER All times are GMT + 6 Hours
Page 1 of 1