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
 

 

How to CONVERT TEXT for EXcel to Numeric(dec) value in COBOL

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

New User


Joined: 05 May 2009
Posts: 21
Location: India

PostPosted: Fri Sep 24, 2010 5:05 pm    Post subject: How to CONVERT TEXT for EXcel to Numeric(dec) value in COBOL
Reply with quote

I have a field which gets value from excel

let assume working storage field as TOTAL-QTY

TOTAL-QTY = 000234.5500000 ( i am getting from excel)

Since this value is consider as text , i am getting value while converting to exact decimal

even '.' is consider as text . so i uable to move values

Note : i cannot use NUMVAL bcz of older cobol version.

i need to convert this to numeric field 234.55 9(9)v9(5)
Back to top
View user's profile Send private message

Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Fri Sep 24, 2010 6:11 pm    Post subject:
Reply with quote

If I understand, and regardless of where the data came from, you have a character value like "234.55" and you want the numeric representation.

If you always have two dec places, the define a group var with three parts: integer part IP (say PIC 9(9)), decimal point DPT (PIC X), and decimal part DP (PIC 99).

I would check DPT for = '.' just as a check, but the numeric calc is IP + DP/100.

If the number of dec places varies, then you'll need to write code to locate the decimal place, use reference modification to pull out the int and dec parts separately, and divide by the appropriate power of 10.

However, if I do not understand, then please disregard this post.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 24, 2010 7:32 pm    Post subject:
Reply with quote

Hello,

Before NUMVAL was implemented, we used arrays to parse the input value and create a numeric from the text value. . .

Suggest you do the same if you have no access to a current compiler. . .
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Fri Sep 24, 2010 7:38 pm    Post subject:
Reply with quote

Dick is a bit more current than I am, so use certainly NUMVAL if you have it.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 24, 2010 8:02 pm    Post subject:
Reply with quote

Hi Phil,

Quote:
Note : i cannot use NUMVAL bcz of older cobol version.
I do wonder at why organizations run compilers that are so out of date.

An incredibly poor management choice. . . icon_sad.gif
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Fri Sep 24, 2010 8:28 pm    Post subject:
Reply with quote

Dick -

Upgrading requires a certain infrastructure investment, and that may not be available everywhere (at least with the quality required).

Since software doesn't "break," and since (we) experienced programmers find legit workarounds for known issues, I can understand a certain amount of stagnation here.

With limited investment $$, application programmers affect the bottom line more directly.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Sep 24, 2010 8:36 pm    Post subject:
Reply with quote

dick scherrer wrote:
I do wonder at why organizations run compilers that are so out of date.

Because migrating to a new release not only requires the time and effort of the language support workgroup to install it and prescribe changes to JCL and (non-programmatic) procedures, but for someone to read through the migration documents and decide whether impacts require source modules to be reviewed and, perhaps, modified (costing even more).

My shop is now in the final year of a migration from MVS PL/I 1.1.1 to Enterprise PL/I (currently 3.8.0, build of 8 April 2010). It's a huge, expensive, and messy effort. And because it is huge, expensive, and messy, if IBM wasn't terminating support for MVS PL/I, we'd use that compiler until the Sun went cold.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Fri Sep 24, 2010 8:41 pm    Post subject:
Reply with quote

The tour guide at the Natural History Museum, pointing to the huge dinosaur skeleton, said that these animals roamed the earth 60million and six years ago.

I asked where she got that information, and she replied that when she started working at the museum, they told here the dinosaurs lived 60million years ago, and she's been working at the museum for six years.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 24, 2010 9:06 pm    Post subject:
Reply with quote

Hello,

I'm in favor of not always being the first in my neighborhood to get the current releases, but to run "stuff" that is 20-30-+ years old. . . Methinks this is nonsense.

Also, the "cost" of using the old stuff goes up. Unfortunately, this is only "opportunity cost", and as such counts little. . .
Quote:
application programmers affect the bottom line more directly
There is a willingness to pay the salaries to use less productive tools. . .

I also believe that as there is more and more integration with newer technologies, the out-of-service development tools will be replaced.

Lastly, it has been my experience that organizations that keep their software reasonably current do not have the problems/cost of waiting for many years to apply the upgrades. I suspect that if a system had been left to "idle" for 20 years, it could be quite an adventure doing the upgrade(s). . . icon_smile.gif
Back to top
View user's profile Send private message
venkat.bmw
Warnings : 2

New User


Joined: 05 May 2009
Posts: 21
Location: India

PostPosted: Tue Sep 28, 2010 7:28 pm    Post subject: Reply to: How to CONVERT TEXT for EXcel to Numeric(dec) valu
Reply with quote

Thanks all !!!! ...
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Tue Sep 28, 2010 7:29 pm    Post subject:
Reply with quote

Venkat -

So what is your solution?
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 convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm


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