View previous topic :: View next topic
|
Author |
Message |
apandey
New User
Joined: 31 Aug 2009 Posts: 73 Location: Mumbai
|
|
|
|
Hi All,
I am creating a report thru cobol program. I am writing a quantity field in each detail record.
After writing few records i am calculating its NET value and Display in report.
My WS-NET is declared as PIC S9(9).
The Issue is whatever value this variable is showing in report is not showing in +/- value. Its showing with EBCDIC code.
For Ex. If NET value is +000000960, then it is displaying it as 00000096{.
If it is -000001920, then it is showing as NET: 00000192}.
Can any one pls suggest, how to display proper value. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
There is a link to manuals at the top of THIS page. Click on it, find the COBOL Language Reference manual, and read up on numeric edited variables. Use the flashlight to search for numeric edit for example. |
|
Back to top |
|
|
Stefan
Active User
Joined: 12 Jan 2006 Posts: 110 Location: Germany
|
|
|
|
Used instead PIC +9(9) |
|
Back to top |
|
|
Dsingh29
Active User
Joined: 16 Dec 2008 Posts: 132 Location: IBM
|
|
|
|
The PICTURE character for a sign in a numeric variable that will be used for a DISPLAY is the minus sign (-).
The following variable holds the values -999.99 through 999.99 for display purposes:
01 DISPLAY-VALUE PIC -999.99.
The display sign (-) displays only when the value is negative. If DISPLAY-VALUE contains -46.17, it displays as the following:
-046.17
However, the number 55.03 displays as follows:
055.03 |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Stefan wrote: |
Used instead PIC +9(9) |
Will the sign not get lost? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
gylbharat wrote: |
Stefan wrote: |
Used instead PIC +9(9) |
Will the sign not get lost? |
I'm not sure what you mean. Try it and see. If you feel it does get "lost", let us know.
I'm curious to see so much use of "leading" signs in reports around here. We always used a "trailing" sign, you can tell without having to eye-scan the whole figure whether it is -ve or not.
Other possibilities are to use the CR/DB editing if that is what the user wants, or two columns, one for the "plus" and one for the "minus" - don't get confused when talking to accountants, listen to exactly what they want. With CR/DB a -ve is CR, because that is how they do their figures (never come across different).
Also surprised not to see ","s to make large numbers easier to read. Decimal places, but can depend on the currency, though any sort of fraction in a calculation that is then not displayed is asking for trouble.
In short. Familiarise yourself with editing possibilities. Find out what the user wants to see. Produce what the user wants to see, if possible/reasonable, or go back to user to get it changed. |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Thanks Bill,
I ran the program by specifying +9(9). It ran correcly and displayed the signs also. Thanks for the information... |
|
Back to top |
|
|
|