[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference clt::cobol

Title:VAX/DEC COBOL
Notice:Kit,doc,performance talk info-->DIR/KEY=KIT or DOC or PERF_TALK
Moderator:PACKED::BRAFFITT
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3250
Total number of notes:13077

3241.0. "Call a function that returns a double?" by KZIN::HUDSON (That's what I think) Tue May 13 1997 12:39

Is it possible in COBOL to call a function (written, say, in C) that returns
a double?  For example, could you call the following?

double test()
{
	return 1234.567;
}

Or do I have to wrap this in another piece of C which puts the result into
an argument which gets passed by reference, e.g.:

void wrapper(double *d)
{
	*d = test();
}

and then use

	call "wrapper" using by reference double-result

where double-result is COMP-2

?

nick
T.RTitleUserPersonal
Name
DateLines
3241.1EasyQUARRY::nethCraig NethTue May 13 1997 14:0526
>Is it possible in COBOL to call a function (written, say, in C) that returns
>a double?

Sure.

granda.zk3.dec.com> cat doub.cob
IDENTIFICATION DIVISION.
PROGRAM-ID. double.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01  double-var comp-2.
PROCEDURE DIVISION.
a.
      call "test" giving double-var.
      display "double var = " double-var conversion.

granda.zk3.dec.com> cat test.c
double test()
{
        return 1234.567;
}
granda.zk3.dec.com> !cobol
granda.zk3.dec.com> cobol doub.cob test.c
granda.zk3.dec.com> a.out
double var =  1.23456700000000E+003
3241.2KZIN::HUDSONThat's what I thinkWed May 14 1997 05:577
re: .1

duh! (strikes himself on forehead)

thanks!

nick