Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Declarations S9(9) comp-3 and S9(9)V comp-3 same
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

Site Director


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

PostPosted: Tue Feb 25, 2014 7:28 pm    Post subject:
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    Post subject: Re: comp-3 delcration
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Feb 26, 2014 10:27 am    Post subject:
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    Post subject:
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    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Feb 26, 2014 2:01 pm    Post subject:
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

Site Director


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

PostPosted: Wed Feb 26, 2014 7:38 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm
No new posts comparing comp-3 and unpacked numbers juares castro COBOL Programming 3 Mon May 30, 2016 6:46 pm
No new posts SIGNED DECIMAL TO COMP-3 using cobol ... ram_vizag COBOL Programming 1 Tue Mar 01, 2016 11:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us