View previous topic :: View next topic
|
Author |
Message |
krishnasaikiah
New User
Joined: 14 Mar 2007 Posts: 24 Location: gurgaon
|
|
|
|
How to convert character to numeric data type in cobol??? |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
krishnasaikiah
New User
Joined: 14 Mar 2007 Posts: 24 Location: gurgaon
|
|
|
|
Can you please cite me an example??
Time pic x(8) to time pic 9(8)
this is my requirement.... |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
krishnasaikiah
New User
Joined: 14 Mar 2007 Posts: 24 Location: gurgaon
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|