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

Moving X(13) to S9(6)V9(7) COMP-3.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
grayWolf

New User


Joined: 04 Oct 2010
Posts: 19
Location: Land of broken dreams

PostPosted: Tue Jul 12, 2011 4:29 pm
Reply with quote

Hi All,

There has been a lot of discussion on moving alphanumeric to COMP-3 variables in this forum and I went through them. But I could hardly find a topic which involved numbers with a decimal part. ( apologies if it was already discussed)

I have to move a number like 3.230000 which is in Alphanumeric part to a COMP-3 variable.
I tried a simple move like: MOVE (alphanumeric) to (comp-3)
So, only the decimal part (ie) 230000 was getting copied to the Comp-3 variable.

Can you suggest ways to do this?


Note: I'm getting the input from the CICS map and I have to update the DB2 table.


Thanks in advance
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Jul 12, 2011 4:38 pm
Reply with quote

Click on the recent link below and review -

www.ibmmainframes.com/viewtopic.php?t=55227

Bill
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 12, 2011 4:51 pm
Reply with quote

Is your decimal place in a fixed position?

If so, define/redefine the numeric parts. Define a "display numeric" with the size/decimals you want. Redefine that with integer and decimal parts.

Move the appropriate stuff from the input field to the redefined parts. Then move the whole new display numeric to your comp-3.

Code:
01  W-INPUT-WITH-DECIMAL-PLACE.
    05  W-IWDP-INTEGER-PART PIC X(6).
    05  W-IWDP-DECIMAL-POINT PIC X.
    05  W-IWDP-DECIMAL-PART PIC X(6).

01  W-FULL-NUMBER-WITH-SIX-DECIMALS PIC 9(6)V9(6).
01  FILLER REDEFINES W-FULL-NUMBER-WITH-SIX-DECIMALS.
    05  W-FNWSD-INTEGER-PART PIC X(6).
    05  W-FNWSD-DECIMAL-PART PIC X(6).


Note: Your PIC X field will not hold enough digits for the full comp-3 you have defined. Might not be a problem.

I would check that the decimal place contains a fullstop/period.

I have used PIC X fields because they work without having to worry about what is happening with the signs.

If not in fixed position, look up intrinsic function NUMVAL in the manual and search the Cobol forum here.
Back to top
View user's profile Send private message
grayWolf

New User


Joined: 04 Oct 2010
Posts: 19
Location: Land of broken dreams

PostPosted: Wed Jul 13, 2011 1:30 pm
Reply with quote

Thanks a lot Bill!
I referred the post and the logic involving COMPUTE NUMVAL worked.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
Search our Forums:

Back to Top