cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric conversion in fixed length outputs

Former Member
0 Kudos

I have a requirement to right justify all numeric fields in a fixed length file content conversion..Due to the fixed length nature the numeric fields are stating from the positions defined in the file content conversion..Is it possible for them to be right justfied though we give them starting postions??

-Teresa

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

can you provide an example as to what it is now and what you want to achive.

Naveen

Former Member
0 Kudos

A rustic example would be ...if a field is NUM(5) and its value is 123...The output should be " 123"...The size between the " " being 5 and the value is right justified..

-Teresa

Former Member
0 Kudos

Hi,

Simplest way would be to write a user defined function, where you append spaces to the variable based on length.

string b;

int size = a.length();

int diff = 5 - size;

b = a;

for(int i = 0; i <= diff;i++)

b = " " + b;

return b;

Hope it helps,

Naveen

Former Member
0 Kudos

Doesn't XI consider numeric fields to be naturally right justified when they output to a fixed length file?? or do they require special definition at the data type definition..

-Teresa

Former Member
0 Kudos

Thanks for the suggestions but any ideas on XI's standard numeric data type declaration??

-Teresa