Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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 -> Mainframe COBOL
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
References
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 1218
Location: At my desk

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: 1218
Location: At my desk

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

Global Moderator


Joined: 23 Nov 2006
Posts: 9179
Location: 221 B Baker St

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: 1218
Location: At my desk

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

Global Moderator


Joined: 23 Nov 2006
Posts: 9179
Location: 221 B Baker St

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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
Page 1 of 1