Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Offset length synatx

Former Member
0 Likes
641

Hi,

I need to read 4 from the output 'F04' that is the last character and add 1 to it.

Can some one tell me the syntax for it.

Thanks,

Subha

Edited by: subhashini reddy on Apr 24, 2008 4:22 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
618

Hi Subha,

If the output is char type

data: p(3) type char.

take a another character type one char length

data: o type char.

let the output you are getting is 'FO4'

if need 4 then o = p+2(1).

thats it..

Regards

sg

4 REPLIES 4
Read only

venkat_o
Active Contributor
0 Likes
618

Hi, Write like this .

DATA: l_data1 TYPE char3 VALUE 'F04',
      l_data2 TYPE char3.

l_data2 = l_data1+2(1).
l_data2 = l_data2 + 1.
WRITE / l_data2.
Regards, Venkat.O

Read only

Former Member
0 Likes
619

Hi Subha,

If the output is char type

data: p(3) type char.

take a another character type one char length

data: o type char.

let the output you are getting is 'FO4'

if need 4 then o = p+2(1).

thats it..

Regards

sg

Read only

Sougata
Active Contributor
0 Likes
618

data: output type c length 3 value 'F04',
      result type i.

result = output+2 + 1.

Cheers,

Sougata.

Subha,

We would like to be rewarded with points You can do this by choosing the radiobutton on the left hand side of the page. You should do this to show your appreciation for our time. Once your problem is solved, reward points and then mark the answer as solved.

Sougata.

Edited by: Sougata Chatterjee on Apr 27, 2008 10:08 AM

Read only

former_member156446
Active Contributor
0 Likes
618

this make sure its gonna be 'F04' 3 characters every time.. its its 'FX04' if then also u need to change to 'FX05'... u need to decide...

so solution for it is...


vl_data = 'F04'.
data: vl_len type i.

vl_len = strlen( vl_data).
vl_len = vl_len - 1.
vl_data = vl_data+(vl_len).

vl_temp = vl_data+vl_len(1)
vl_temp = vl_temp + 1.

clear: vl_len, vl_temp.

concatenate vl_data vl_temp to vl_data.