SmokinWrek
IS-IT--Management
OK, I've got a program in which I am writing out fixed-length records to a file opened for Output. Some of the fields in the record are numbers calculated within the program. I need to output these numbers into a fixed length field and have leading zeroes.
Example: calculated value is 4000 but I want that in a 5 byte field with leading zeroes so it looks like 04000 in the field.
How can I accomplish this? I can get it to be in a fixed length field by defining the length of the string variable used for that field, but then I get the number left justified without the leading zero, i.e. - 4000 <---note trailing space after last zero.
I've tried using the Format function, but either I don't know enough about it or it can't do what I want.
Any ideas?
Example: calculated value is 4000 but I want that in a 5 byte field with leading zeroes so it looks like 04000 in the field.
How can I accomplish this? I can get it to be in a fixed length field by defining the length of the string variable used for that field, but then I get the number left justified without the leading zero, i.e. - 4000 <---note trailing space after last zero.
I've tried using the Format function, but either I don't know enough about it or it can't do what I want.
Any ideas?