1752810 Members
6112 Online
108789 Solutions
New Discussion юеВ

Re: Real type IEEE

 
Demortier
Occasional Contributor

Real type IEEE

I want to read a file of real; this file was built by a VaxVMS Application.
I want to read it on A I64 system ( OpenVMS 8.3) which authorize only IEEE Format. I want to translate this file of real to a file of IEEE.
8 REPLIES 8
Steven Schweda
Honored Contributor

Re: Real type IEEE

> [...] this file was built by a VaxVMS
> Application.

I'm not sure that that explains everything.

HELP RTL_Routines CVT$
Robert Gezelter
Honored Contributor

Re: Real type IEEE

Demortier,

If I may explicate some detail into Steven's previous posting.

Reading the file is not the problem. Bytes are bytes. Depending on which language one is using, the precise syntax matters, but the concept is the same.

For each number:
- read the binary value into an appropriate structure.
- invoke the appropriate CVT$ routine to convert it to IEEE

- Bob Gezelter, http://www.rlgsc.com
Mike Kier
Valued Contributor

Re: Real type IEEE

Also, on the off chance you're using Fortran, there are both compile-time conversion options (HELP FORTRAN /CONVERT) as well as run-time, per-LUN, conversions (FOR%CONVERT_xx logicals - See Chapter 9 in the Fortran Users Guide).
Practice Random Acts of VMS Marketing
Mike Kier
Valued Contributor

Re: Real type IEEE

btw, the /CONVERT and the FOR$CONVERT_xx items I mentioned are for unformatted files. If you need formatted access, then the $CVT options described above are the way to go.
Practice Random Acts of VMS Marketing
John Gillings
Honored Contributor

Re: Real type IEEE

>If you need formatted access, then the $CVT
>options described above are the way to go.

Hang on Mike! If the file is formatted (ie: REAL values are represented as decimal ASCII text strings), then IEEE vs F_FLOAT, D_FLOAT or G_FLOAT doesn't enter the picture. When you READ the file, the text field will be converted into whatever binary format your program uses.

Indeed, if you have binary files, one solution to this issue is to write a very simple one shot converter program which reads the binary records does whatever conversions are necessary, and writes them to a new text file. Convert all your data and go forward with the new file format.

Your application doesn't have to be coded with detail of potential different formats.
A crucible of informative mistakes
Colin Butcher
Esteemed Contributor

Re: Real type IEEE

The Integity Server running OpenVMS will handle both IEEE and VAX floating point types. The VAX types are emulated in software. The IEEE types are directly supported by the instruction set of the Itanium microprocessor. So, the VAX FP types will run less efficiently that the IEEE FP types because the use of VAX FP types will cause more instructions to be executed.

The compiler defaults to the use of IEEE FP types. You can explicitly declare the data fields to be VAX FP types. You should also be able to set the default floating point type by use of compiler switches.

Using non-IA64-default VAX FP types should then invoke the appropriate software emulation routines - so in theory you shouldn't notice.

For performance reasons you may wish to use IEEE FP types instead of VAX FP types.

If you're going to use this data set on a regular basis, then for best performance on the IA64 machine it would be best to convert the file from containing VAX FP type data to natively supported IEEE FP type data. Do that by writing a small conversion program that reads the data in from the file containing VAX FP type data and writes out another file containing IEEE FP type data.

For compatability reasons you may wish to keep the file in VAX FP type - it depends on what other systems you need to exchange data with.

Choose whichever strategy fits your circumstances best, then set the compiler defaults appropriately and decide if you need to convert all your stored data from VAX FP ypes to IEEE FP types. You may well find that the IA64 machine has sufficient performance relative to your old system that you can deal with the workload in an acceptable time without needing to convert fom VAX FP types tp IEEE FP types.

You might find the porting to Integrity article in the OpenVMS Technical Journal V6 useful (http://h71000.www7.hp.com/openvms/journal/v6/porting_openvms_to_integrity.pdf).

You might also find the slide set from a porting to Integrity talk useful (http://www.downloads.xdelta.co.uk/2007/2007_10_02-nl_vmstud_porting-colin_butcher-v1_4.pdf).

Cheers, Colin (http://www.xdelta.co.uk/vms).
Entia non sunt multiplicanda praeter necessitatem (Occam's razor).
Mike Kier
Valued Contributor

Re: Real type IEEE

>Hang on Mike! If the file is formatted (ie: REAL values are represented as decimal ASCII text strings), then IEEE vs F_FLOAT, D_FLOAT or G_FLOAT doesn't enter the picture. When you READ the file, the text field will be converted into whatever binary format your program uses.

You are right, of course, John. Our company uses a formatted record, but has UNION/MAP sections in the STRUCTURE definitions, so there are both ASCII and (primarily Integer) binary fields mixed together in the record, which is read/written as a formatted file.

We also get those kind of structures from S1032 datasets (I don't know if S1032 supports IEEE internally, but we may not be up to date on versions and we use the VAX datatypes to date).

I don't think that kind of thing is very uncommon, as I've seen it elsewhere and is the scenario I was thinking of where the CVT$ routines might be needed.
Practice Random Acts of VMS Marketing
Demortier
Occasional Contributor

Re: Real type IEEE

Thanks a lot! I used this forum for the first time; I used the Robert Gezelter's solution. Now i can use ( read ) my file of real (binary file)in I64 environement after a cvt$convert_float function. Thanks a lot again!