Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

dcl and floating point values

 
SOLVED
Go to solution
Scotty HD
Frequent Advisor

dcl and floating point values

hello,
I am writing a com procedure which compute a floating point value at the end. Looks like dcl does not support floating point value.
instead of 0.25 i get 0.
how to achieve this ?

i want com procedure to do the printing of the floating point value. even if i call c program from com procedure to compute floating point
value, how do i return it back to com procedure ?

Scotty
17 REPLIES 17
Hoff
Honored Contributor
Solution

Re: dcl and floating point values

DCL supports only signed integers, and does not support floating point notation, nor unsigned values.

Your option is to maintain your data in strings, or to bias by 10 or 100 or similar hackery.

Here's a general write-up:

http://snow.hoffmanlabs.net/node/487

There are links there to lib$set_symbol and related calls over in Jim Duff's eight-cubed examples library.
Hein van den Heuvel
Honored Contributor

Re: dcl and floating point values

DCL does NOT support floating point values.
You'll have to fake it with strings, and/or change the base unit. That is, do the math in Cents instead of Dollars or Meters instead of Kilometers. You many need to use 2 variables, one for the units, one for the fraction.

Of course then your next problem might be to it to run into the 31 bit 2Gb limitation.

Folks have created tools to deal with this, taking float arguments, return a dcl string symbol. For example:http://www.eight-cubed.com/downloads.html -- MATH

If I can not readily fake it then I try switching the whole script to AWK or PERL.

To help you with the best possible solution we'd need to know more details about what you intend to do.


Maybe and same input + desired output example?
(please use a .TXT for details and/or to maintain formatting if need be.)

Hope this helps some
Hein
Scotty HD
Frequent Advisor

Re: dcl and floating point values

#Hoff
thanks for reply.
i am facing problem accessing the link.

Scotty
Hein van den Heuvel
Honored Contributor

Re: dcl and floating point values

>> i am facing problem accessing the link.

Which link? For Jimm Duff's site I first needed to exploit the google cache, and from there I coudl get to math.zip.
On retry (to test the link in my reply) it worked directly though.

Hein
Scotty HD
Frequent Advisor

Re: dcl and floating point values

#Hein van den Heuvel
thank you for reply
i was not able to access link given by Hoff.
able to access the link you have given. i will try that.

# If I can not readily fake it then I try switching the
# whole script to AWK or PERL.
do you mean AWK/PERL can give more flexibilty than dcl com
procedures ?

any documents on these for me to get started.

Scotty
RBrown_1
Trusted Contributor

Re: dcl and floating point values

Hoff
Honored Contributor

Re: dcl and floating point values

Yeah, Hoff did mean that. So much for my ability to paste links from the live server and not the test server.
Hoff
Honored Contributor

Re: dcl and floating point values

Hein van den Heuvel
Honored Contributor

Re: dcl and floating point values

>> do you mean AWK/PERL can give more flexibilty than dcl com
procedures ?

If the bulk of the work is string manipulation then yes, absolutely.

Consider the following silly 'one liner':

$ perl -e "for (qx(show dev d/ful)){ $d=$1 if /^Disk\s+(\S+),/; $t=$1 if /al blocks\s+(\d+)/; printf qq(%20s %5.2f%%\n) ,$d,100*$1/$
t if /ee blocks\s+(\d+)/}"
EISNER$DKA0: 36.91%
EISNER$DRA1: 65.56%
EISNER$DRA2: 24.45%
EISNER$DRA3: 57.03%
EISNER$DRA4: 36.03%
EISNER$DRA6: 13.61%
EISNER$DVA0: 20.22%

But it would really help to understand what you want to calculate/process to help suggest what might be best.

Hein