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
 

 

Convert alphanumeric to numeric value

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

New User


Joined: 15 Jul 2010
Posts: 8
Location: chennai

PostPosted: Thu Jul 11, 2013 11:22 am    Post subject: Convert alphanumeric to numeric value
Reply with quote

Hi ,

Can anyone please help me out to convetr a alphanumeric value to numeric value in Cobol:

EG:
---
Input value A=2.0000004568 ---> Declaration of this value is X(18) .


Need:
-----
I want to do an arithmetic calculation on input A, but this value is an alphanumeric so i am not able to do this .I have tried to move this value in the numeric variable ,and i did calculation and i got the SOC error.Any please help me out on this issue.

Thanks,
Gayathiri
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Jul 11, 2013 11:34 am    Post subject: Reply to: Convert alphanumeric to numeric value
Reply with quote

Is that single example representative of all your data?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jul 11, 2013 3:06 pm    Post subject:
Reply with quote

You really, really, REALLY need to learn how to post a question:
1. Does all your data have a decimal point?
2. Is the decimal point always the second character of the X(18) variable?
3. If the answer to (1) and (2) is yes, you could simply use REDEFINES to use a numeric edited PIC for the data. If the answer to either is no, you could use intrinsic FUNCTION NUMVAL which is described in the COBOL Language Reference manual (link at the top o f this page).
4. There is no such thing as "S0C" (sic) error. You could have gotten an S0C1 (operation) or S0C4 (storage protection) or S0C7 (data) exception (among others), but not ever a "S0C" without the last digit.
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Thu Jul 11, 2013 4:52 pm    Post subject:
Reply with quote

Quote:
I have tried to move this value in the numeric variable…
What is your PICture clause for "numeric variable"?

Quote:
and i did calculation…
Can you show us the code for your calculation?

Quote:
i got the SOC error…
What S0C error did you get?
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 Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm


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