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
 
Issue in Moving Alphanumeric x(03) to signed numeric s9(03)

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

New User


Joined: 04 Feb 2008
Posts: 65
Location: Hyd

PostPosted: Fri Feb 14, 2014 12:14 pm    Post subject: Issue in Moving Alphanumeric x(03) to signed numeric s9(03)
Reply with quote

Hi,

In one of our cobol requirement, I have cobol move as below

Code:
MOVE FIELD-1   TO   FIELD-2


FIELD-1 is the input copybook field with declaration X(03) and FIELD-2 is the output copybook field with declaration S9(03),I notice the mapping is not happening properly and output value is populating incorrectly.

Example 1:when we move input value 10 the output value is taking as +100 instead of +10.

Example 2:when we move input value 1 the output value is taking as '+1 0' instead of +1 . Can some one help me on this.

Note : Input will always have numeric value and input copybook fields FIELD-1 FIELD-2 declarations not to be changed.
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1544
Location: Andromeda Galaxy

PostPosted: Fri Feb 14, 2014 12:21 pm    Post subject:
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Fri Feb 14, 2014 2:06 pm    Post subject: Reply to: Issue in Moving Alphanumeric x(03) to signed numer
Reply with quote

Use UNSTRING ... DELIMITED BY SPACE

Ensure that zero as your input does not appear as blank.

NUMVAL will work, but is a bit of a sledgehammer.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Fri Feb 14, 2014 4:01 pm    Post subject: Reply to: Issue in Moving Alphanumeric x(03) to signed numer
Reply with quote

Sledgehammer because it uses a run-time routine which understands all editing possibilities for the data (which has none in this case) and which returns the value as a floating-point number which then has to go through several conversions to become the PIC 999. Check the generated code.

The UNSTRING doesn't do so much. If keen, there are lots of other ways to do it.
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 181
Location: Globe, India

PostPosted: Thu Feb 20, 2014 12:29 pm    Post subject: Reply to: Issue in Moving Alphanumeric x(03) to signed numer
Reply with quote

yes, FUNCTION NUMVAL looks fine
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Thu Feb 20, 2014 12:52 pm    Post subject: Reply to: Issue in Moving Alphanumeric x(03) to signed numer
Reply with quote

After all, clinet pays for CPU so may as well use as much as you can...
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1827
Location: NY,USA

PostPosted: Sat Feb 22, 2014 1:57 am    Post subject:
Reply with quote

Kalyan, A little search could have avoided this thread as a very thoughtful discussion on the same requirement is already available over this forum and I am sure there are many as such.

http://ibmmainframes.com/viewtopic.php?t=56905&postdays=0&postorder=asc&start=0
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 ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts SIGNAL ON HALT issue packerm CLIST & REXX 1 Fri Oct 20, 2017 6:56 pm
No new posts Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am

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