IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Senior Member


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

PostPosted: Fri Sep 24, 2010 6:11 pm
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

Moderator Emeritus


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

PostPosted: Fri Sep 24, 2010 7:32 pm
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

Senior Member


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

PostPosted: Fri Sep 24, 2010 7:38 pm
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

Moderator Emeritus


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

PostPosted: Fri Sep 24, 2010 8:02 pm
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

Senior Member


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

PostPosted: Fri Sep 24, 2010 8:28 pm
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: 1788
Location: Bloomington, IL

PostPosted: Fri Sep 24, 2010 8:36 pm
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

Senior Member


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

PostPosted: Fri Sep 24, 2010 8:41 pm
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

Moderator Emeritus


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

PostPosted: Fri Sep 24, 2010 9:06 pm
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
Reply with quote

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

Senior Member


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

PostPosted: Tue Sep 28, 2010 7:29 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top