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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Moving X(13) to S9(6)V9(7) COMP-3.
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Jul 12, 2011 4:38 pm    Post subject: Reply to: Moving X(13) to S9(6)V9(7) COMP-3.
Reply with quote

Click on the recent link below and review -

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

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7307

PostPosted: Tue Jul 12, 2011 4:51 pm    Post subject: Reply to: Moving X(13) to S9(6)V9(7) COMP-3.
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Moving character data to smallint in db2 rikdeb DB2 5 Thu Jul 14, 2016 12:38 am
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm


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