How to change edited num to comp num



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

How to change edited num to comp num

Postby karthick » Thu Oct 11, 2007 12:39 pm

hi, pls help me in solving the issue,

Im reading a file which contain values in this format 0f -100,00,000. i have to use this value for computation.
How can i change this value in a computable form.
karthick
 
Posts: 6
Joined: Thu Oct 11, 2007 12:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to change edited num to comp num

 

Re: Reg

Postby CICS Guy » Thu Oct 11, 2007 2:06 pm

The easiest would be the intrinsic function NUMVAL....
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to change edited num to comp num

Postby karthick » Thu Oct 11, 2007 9:46 pm

Will the Numval function gives me the value for -1,00,000 as -100000. which can be used for computation?
Still this issue hasnt been solved. Since im a beginner im not much aware of complex fuctions. can any one help me in detail wat to done?
karthick
 
Posts: 6
Joined: Thu Oct 11, 2007 12:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to change edited num to comp num

Postby CICS Guy » Thu Oct 11, 2007 10:31 pm

Forgot about the commas......

01 question pic x(10) value '-1,00,000'
01 answer pic s9(9) value zero
01 pretty-answer pic --------9.
Compute answer = NUMVALC (question)
move answer to pretty-answer
display answer
00010000{
display pretty-answer
-100000.
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to change edited num to comp num

Postby karthick » Sat Oct 13, 2007 12:25 am

Thank u for your suggestion Guys its working...Problem Solved :)
karthick
 
Posts: 6
Joined: Thu Oct 11, 2007 12:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to change edited num to comp num

Postby abkumarch » Tue Oct 30, 2007 7:57 pm

i m sorry karthik, bt how do u assume the pic X(10), rather he says that numeric edited item ?
And one more thing, why display answer wil show ' 00010000{ '. if possible ans me ?

I ve also send some interesting questions, nd i need the answers ... can u spare some time 4 me....
abkumarch
 
Posts: 21
Joined: Tue Oct 30, 2007 3:14 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to change edited num to comp num

Postby dick scherrer » Wed Oct 31, 2007 2:16 am

Hello,

why display answer wil show ' 00010000{ '
This is shown by a display because of the "sign".
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post