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

Need to convert X(10) to S9(6)V9(2)


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Thu Oct 25, 2012 1:11 pm
Reply with quote

Need some help in converting

X(10) to S9(6)V9(2) format.

Input Field will be something like this -123456.10

last 3 number will always be deimal and two decimal digits.



Thanks
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: Thu Oct 25, 2012 1:33 pm
Reply with quote

If you data will always be valid, look at NUMVAL in the manual.
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Thu Oct 25, 2012 2:29 pm
Reply with quote

Its not working.

My data looks like this

Code:

01  WS-FIELD-A  PIC X(11) VALUE     '-3456.78'.
01  WS-FIELD-C  PIC S9(6)V9(2)  COMP-3 . 

COMPUTE WS-FIELD-C = FUNCTION NUMVAL(WS-FIELD-A). 



Output looks like this
Code:
0034567Q     
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Oct 25, 2012 2:35 pm
Reply with quote

What was your expectation for the result with those WS-definitions?
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: Thu Oct 25, 2012 2:43 pm
Reply with quote

Have a look at this one and tell us why you think your value is not correct.
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Thu Oct 25, 2012 3:42 pm
Reply with quote

Thanks I understand the output.

This field is one the field in part of copybook layout. When I am trying to move it layput its throwing error of incompatbility.
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: Thu Oct 25, 2012 3:53 pm
Reply with quote

Are you saying it is still a problem? If so, show how.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Oct 25, 2012 4:20 pm
Reply with quote

Quote:
This field is one the field in part of copybook layout. When I am trying to move it layput its throwing error of incompatbility.
Instead of telling us what the message says, SHOW US THE MESSAGE! (Cut and paste the EXACT message.) And show us the line(s) of code for which you are getting the message.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
No new posts Convert HEX to Numeric DB2 3
Search our Forums:

Back to Top