January 01, 2008, 06:42 PM
susannahconvert the alpha field to integer and then back to alpha and the EDIT will pack it out with leading zeroes, whether you want it to or not.
DEFINE FILE CAR
MYALPHAFIELD/A8=EDIT(SALES);
temp/I8=EDIT(MYALPHAFIELD);
RESULT/A8=EDIT(temp);
END
another way , maybe more direct, is to use CTRAN which translates all instances of character in an alpha string to another character
in this case a blank (32) to a zero(48)
DEFINE FILE ...
NEWFIELD/A20=
CTRAN ( 20, fieldname , 32 , 48, 'A20');
END
(example for a field of length 20)
i find either of these ways easier than the ibi suggested hoops to jump thru. The CTRAN way would work even if some freaky alpha character snuck its way in to your input field. You might even want to RJUST your input field before you CTRAN it, just to make sure there's no freaky extra blank at the end, entered by mistake. Look at the 4th manual in the basic set, "Using Functions"
January 02, 2008, 09:15 AM
AlexUAdd an "L" to the format of your output field. I.E. "D12.2L" or "I11L". This will automatically pack out leading zeros to the max size.
January 02, 2008, 09:47 AM
FrankDutchAlex
The question was that Lera used an alpha field. Your solution only works for numeric fields.
January 02, 2008, 10:35 AM
GamPAdding the setting:
SET CENT-ZERO = ON
may also help.
But that is also just for numeric fields....