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
 

 

Displaying the COMP-3 values directly

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Displaying the COMP-3 values directly
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: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Wed Oct 27, 2010 6:32 pm    Post subject:
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

Site Director


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

PostPosted: Wed Oct 27, 2010 7:59 pm    Post subject:
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    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 Reg:Displaying the particular month o... bhavana yalavarthi All Other Mainframe Topics 4 Sat Jul 08, 2017 8:13 pm
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am


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