I have a decimal field (amount field) defined as (15S 2)I am populating this field from a file field which is also of same attribute. I dont want leading Zeros to appear on this field so I used edtcde(1). Leading Zeros are suppressed. But it seems the field is taking much space than length 15(Value in the field is 50,000.00 but it took a space of 20 with blanks in the begining) and so overlapping with the next field. Why so? Any other editcode is there which can suppress leading zeros and want to show decimal point as well. Nothing more like dollar symbol or -ve sign required. Please assist
Software/Hardware used:
ASKED:
December 14, 2012 6:48 AM
UPDATED:
December 14, 2012 7:28 AM
A (15S 2) field with EDTCDE(1) should take up 20 positions. There will be 15 digits, plus a decimal point, plus four comma separators – 20 characters. You could use an edit code that doesn’t include comma separators. — Tom
You could rearrange the field print sequence to allow the overlap as mentioned above.The question you need to ask yourself is what is the largest amount value that exists for that field? You need to make sure if you do overlap, you do not overlay valid data. If you have the ability to make the programming changes, I assume you do if you can change the edit code, why not change the size of the field in the print file to your maximum data value size?.
An edit code of 4 will only show the decimal point. This will just add 1 extra position for the decimal making the output 16 positions.
15 – 2
1,234,567,890,123.45
If you know that you will not need a number that big then you might want to move this to a smaller field and print that field.
If the PRTF is internally defined in your program, you can rearrange the output specs…
If the PRTF is externally described, you can also rearrange the output fields in a similar way. Generally, it’s far better to have a PRTF be externally described.
Tom
Note: placing the fields on the output right to left will allow you to overlay some of the spaces from a long number field with the next field to the left but it will overlay these characters even if they contain digits.