MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to display sign value correctly?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
ANDY
Beginner


Joined: 07 Feb 2004
Posts: 127
Topics: 67

PostPosted: Tue Aug 01, 2006 10:50 pm    Post subject: How to display sign value correctly? Reply with quote

Code:
77  A              PIC S99V9 VALUE -21.3.   
77  B              PIC S99V9 VALUE 4.5.

DISPLAY 'A = ' A.      
DISPLAY 'B = ' B.   


The following result is incorrect. How to show correctly ?
Code:
A = 21L
B = 04E

_________________
cheers,
Andy
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Aug 02, 2006 12:31 am    Post subject: Reply with quote

Andy,

The result is not incorrect.Please use this cheat sheet to interpret zoned numbers.
Code:

A = 21L
B = 04E

**********************************************************************
*  VALUES:                                                           *
*      1 = A          -1 = J     EXAMPLES:  NUMBER    REPRESENTATION *
*      2 = B          -2 = K                  10        00000001{    *
*      3 = C          -3 = L                 105        00000010E    *
*      4 = D          -4 = M                   0        00000000{    *
*      5 = E          -5 = N                -234        00000023M    *
*      6 = F          -6 = O                 -30        00000003}    *
*      7 = G          -7 = P                                         *
*      8 = H          -8 = Q                                         *
*      9 = I          -9 = R                                         *
*      0 = {          -0 = }                                         *
**********************************************************************

21L would be -21.3
04E would be 4.5

+---------------------------------------------------------------+
| Last Character  will be      |                                |
| represented as below for..   | 0  1  2  3  4  5  6  7  8  9   |
+---------------------------------------------------------------+
| If the Number is +ve         | {  A  B  C  D  E  F  G  H  I   |
+---------------------------------------------------------------+
| If the Number is -ve         | }  J  K  L  M  N  O  P  Q  R   |
+---------------------------------------------------------------+

However if you want to display in readable format try this code:
Code:

WORKING-STORAGE SECTION.                 
77  A              PIC S99V9 VALUE -21.3.
77  B              PIC S99V9 VALUE 4.5. 
77  A-EDITED       PIC -ZZ.Z.           
77  B-EDITED       PIC -ZZ.Z.           
PROCEDURE DIVISION.                     
    DISPLAY 'A = ' A.                   
    DISPLAY 'B = ' B.                   
    MOVE A TO A-EDITED.                 
    MOVE B TO B-EDITED.                 
    DISPLAY 'A-EDITED ' A-EDITED.       
    DISPLAY 'B-EDITED ' B-EDITED.       
    STOP RUN.                           

OUTPUT
Code:

A = 21L       
B = 04E       
A-EDITED -21.3
B-EDITED   4.5

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Aug 02, 2006 10:02 am    Post subject: Reply with quote

Now THAT is a USEFUL post (especially to those of us who do a COBOL program once every 2 years!) Thanks
Back to top
View user's profile Send private message Visit poster's website
ANDY
Beginner


Joined: 07 Feb 2004
Posts: 127
Topics: 67

PostPosted: Mon Aug 07, 2006 4:19 am    Post subject: Reply with quote

Thank you very much.
_________________
cheers,
Andy
Back to top
View user's profile Send private message
nagasadhu
Beginner


Joined: 08 Jul 2006
Posts: 17
Topics: 6

PostPosted: Fri Jan 26, 2007 11:25 am    Post subject: Reply with quote

Hi
Can someone please post the similar cheat sheet for packed decimal values as well?
A link to the appropriate manual is highly appreciated.

Thanks
Back to top
View user's profile Send private message
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Tue Jan 30, 2007 2:12 pm    Post subject: Reply with quote

nagasadhu,

You will not be able to use a HEX to ASCII conversion sheet like the one above because you cannot interpret the packed decimal characters unless they are in HEX/Binary format.
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Thu Feb 01, 2007 2:10 pm    Post subject: Reply with quote

Good sheat sheet.Still you can view it by making it hex on and then try to figure out whats the actual issue.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group