Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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
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    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

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 785
Location: Chennai, 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

Active Member


Joined: 31 Oct 2006
Posts: 962
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: 13

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: 13

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

Active Member


Joined: 31 Oct 2006
Posts: 962
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: 13

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

Active Member


Joined: 31 Oct 2006
Posts: 962
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Insert Lines in JCL with Rexx after a... Willy Jensen CLIST & REXX 3 Tue Aug 30, 2016 4:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm
No new posts How do I right justify a string in an... rakesh17684 DB2 1 Wed Jun 08, 2016 8:01 pm
No new posts insert the same records but chancing ... danylele74 DB2 6 Mon May 02, 2016 7:22 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us