View previous topic :: View next topic
|
Author |
Message |
vinuseba
New User
Joined: 17 Feb 2014 Posts: 19 Location: India
|
|
|
|
hi ,
Are the declarations S9(9) comp-3 and S9(9)V comp-3 same? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Yes.
Suggest you run a compile and look at the compiled output.
d |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
vinuseba wrote: |
hi ,
Are the declarations S9(9) comp-3 and S9(9)V comp-3 same? |
Here is quote from
Enterprise COBOL for z/OS Language Reference Version 4 Release 2
Quote: |
When the assumed decimal point is to the right of
the rightmost symbol in the string, the V is
redundant. |
|
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Yes, what is that you want to try it out? V is implied Decimal point. |
|
Back to top |
|
|
vinuseba
New User
Joined: 17 Feb 2014 Posts: 19 Location: India
|
|
|
|
hi
i tried with the below code
01 WAOR-ITEM-I PIC S9(9)V COMP-3 VALUE ZEROS.
PROCEDURE DIVISION.
100-MAIN-PARA.
DISPLAY 'ENTERED MAIN PARA'
MOVE 123456789 TO WAOR-ITEM-I.
DISPLAY 'WAOR-ITEM-I :'WAOR-ITEM-I
GOBACK.
STOP RUN.
Result : 123456789
But when i tried after changing declaration to 01 WAOR-ITEM-I PIC S9(9)V9 COMP-3 VALUE ZEROS.
Result : 1234567890
Thank you all |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
As you were told, V is implied Decimal point.
When you display, '.'(dot) won't print.
try to move COMP-3 values to other variable with PIC 9(9).9 then display it. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Your initial question was for S9(9)V but you tried for S9(9)V9
Quote: |
But when i tried after changing declaration to 01 WAOR-ITEM-I PIC S9(9)V9 COMP-3 VALUE ZEROS |
as we said this is assumed decimal point, and hence you could not see a dot. You can read more on this from the link provided at the top. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Result : 123456789
But when i tried after changing declaration to 01 WAOR-ITEM-I PIC S9(9)V9 COMP-3 VALUE ZEROS.
Result : 1234567890 |
Make one more change to the PIC using S(9)V99 and notice the output from the dsplay.
In your 2 examples there are 9 and 10 digits in the field definition. Mine has 11 digits. |
|
Back to top |
|
|
|