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

Displaying the COMP-3 values directly


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

New User


Joined: 26 Sep 2006
Posts: 38
Location: India

PostPosted: Wed Oct 27, 2010 6:11 pm
Reply with quote

Hello All,

COMP-3 will always throw some confusion. My understanding was that we can not display the COMP-3 values directly. Even we can see so many documents says different methods to dispaly a comp-3 value. But I tried to execute below code and I was able to print the values directly in spool. Please look in to the piece of code mentioned below.

So this means we can print COMP-3 values in to spool directly?.



Code:
IDENTIFICATION DIVISION.                     
PROGRAM-ID. CHECK1.                         
ENVIRONMENT DIVISION.                       
CONFIGURATION SECTION.                       
DATA DIVISION.                               
WORKING-STORAGE SECTION.                     
01 REC1.                                     
   10 WS-COMP      PIC 9(3) COMP-3.         
01  WS-VAL         PIC 9(3) COMP-3 VALUE 123.
PROCEDURE DIVISION.                         
    INITIALIZE REC1.                         
    MOVE 879 TO WS-COMP.                     
    DISPLAY 'WS-VAL   : ' WS-VAL.           
    DISPLAY 'WS-COMP  : ' WS-COMP.           
    STOP RUN.       




Spool Output:-
Code:
COMMAND INPUT ===>                                            SCROLL ===> CSR 
********************************* TOP OF DATA **********************************
WS-VAL   : 123                                                                 
WS-COMP  : 879                                                                 
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Oct 27, 2010 6:32 pm
Reply with quote

Quote:
So this means we can print COMP-3 values in to spool directly?.
There's never been an issue with them -- neither unsigned (like yours) nor signed.
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 Oct 27, 2010 7:59 pm
Reply with quote

Hello,
Quote:
My understanding was that we can not display the COMP-3 values directly.
Where did this "understanding" originate?

Suggest whoever/whatever was the source of this, you be careful of anything else learned there - it may be similarly flawed. . . icon_wink.gif
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts IBM OnDemand Folders displaying to al... IBM Tools 6
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
Search our Forums:

Back to Top