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
 
how to convert character to numeric data type in cobol

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

New User


Joined: 14 Mar 2007
Posts: 24
Location: gurgaon

PostPosted: Wed May 14, 2008 8:15 pm    Post subject: how to convert character to numeric data type in cobol
Reply with quote

How to convert character to numeric data type in cobol???
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed May 14, 2008 8:20 pm    Post subject:
Reply with quote

Usually a move will work, or maybe a redefine.....
Or try the intrinsic function NUMVAL.....
How about an example of what you consider "character" and "numeric" data?
Back to top
View user's profile Send private message
krishnasaikiah

New User


Joined: 14 Mar 2007
Posts: 24
Location: gurgaon

PostPosted: Wed May 14, 2008 8:27 pm    Post subject:
Reply with quote

Can you please cite me an example??

Time pic x(8) to time pic 9(8)


this is my requirement....
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed May 14, 2008 8:58 pm    Post subject:
Reply with quote

krishnasaikiah wrote:
Time pic x(8) to time pic 9(8)
If the x(8) is valid numeric (no spaces):
05 timex pic x(8).
05 time9 redefines timex pic 9(8).
or:
move timex to time9.
If the x(8) is not valid numeric (some spaces):
Compute time9 = function numval (timex).
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 14, 2008 9:16 pm    Post subject:
Reply with quote

Hello,

Quote:
Time pic x(8) to time pic 9(8)
this is my requirement....
Time is often HH:MM:SS. What is in your x(8) field?

How will you use a time field defined as 9(8)? As an 8-digit value, time is not very useful icon_confused.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed May 14, 2008 9:23 pm    Post subject:
Reply with quote

Good catch, I didn't even think of the dataname 'time' as anything other than a dataname.....Even NUMVAL won't work......
I guess we just have to wait & see......
Back to top
View user's profile Send private message
krishnasaikiah

New User


Joined: 14 Mar 2007
Posts: 24
Location: gurgaon

PostPosted: Wed May 14, 2008 11:25 pm    Post subject: Reply to: how to convert character to numeric data type in c
Reply with quote

Hi all,
I have typed my column name as time..it is not time it is date column...
i need to convert my date field which is x(8)...CCYYMMDD..to 9(8) CCYYMMDD....
I hope now it is clear to alll
Thanks in advance
krishna
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 14, 2008 11:32 pm    Post subject:
Reply with quote

Hello,

If you have already verified that the data field has a valid value, a simple REDEFINES will give you the 9(8) you want.
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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm

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