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

Why COMP data doesnt display the value correctly


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

New User


Joined: 01 Jan 2008
Posts: 35
Location: Hyderabad

PostPosted: Sun Jan 27, 2008 1:38 pm
Reply with quote

I think this must have been asked earlier in the forum but my search did not help me. Please help me understand why does not a display of comp-3 or comp data provide correct results.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Sun Jan 27, 2008 8:30 pm
Reply with quote

Kevin Dcosta wrote:
I think this must have been asked earlier in the forum but my search did not help me. Please help me understand why does not a display of comp-3 or comp data provide correct results.


It does!
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Jan 28, 2008 12:54 am
Reply with quote

Kevin,

Tell us about what you're trying to DISPLAY. Give us the PIC and the VALUE of the data field.

Then tell us what is being DISPLAYed.
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: Mon Jan 28, 2008 8:40 am
Reply with quote

Hello,

To sucessfully display comp and/or comp-3 data, you need to display the individual field(s), not some group field.
Back to top
View user's profile Send private message
Kevin Dcosta

New User


Joined: 01 Jan 2008
Posts: 35
Location: Hyderabad

PostPosted: Mon Jan 28, 2008 12:08 pm
Reply with quote

Below are the details

01 WS-SNUM05PD PIC S9(5) COMP-3.
01 WS-SNUM05BI PIC S9(5) COMP.

MOVE -12345 TO WS-SNUM05PD WS-SNUM05BI

Output.

PACK DECIMAL :1234N
BINARY :000001234N
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jan 28, 2008 2:49 pm
Reply with quote

it is displaying as advertised.

Code:

**********************************************************************
*  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 = }                                         *
**********************************************************************


Back to top
View user's profile Send private message
Kevin Dcosta

New User


Joined: 01 Jan 2008
Posts: 35
Location: Hyderabad

PostPosted: Mon Jan 28, 2008 4:22 pm
Reply with quote

Thanks to all .
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Jan 29, 2008 7:58 am
Reply with quote

You could:

WS
Code:
01 WS-SNUM05PD PIC S9(5) COMP-3.
01 WS-SNUM05BI PIC S9(5) COMP.
01 WS-DISP-VAL PIC -----9.


PD
Code:
MOVE -12345         TO WS-SNUM05PD WS-SNUM05BI
COMPUTE WS-DISP-VAL  = WS-SNUM05PD
DISPLAY WS-SNUM05PD
COMPUTE WS-DISP-VAL  = WS-SNUM05BI
DISPLAY WS-SNUM05BI

SYSOUT
Code:
-12345
-12345
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 2
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top