View previous topic :: View next topic
|
Author |
Message |
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
What is the COBOL DISPLAY declaration for the following COMP-3 declaration?
10 VAR-1 PIC S9(8)V9(2) USAGE COMP-3.
Thanks...
sashi |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
I would suggest looking in the COBOL manual under DATA DIVISION -- DATA DESCRIPTION -- PIC. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
For
Quote: |
10 VAR-1 PIC S9(8)V9(2) USAGE COMP-3. |
, how about 10 VAR-1 PIC S9(8)V9(2) USAGE DISPLAY.? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
If you are talking about edit mask: PIC -zz,zzz,zzz.99. |
|
Back to top |
|
|
jaspal
New User
Joined: 22 May 2007 Posts: 68 Location: mumbai
|
|
|
|
hi,
i think we can also give : PIC -zz,zzz,zz9.99 |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
How about ---,---,--9.99 what you use depends on what you want the output to look like. |
|
Back to top |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
Craq Giegerich wrote: |
How about ---,---,--9.99 what you use depends on what you want the output to look like. |
i have a variable declared with
10 VAR-1 PIC S9(8)V9(2)
i moveD some value to it (assume -242).
and if you display it it giving as following.
INPUT FILE
-242
next i am moving this var-1 to one COMP-3 variable.
MOVE VAR-1 TO VAR-2.
where VAR-2 is declared as
10 VAR-1 PIC S9(8)V9(2) USAGE COMP-3.
if you display this VAR-2
WS VARIABLES
000000024B
-ve sign is missing in VAR-2
please let me know how to get the -ve sign. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
PLEASE READ THE DESCRIPTION OF THE DISPLAY VERB IN THE COBOL MANUAL. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
A packed decimal value of 24B is negative 242; the sign is overlaid on the last byte. Use SIGN LEADING SEPARATE if you don't want this behavior. |
|
Back to top |
|
|
sashi
New User
Joined: 14 Sep 2005 Posts: 54 Location: Chennai
|
|
|
|
Robert Sample wrote: |
A packed decimal value of 24B is negative 242; the sign is overlaid on the last byte. Use SIGN LEADING SEPARATE if you don't want this behavior. |
No -242 in packed decimal format is 24K
+242 is 24B |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
A packed decimal value of 24B is negative 242;
No -242 in packed decimal format is 24K |
Sorry, neither is the packed-decimal value for either + or - 242. Those are the values for zoned-decimal.
Packed-decimal values have the sign in the low-order nibble of the least significant digit - a "D" sign is negative and a "C" or "F" will be treated as positive. To see these, show the value in hex.
As Craig suggested, look up DISPLAY in the cobol manual - it does translation to make values "displayable". |
|
Back to top |
|
|
chandrarkar
New User
Joined: 27 May 2008 Posts: 24 Location: india
|
|
|
|
hope this helps |
|
Back to top |
|
|
anil.csk
New User
Joined: 22 Oct 2007 Posts: 16 Location: Noida
|
|
|
|
hey you have to use the another variable to display the comp-3 varaiable..
fisrt you pass the value then display this one variable....- |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Or simply understand what is presented in the output when a comp-3 variable is DISPLAYed. |
|
Back to top |
|
|
|