Hi, My copybook field has PIC S9(9)V99 COMP-3. i want to final output to be dislayed like -3136488.00(+ or - should also be displayed). Can someone help with standard format to achieve the same.
Well, NicC has given you very good advice. If you want to do it with the 9's like you have, just don't forget to put a leading/trailing sign on (+ or -, experiment). Also see the effect of ZZZZZZZZ9.99- with smaller numbers.
Yeah i know to use the z(9).99-. for this move but i doubt whether it could be the standard format to be used in COBOL. So i asked for various other methods to achieve the same.. Thanks..
There is no reall "standard" format. How you format the numbers depends on the requirement. I should think for reporting I've used the Zs about 95% of the time. Other than files going to external systems I've not put physical decimal points in files. For files going to external systems, either the Zs (for CSVs) or 9s (for fixed-format files).
As i want the sign value to be in front i gave it as -Z(9).99. But the thing is that i am getting the values in this format - 7168.00(spaces after sign field). Which actually i want it as -7168.00.How can i eliminate the spaces after the sign.