Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
grayWolf

New User

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

 Posted: Tue Jul 12, 2011 4:29 pm    Post subject: Moving X(13) to S9(6)V9(7) COMP-3. 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

Bill O'Boyle

CICS Moderator

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

 Posted: Tue Jul 12, 2011 4:38 pm    Post subject: Reply to: Moving X(13) to S9(6)V9(7) COMP-3. Click on the recent link below and review - http://www.ibmmainframes.com/viewtopic.php?t=55227 Bill
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

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

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.
grayWolf

New User

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

 Posted: Wed Jul 13, 2011 1:30 pm    Post subject: Thanks a lot Bill! I referred the post and the logic involving COMPUTE NUMVAL worked.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us