IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Insert a value from position 5 to 15 of this VARCHAR


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vimalprabhakaran

New User


Joined: 13 Feb 2006
Posts: 13

PostPosted: Wed May 21, 2008 5:34 pm
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
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Wed May 21, 2008 5:39 pm
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: 1042
Location: Richmond, Virginia

PostPosted: Wed May 21, 2008 5:58 pm
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: 13

PostPosted: Wed May 21, 2008 7:50 pm
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: 13

PostPosted: Wed May 21, 2008 7:53 pm
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: 1042
Location: Richmond, Virginia

PostPosted: Wed May 21, 2008 8:10 pm
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: 13

PostPosted: Thu May 22, 2008 11:12 am
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: 1042
Location: Richmond, Virginia

PostPosted: Thu May 22, 2008 6:13 pm
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts Identify Program Insert DB2 7
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
Search our Forums:

Back to Top