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
 

 

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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
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
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am


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