Sample Application Compiled with /float=ieee Flag (VMS)
This sample application illustrates the use of the /float=ieee flag when compiling embedded SQL programs on VMS.
Setup:
createdb testdb
sql testdb <create.sql
Create.sql does the following:
drop table test1;
\p\g
create table test1 ( col1 float8 );
\p\g
insert into test1 (col1) values (1.400) ;
\p\g
Fortran sample program PROG01.SF:
Program PROG01
implicit none ! NEW
exec sql include sqlca
exec sql include sqlda
exec sql begin declare section
real*8 testfloat
real*8 testafter
character*10 database
character*100 errmsg
exec sql end declare section
print *, ' - This is a test program - testing REAL*8 data type !! '
print *, ' '
testfloat = 1.5
database = 'testdb'
print *, ' - Connecting to database : ', database
print *, ' ' ! NEW
exec sql whenever sqlerror call sqlprint
exec sql connect :database
print *, ' - Delete any records that are :' , testfloat
print *, ' ' ! NEW
exec sql delete from test1 where col1 = :testfloat
print *, ' - Inserting value ', testfloat, 'in table : test1 '
print *, ' ' ! NEW
exec sql insert into test1 (col1) values (:testfloat)
exec sql commit
exec sql select col1 into :testafter from test1
where col1 = :testfloat
print *, ' - Returned value is ', testafter
exec sql disconnect
end
The precompile and compile script:
$! precompiling
$!
$ esqlf prog01
$!
$! Compiling with the required IEEE qualifier
$!
$ for /float=IEEE/align/extend prog01
$!
$ link prog01.obj,ii_system:[ingres.files]esql.opt/opt
$!
$ run prog01.exe
Example of output from the program when compiled with the /float=ieee qualifier:
select hex(col1) from test1\g
Executing . . .
+----------------+
|col1 |
+----------------+
|3FF6666666666666|
|3FF8000000000000|
|0000000000004018|
+----------------+
(3 rows)
continue
*
select * from test1\g
Executing . . .
+-----------+
|col1 |
+-----------+
| 1.400|
| 1.500|
| 0.000|
+-----------+
(3 rows)
continue
*
Example of output from the program when compiled without the /float=ieee qualifier:
select hex(col1) from test1\g
Executing . . .
+----------------+
|col1 |
+----------------+
|3FF6666666666666|
|3FF8000000000000|
|0000000000004018|
+----------------+
(3 rows)
continue
*
select * from test1\g
Executing . . .
+-----------+
|col1 |
+-----------+
| 1.400|
| 1.500|
E_MO003C Unknown exception 00011301: current query program aborted
E_LQ002B 'rollback' may not be nested within a data retrieval loop.
E_LQ002B 'commit' may not be nested within a data retrieval loop.
Last modified date: 01/30/2023