Operating System - OpenVMS
1753818 Members
8147 Online
108805 Solutions
New Discussion юеВ

Re: Floating point numbers in batches possible?

 
SOLVED
Go to solution
matt burns
Occasional Advisor

Floating point numbers in batches possible?

How can I store and manipulate floating point numbers from within a batch?

I'm well versed in batch logic and lexicals etcetera but mainly for file manipulation.

I know symbols can only hold integers and strings but I really need floating point numbers.

Can anyone help?
9 REPLIES 9
Martin P.J. Zinser
Honored Contributor
Solution

Re: Floating point numbers in batches possible?

Hello,

how about this

CFD002> a = "1.7"
CFD002> b = "2.1"
CFD002> icalc 'a' + 'b'
3.8
CFD002> sh sym icalc*
ICALC == "$PUBBIN:ICALC"
ICALC_OUT = " 3.8"


Icalc can be found at
http://zinser.no-ip.info:8080/www/vms/sw/icalc.htmlx

or
ftp://vms.process.com/ftp/vms-freeware/fileserv/

(the new home of the WKU archive, yes I know I need to update that page)




matt burns
Occasional Advisor

Re: Floating point numbers in batches possible?


Cheers for the tip with ICALC, it was just the sort of thing I needed. Extra bonus for the trig functions cos I needed them too!
matt burns
Occasional Advisor

Re: Floating point numbers in batches possible?


This is really another question but I thought I'd continue on this one...

The ICALC utility is great but, when not run interactively it still generates output.
I can't compile C code on the node I use and so cant change ICALC. I know I can divert SYS$OUTPUT into a text file, but is it possible to divert it into nothing like on unix?

If you're wandering what it's for, it to code a rotating wireframe cube made from asterixes on a VT100 terminal through telnet, I've attatched a basic working version if you're interested!
Antoniov.
Honored Contributor

Re: Floating point numbers in batches possible?

Hi Matt,
I downloaded your file and ICALC; I've compiled ICALC anad run CUBE. I can't understand exactly your problem, perhaps it's follow:
a) You can assingn output to null assign to device NLA0: (I suppose to change assign to *.TMP I've found so run quicly)
b) I've look for source and I've found ICALC can solve cos, sin and other trigonometric funcion.

HTH
Antoniov

Antonio Maria Vigliotti
Martin P.J. Zinser
Honored Contributor

Re: Floating point numbers in batches possible?

$ define/user sys$output nla0:
$ icalc 4.4 * 3.3
$ sh sym ica*
ICALC == "$PUBBIN:ICALC"
ICALC_OUT = " 14.52"


/user causes the define to be active for the next command invocation, so it is restored automatically after the icalc calculation

Greetings, Martin
Hein van den Heuvel
Honored Contributor

Re: Floating point numbers in batches possible?

matt> I've attatched a basic working version if you're interested!

That attachment was a zipped vms variable length record file with extention .com.
Which is perfectly fine by me and my vms systesm, but it upsets my billybox.
As I to read it on my pc, Notepad goes all funny.
The freeware 'textpad' that I use instead of notepad at least shows contents in its hex binary view mode.

To really read it I cobbled up a little perl script.
For your entertainment (nospan not supported :-)....

binmode STDIN;
while (read STDIN,$length_word,2) {
# avoid using "S" or "V". just do the math.
($length,$null) = unpack ("CC",$length_word);
$length += $null*256;
last if ($length > 32767);
$read = read STDIN,$line,$length;
# print "$length\t$line\n";
print "$line\n";
read STDIN,$null,1 if ($length & 1);
}

matt burns
Occasional Advisor

Re: Floating point numbers in batches possible?


Cheers for the help guys, the nla0: tip was handy, and I've sped up quite a few of my batches with it :o)

To the chap with the perl script, you only had to ask and I would have sent it in windows format! nice script though!
Jeroen Hartgers_2
New Member

Re: Floating point numbers in batches possible?

sometimes it is easier to do this
$b = 5
$c = 2
$a = (100*b)/c
$show symbol a
a = "250"
If you want to display the value of a the right way you simpley use f$extract to place the comma

$output = "''f$extract(0,1,a)',-
''f$extract(1,2,a)'"

show symbol output
output = "2,50"
Willem Grooters
Honored Contributor

Re: Floating point numbers in batches possible?

Just got this from the VMS technical Update: This feature will be - standard - be available in 7.3-2. Amongst others...
Willem Grooters
OpenVMS Developer & System Manager