Question:I am trying to right justify a pic x(04) field. I am using PIC x(04) just right. When I inspect the field replacing '_' by spaces I will be moving to the just right field it does not right justify the value moved ie. 012_ after inspect '012 ' is moved to the PIC X(04) just right field and I still have '012 ' what's up?
Answer:What you are moving into the field already has four characters (zero, one, two, blank). That gets loaded into the field right justified and you still have the trailing blank. Try replacing the blank with LOW-VALUES. The field should then be treated as having only three characters (as only low-values are ignored when calculating field length) and the field should then right justify correctly.
This article written by Stephen Chapman, Felgall Pty Ltd.