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

Read Dataset

Former Member
0 Likes
563

I am wondering how the following line works:

READ DATASET w-filename INTO t_imspo.

I understand that it will break up the file and put it into the fields contained in t_imspo but how does it break this file apart? What delimiter does it use?

Regards,

Aaron

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
536

Aaron,

The Read does not break the record apart and put it into fields of the target.

You have to provide a "buffer" at least as big as you expect the data length to be.

To seperated it into different fields, the input would need to be delimited by something, usually tabs or commas.

You would then use the SPLIT verb to move it to the fields.

4 REPLIES 4
Read only

Former Member
0 Likes
537

Aaron,

The Read does not break the record apart and put it into fields of the target.

You have to provide a "buffer" at least as big as you expect the data length to be.

To seperated it into different fields, the input would need to be delimited by something, usually tabs or commas.

You would then use the SPLIT verb to move it to the fields.

Read only

0 Likes
536

That is what I thought, I had used it that way before, but I just read the help on READ DATASET and it looked like it would split it for me too.

Thanks!

Aaron

Read only

0 Likes
536

The only way it would seperated it on the read, would be that your input "buffer" is actually a record with the exact same length and each field is the same length on the input and the buffer.

ie..


BEGIN OF MYREC,
  fld1(10)    type c,
  fld2(10)    type n,
etc.. etc

your input would then HAVE to be in the same format

ZZZZZZZZZZ1234567890.......

Read only

Former Member
0 Likes
536

Hi Aaron,

It does not consider any delimiter.

The structure of the t_imspo must be identical to the line structure of the file.

Eg: the file has some 30 characters with fixed lengths for each field, then the internal table must be defined as per the field lengths of each field.

data: begin od itab occurs 0,

field1(10),

field2(5),

field3(15),

end of itab.

Regards,

Ravi