Page 1 of 1

how to left justify strings in a file.

PostPosted: Mon Jul 28, 2008 5:41 pm
by supriya saraswat
i have strings in my file which are right justified.i want to make them left justified..
how can i do that..

Re: how to left justify strings in a file.

PostPosted: Mon Jul 28, 2008 10:09 pm
by dick scherrer
Hello,

Please post a few examples of your existing data and what you want for the output. If there are multiple strings in the same record, show this also.

Re: how to left justify strings in a file.

PostPosted: Tue Jul 29, 2008 10:37 am
by supriya saraswat
say we have a file in which 2 fields are present.

product cost
abc 24.00
def 35.50

here in case of numeric data type all the digits are right justified.
we want to make them rigth jaustified..

how can it be done.
sorry i mentioned string previously.

Re: how to left justify strings in a file.

PostPosted: Tue Jul 29, 2008 11:51 am
by dick scherrer
Hello,

sorry i mentioned string previously.
Not to worry :)

we want to make them rigth jaustified..
Left maybe? Tough day on the keyboard ;)

To do what you want you could count (tally) the leading spaces in each amount and then using reference modification create a left-justified value. The length of the reference modified move would be the length of the amount field minus the leading spaces.

Re: how to left justify strings in a file.

PostPosted: Wed Jul 30, 2008 12:17 pm
by supriya saraswat
thanks for above information but will you please explain it in the form of code.

Re: how to left justify strings in a file.

PostPosted: Wed Jul 30, 2008 5:38 pm
by jayind
Hi supriya saraswat,

I have another suggestion.. please try this..

Move the amount field (edited) to alphanumeric as the alphanumeric is left justified.. Try this and let me know whether it worked...

Regards,
jayind

Re: how to left justify strings in a file.

PostPosted: Thu Jul 31, 2008 12:34 am
by dick scherrer
Hello,

Move the amount field (edited) to alphanumeric as the alphanumeric is left justified..
Did you test this before posting?

If not, it is best to test "solutions" before posting them. If yes, it would be good to post the definition variable fields used for the test.