IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Declarations S9(9) comp-3 and S9(9)V comp-3 same


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinuseba

New User


Joined: 17 Feb 2014
Posts: 19
Location: India

PostPosted: Tue Feb 25, 2014 11:30 am
Reply with quote

hi ,

Are the declarations S9(9) comp-3 and S9(9)V comp-3 same?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 25, 2014 7:28 pm
Reply with quote

Yes.

Suggest you run a compile and look at the compiled output.

d
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Feb 26, 2014 12:42 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Feb 26, 2014 10:27 am
Reply with quote

Yes, what is that you want to try it out? V is implied Decimal point.
Back to top
View user's profile Send private message
vinuseba

New User


Joined: 17 Feb 2014
Posts: 19
Location: India

PostPosted: Wed Feb 26, 2014 11:23 am
Reply with quote

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Feb 26, 2014 11:58 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Feb 26, 2014 2:01 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 26, 2014 7:38 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts convert alphanumeric PIC X(02) to hex... COBOL Programming 3
Search our Forums:

Back to Top