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
 
Convert a string input entry to a numeric with format indica

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

New User


Joined: 02 Aug 2003
Posts: 5

PostPosted: Fri Dec 02, 2005 5:07 pm    Post subject: Convert a string input entry to a numeric with format indica
Reply with quote

We have been searching a solution to create a COBOL program which allows to convert a string input entry
to a numeric with format indications like examples below :

Input entry
"123" or "123.56" or ...
"999" or "999.99" or... (Output format wanted)

Output entry
123 or 123.56 or ...

We don't found any solution on the web (despite our's efforts), do someone
have a solution for this ?


Thanks in Advance,
Mohan.
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Dec 02, 2005 6:35 pm    Post subject: Re: String Conversation
Reply with quote

Do you mean to remove quotes (") from the inout string & place the numeric value only to output string.

Regards,

Priyesh.
Back to top
View user's profile Send private message
gr_mohanram

New User


Joined: 02 Aug 2003
Posts: 5

PostPosted: Fri Dec 02, 2005 7:14 pm    Post subject: Re: String Conversation
Reply with quote

We found to resolve,

The follwoing is the resolution..

Example 1

77 ALPHA-NUM PIC X(16) VALUE "$ 123.45 CR ".
77 NUM PIC S9(5)V99.
PROCEDURE DIVISION.
010-PARA.
COMPUTE NUM = FUNCTION NUMVAL-C (ALPHA-NUM).
DISPLAY ALPHA-NUM.
DISPLAY NUM.
STOP RUN.

The above example displays the following:

$ 123.45 CR
-00123.45

Thanks for your efforts...
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Dec 02, 2005 7:18 pm    Post subject: Re: String Conversation
Reply with quote

Mohan,

I still didnt get ..whether ur prob resolved now.....

If not... Plz give input & output string....

Regards,

Priyesh.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Dec 03, 2005 9:02 am    Post subject:
Reply with quote

Mohan,

You didn't solve the whole problem you stated.

Using your solution for "123", I'm pretty sure DISPLAY NUM would produce 0123.00 not 123
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am

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