Application Development 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: 

Split unix file Data

Former Member
0 Kudos
122

Hi

all

i have a unix file having data like that

PPPPMMMMMMMM

where p-is plant of 4 char

and m- is material of 8 char

No i m uploading them and i have to split them into plant and material .

How i can do it.?

i have to split at 4 th palce

plz suggest asap.

Thanks

Saurabh

4 REPLIES 4

Former Member
0 Kudos
68

Hi,

Since there no split char ; u have to use offset.

lv_data+0(4).-----> Plant

lv_data+4(8)------>Material.

use as above direcly or

lv_plant = lv_data+0(4).

lv_material = lv_data+4(8).

U can store is this into variable or directly access it.

former_member181962
Active Contributor
0 Kudos
68

Use offset.

move v_str+0(4) to plant.

move v_str+4(8) to material.

Former Member
0 Kudos
68

You will have to get the entire thing into variable.

DATA : VAR TYPE STRING.

VAR = 'PPPPMMMMMMMM'.

PLANT = VAR+0(4).

LEN = STRLEN( VAR ).

LEN = LEN - 4.

MATERIAL = VAR+4(LEN).

Regards,

Ravi

Note : Please mark the helpful answers

nishanthbhandar
Contributor
0 Kudos
68

You will have to use the offset method.Since there is no sepeartor here you cannot use the split command.

Store the plant into suppose a variable l_plant and the material into say l_material.Then for your data file

l_plant = l_data+0(4).

l_material = l_data+4(8)