Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Display COMP values.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
srrao_kilari

New User


Joined: 28 Nov 2005
Posts: 12
Location: New Delhi

PostPosted: Tue Aug 22, 2006 2:59 pm    Post subject: Display COMP values.
Reply with quote

I have field X with S9(09)v99 contains a value move which was moved from COMP-3. So now my X contains some numeric value that ends with {, }, H, I etc which are equivalent to C9, C8, C7 .... like this. I want this to be printed as -54858 or 8786 depending upon postive or negative. Can anybody suggest for this.
Back to top
View user's profile Send private message

PKumar

New User


Joined: 28 Sep 2004
Posts: 8

PostPosted: Tue Aug 22, 2006 3:47 pm    Post subject: Re: Display COMP values.
Reply with quote

Hi Killari,

As u want to display X's value which is of Comp type , u need to move X value which is of type display . I mean a field for ex Y defined with size S9(09)v99 . Then u can display the value of Y instead of X. I think i am able to reach ur requirement.

Regards
PKumar
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Aug 22, 2006 5:46 pm    Post subject: Re: Display COMP values.
Reply with quote

The alpha character at the end of your value contains the sign. x'c0' thru x'c9' are positive x'd0' thru x'd9' are negitive and x'f0' thru' 'f9' are unsigned.

Define your recieving field as PIC -(9)9.99. This will display the value with a floating '-' in front for negative values and nothing for positive values.

Note that there has been an additional two print positions added, one for the '.' and one for the sign.

Dave
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Aug 24, 2006 3:39 am    Post subject:
Reply with quote

Sorry, David. It won't float. You'd have to use something like -(8)9.99
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Aug 24, 2006 4:33 am    Post subject: Re: Display COMP values.
Reply with quote

I thought it floated pretty well. If you define the field as ?(8)9.99 you chance truncating the hi order digit of a s9(9)v99 comp-3 field. Of course, the COMP-3 field never was explicitly defined, My assumption is that it was a also a S9(9)v99 COMP-3 field.

Code:

WORKING-STORAGE SECTION.                                     
                                                             
01 WS-C3                 PIC S9(9)V99  COMP-3               
                                       VALUE -123456789.01. 
01 WS-DISP8              PIC -(8)9.99.                       
01 WS-DISP9              PIC -(9)9.99.                       
                                                             
LINKAGE SECTION.                                             
                                                             
PROCEDURE DIVISION.                                         
                                                             
PROGRAM-START.                                               
                                                             
    MOVE WS-C3     TO WS-DISP8.                             
    DISPLAY 'WS-C3 ' WS-C3 ' WS-DISP8 ' WS-DISP8.           
                                                             
    MOVE WS-C3     TO WS-DISP9.                             
    DISPLAY 'WS-C3 ' WS-C3 ' WS-DISP9 ' WS-DISP9.           
                                                             



Code:

WS-C3 1234567890J WS-DISP8 -23456789.01
WS-C3 1234567890J WS-DISP9 -123456789.01


Dave
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Aug 24, 2006 4:44 am    Post subject:
Reply with quote

Sorry again, David. I thought I "saw" -9(9).99, not what you had,
-(9)9.99. My mistake; you were correct.
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Thu Aug 24, 2006 10:01 am    Post subject:
Reply with quote

David/Jack,

I thought -9(9).99 & -(9)9.99 wouldn't make any difference, would they?

Regards, Twissi.
Back to top
View user's profile Send private message
kondakonda

New User


Joined: 20 Mar 2006
Posts: 34

PostPosted: Thu Aug 24, 2006 3:52 pm    Post subject: Re: Display COMP values.
Reply with quote

Both do not make any difference expect the leading zeros will be there for 9(9).99
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 Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us