View previous topic :: View next topic
|
Author |
Message |
Shweta12j
New User
Joined: 10 May 2010 Posts: 32 Location: Mumbai
|
|
|
|
Dear All ,
I am encountering a problem while displaying a percentage value in a report.
Below are the details:
WS-COMPLETION-PERCENTAGE PIC 9(3)V9.
REPT-REJ-PER-CKI PIC ZZ9.9.
I am calculating the percentage and putting that value in WS-COMPLETION-PERCENTAGE variable.
Now ,While expediting the code , value calculated for WS-COMPLETION-PERCENTAGE 007.4 which is correct.
However when displayed it it showing :
WS-COMPLETION-PERCENTAGE:0074
I moved the above value into REPT-REJ-PER-CKI and the value getting displayed is :0.7
I need to display the correct percentage value in the report i.e 0007.4.
Can someone please advise what can be done to achieve desired result.
Regards,
Shweta |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Code: |
WS-COMPLETION-PERCENTAGE PIC 9(3)V9. |
You have specified an implied decimal - which is what you want for calculatoins.
You need to add another field for the displayed output that has an edited picture. Use pic 999.9 if you want the leading zeros or zzz.9 if you want the leading zeros suppressed. |
|
Back to top |
|
|
Shweta12j
New User
Joined: 10 May 2010 Posts: 32 Location: Mumbai
|
|
|
|
Hi Dick ,
While displaying in a report I am using REPT-REJ-PER-CKI variable which is of PIC ZZ9.9 and it is giving me value 0.7 wherease I need 0007.4 to be displayed.
Regards,
Shweta. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
When someone posts a solution, suggest you follow it. . .
Reread my previous post and change your pic accordingly. . . |
|
Back to top |
|
|
Shweta12j
New User
Joined: 10 May 2010 Posts: 32 Location: Mumbai
|
|
|
|
Hi Dick ,
May be I didn't put my phrase in correct form.
After doing percentage calculation , I have moved WS-COMPLETION-PERCENTAGE to REPT-REJ-PER-CKI(which is of PIC zz9.9)
I have used edited pic variable while displaying in report which is REPT-REJ-PER-CKI as mentioned in my first post.
Please let me know if i am misunderstood your suggestion.
Regards,
Shweta |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Shweta12j wrote: |
[...]WS-COMPLETION-PERCENTAGE PIC 9(3)V9.
REPT-REJ-PER-CKI PIC ZZ9.9.
[...] |
Why would a "completion percentage" go to a report field called "rej-per-cki"? |
|
Back to top |
|
|
Shweta12j
New User
Joined: 10 May 2010 Posts: 32 Location: Mumbai
|
|
|
|
Hi Bill ,
I am using WS-COMPLETION-PERCENTAGE variable for calculation of percentage in a code and by moving it's value to REPT-REJ-PER-CKI , I am trying to display the same percentage value in a Percentage report.
Regards,
Shweta. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Hi Shweta,
Why would you do that? You've given your data better names than is usual here. "REJ" looks like "rejection", "rejection" doesn't look like "completion".
For what you have shown, if those are the fields used, with the values used at the time, you should get 7.4 in your report.
So, either the definitions are wrong or the values are wrong, or the reported result is wrong. Or the fields are the wrong ones at some point.
0074 in PIC 999V9 moved to PIC ZZ9.9 will get you blank, blank, 7.4 every time. Every time. It is a computer, that it what happens.
So, the problem as presented by you does not exist, so you have to work back and find where something is not as you have explained it. At that point, you may well know the answer yourself, if not, update us. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Please let me know if i am misunderstood your suggestion. |
Yes, you misunderstood. . .
Quote: |
You need to add another field for the displayed output that has an edited picture. Use pic 999.9 if you want the leading zeros or zzz.9 if you want the leading zeros suppressed. |
If you wanted the leading zeros, why did you suppress them? ZZZ.9 suppresses leading zeros.
One of your replies also mentions 0007.4 - you need to increase the length if you want 4 positions in front of the decimal.
As has been mentioned, you need to use meaningful data names. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
First problem, you saw 0.7 instead of 7.4
according to the information you provided. you should have seen 7.4
Have you checked that you are really doing what you say you are doing ?
what is your status right now?
Second, you got us mixed with zz9.9 and 0007.4 and 0.7
Please be accurate about the format you want to see. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
If you just bite the bullet and on your first post show your code and results (hex too) exactly by pasting within code tags, you would not need to keep saying what you (think you) are doing.
Whether you are right or wrong - just communicate clearly the first time.
No one gets paid a commission on the number of attempted replies to pick your brain.
The rest of us are eagerly wading thru this mess looking for the answer. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
When a programmer says "This is what I coded", what he really means is: "This is what I thought I coded", or, "This is what I meant to code." |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
decimal point is comma ? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Very nice, Guy. That would do it.
Code: |
A PIC ZZ.9.
B PIC 99.9.
C PIC 999V9.
DIVIDE 74 BY 10 GIVING C
MOVE C TO A
B
|
C would have 0074 with an implied decimal place between the 7 and the 4, everything unaffected so far by DECIMAL-POINT IS COMMA.
However, for A, the decimal place is after the right-most position, with a COMMA, disguised (to the human eye) as a PERIOD/FULLSTOP/DECIMAL-POINT. So A gets
Code: |
blank, blank point 7 |
Similarly, with B
The "dot" that we can see (in my example) is actually taking on the work of a comma, like instead of 123,456,789.11 which we do in Britainia, 123.456.789,11 like in places in Europe.
I'll remember that Guy. You seen it before?
TS is long gone, we'll never know for sure, but it definitely fits. Who would think, pick up a program at a new site, make the change, not notice all the other data definitions (OK, thin on that one) and definitely not look for DECIMAL-POINT IS COMMA.
EDIT: This means I was wrong in my earlier post. There is a(n) (almost) reasonable way of screwing it up. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
I did see it before : outsourcing. |
|
Back to top |
|
|
|