Page 1 of 1
Charater Alignment
![Post Post](https://www.ibmmainframeforum.com/styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Mar 11, 2011 2:53 am
by cooldude14344
Friends
Our requirement is show the percentages with four decimal places, which would get printed in document.
The percentage variable must be a character field x(7) otherwise the printing system won't work.
when it get printed it prints as below
percentage1 23.5666%
percentage1 23.5666%
percentage1 3.56%
i would like to print it as below, so the decimal (.) comes in a same line.
percentage1 23.5666%
percentage1 23.5666%
percentage1 3.56%
please let me know how to achieve this.
Re: Charater Alignment
![Post Post](https://www.ibmmainframeforum.com/styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Mar 11, 2011 3:06 am
by BillyBoyo
What "printing system" is this?
If you have an X(7), where does the "%" sign get into it (which would make it 8 characters long). I think your "printing system" is doing something (removing leading space) - unless you are populating the field with "unstring" and inadvertantly removing the leading space youself. Still don't understand how the % would fit in.
Re: Charater Alignment
![Post Post](https://www.ibmmainframeforum.com/styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Mar 11, 2011 3:13 am
by cooldude14344
It is CSF, the % will be a static one in print composition. so passing the variable will be enough.
Re: Charater Alignment
![Post Post](https://www.ibmmainframeforum.com/styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Mar 11, 2011 3:32 am
by BillyBoyo
OK, so what is CSF? What does it say about dropping leading spaces, or to put it another way, left-aligning fields. I guess if you are telling something that is formatting the print for you, there is documentation telling you how to right-align it. However, something has also dropped the lesser-significant zeros in one of your examples, so you'll have to stop it doing that as well, because if you right-align it still won't line up.
Perhaps you can centre it?
By the way, unless it is reading your source, I don't see how it would have to be PIC X(x). You could make it a numer-edited picture, anything you are calling won't know PIC ZZ.9999 from PIC X(7) (unless it is looking at your source).
Re: Charater Alignment
![Post Post](https://www.ibmmainframeforum.com/styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Mar 11, 2011 3:49 am
by cooldude14344
It is a document composition tool used for align the documents. The dynamic values are passed as a parameters, unfortunately it only accepts character variables.
So left and right alignment won't look good if the percentage is a single digit. but in cobol can we do some kind of formating which would print the decimal points all at the same line?
Percentage 1 - 23.5666%
Percentage 2 - 3.5%
but it prints as
Percentage 2 - 3.5% which is left aligned.
Re: Charater Alignment
![Post Post](https://www.ibmmainframeforum.com/styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Mar 11, 2011 4:34 am
by BillyBoyo
OK, I don't know what you have in your program, I don't know CSF, and I don't know what you mean by having to pass character values (a numeric edited field will look exactly the same as a character field when you pass it as a parameter, unless for some obtuse reason the package you are using is working off the source code).
If you have PIC Z9.9999 and you "DISPLAY" all of your test data after it has been put in the field, you will get the results you want in Cobol, except for the case of dropping trailing zeros, which, if you really want it, you'd have to do some extra code for.
You can move this PIC Z9.9999 (maybe try PIC Z9.99ZZ, dunno, never thought of it til now... no idea) to the PIC X9(7) field.
I suspect, however, that you will get the same problem. What should be straightforward isn't working. The format of the print is incorrect, and you are passing the data to a print formatting utility. Without seeing any code, my guess is it is the print formatting utility, ie the parameters that you are passing it to tell it how to print the fields (or default parameters if you are passing nothing).
If you like, please include the relevant cobol code and however it is that you execute the formatting utility. Or wait for someone who knows CSF, which I don't.
Re: Charater Alignment
![Post Post](https://www.ibmmainframeforum.com/styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Mar 11, 2011 10:00 am
by dick scherrer
Hello,
You can move this PIC Z9.9999 (maybe try PIC Z9.99ZZ, dunno, never thought of it til now... no idea) to the PIC X9(7) field.
Or you might redefine the edited field with the pic x field. . .
Re: Charater Alignment
![Post Post](https://www.ibmmainframeforum.com/styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Mar 11, 2011 2:36 pm
by cooldude14344
I will give a try and come back to you guys..thanks
Re: Charater Alignment
![Post Post](https://www.ibmmainframeforum.com/styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Mar 11, 2011 2:42 pm
by Zio69
(maybe try PIC Z9.99ZZ, dunno, never thought of it til now... no idea)
Nope, no can do. Once you start with significative digits you must go on. Besides, once you've reached the decimal point it all becomes significative (at least as long as we're talking about COBOL/ASM/EZT).