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
 

 

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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am


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