Variables with definition S9V99 COMP-3 and PIC 9(001)V99 ar



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Variables with definition S9V99 COMP-3 and PIC 9(001)V99 ar

Postby arya_starc » Tue Jun 19, 2018 3:34 pm

When I display the below variable, decimal is not showing in the spool.



003700 01  WS-VARIABLE.                                                          .  
003802     03  WS-A                PIC  S9V99 COMP-3 VALUE 1.99.                 .  
003804     03  WS-B                PIC  9(001)V99.                               .  
 
.


012802     DISPLAY 'WS-A:   'WS-A    
012804     MOVE WS-A TO WS-B        
012806     DISPLAY 'WS-B:   'WS-B    
 



Output is coming as below




********************************************************** Top of Data **************************************************
WS-A:   199                                                                                                              
EE6C7444FFF4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
6201A0001990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 -----------------------------------------------------------------------------------------------------------------------
WS-B:   199                                                                                                              
EE6C7444FFF4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
6202A0001990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 -----------------------------------------------------------------------------------------------------------------------



 


Could anyone tell why this is happen?
arya_starc
 
Posts: 118
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: Variables with definition S9V99 COMP-3 and PIC 9(001)V99 ar

 

Re: Variables with definition S9V99 COMP-3 and PIC 9(001)V9

Postby Robert Sample » Tue Jun 19, 2018 4:51 pm

You need to go back to whoever taught you COBOL and get a refund because you did not get your money's worth!

The character V in a PICTURE clause means the IMPLIED decimal point occurs at that point. Implied decimal point means COBOL aligns data to that spot, but THERE IS NO DECIMAL POINT. So what you are seeing in the spool is PRECISELY what you should get -- a value with no decimal point. If you want to see a decimal point in your output, move the variable to a PIC 9.99 variable (which is a numeric edited variable).
Robert Sample
Global moderator
 
Posts: 3537
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 253 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post