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

Space Fill

Former Member
0 Likes
634

Greetings,

I have a simple table which I am writing to a flat file the table has a single field record structure that is 300 long, my data occupies the beginning of the record. I need to fill each record to 300 long though no matter what, filling the empty space at the end with spaces so that each record is 300 long no matter of the variable content in the beginning.

Ideas?

Greetings,

I have a simple table which I am writing to a flat file the table has a single field record structure that is 300 long, my data occupies the beginning of the record. I need to fill each record to 300 long though no matter what, filling the empty space at the end with spaces so that each record is 300 long no matter of the variable content in the beginning.

Ideas?

3 REPLIES 3
Read only

Former Member
0 Likes
603

some thing like this you cna do...

data: text(300).

text+0(300) = 'this is test'.

Read only

Former Member
0 Likes
603

I think if you move the contents of the table directly, you will still have the entire length with space in the file. Just dont use Concatenate as it will remove the spaces.

Something Like:



Open dataset  ........
 
Loop at itab.
   Transfer itab TO dataset.
Endloop.

Read only

0 Likes
603

I found that in my open dataset routine I was calculating the record length and only transfering filled lengths.

Old Code

open dataset .....

v_strlen = strlen( wa_rev ).

transfer wa_rec to v_serfile length v_strlen.

New Code

open dataset

TRANSFER wa_rec TO v_serfile LENGTH 2500.