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 How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Need input in Scheduling Benchwarmer CA Products 5 Tue Jun 06, 2017 1:44 am


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