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

Conference hydra::axp-developer

Title:Alpha Developer Support
Notice:[email protected], 800-332-4786
Moderator:HYDRA::SYSTEM
Created:Mon Jun 06 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3722
Total number of notes:11359

3615.0. "Software-B�ro Funke - Point 28083" by KZIN::ASAP () Tue May 13 1997 11:38

    Company Name :  Software-B�ro Funke - Point 28083
    Contact Name :  Joachim Tr�tken
    Phone        :  +49 (511) 61858
    Fax          :  +49 (511) 619201
    Email        :  [email protected]
    Date/Time in :  13-MAY-1997 15:38:14
    Entered by   :  Nick Hudson
    SPE center   :  REO

    Category     :  vms
    OS Version   :  7.1
    System H/W   :  


    Brief Description of Problem:
    -----------------------------

From:	RDGENG::MRGATE::"RDGMTS::PMDF::mail.dec.com::Omuiric" 13-MAY-1997 15:15:22.63
To:	RDGENG::ASAP
CC:	
Subj:	ESCALATION: POINT  , Company  TO ASAP READING:      28083

From:	NAME: Ciaran OMuiri <[email protected]@PMDF@INTERNET>
To:	NAME: '[email protected]' <IMCEAX400-c=US+3Ba=+20+3Bp=DIGITAL+3Bo=SBUEURMFG+3Bdda+3ASMTP=asap+40reo+2Emts+2Edec+2Ecom+3B@mail.dec.com@PMDF@INTERNET>

Hello -

POINT Log Number28083	
Company Name Software-B�ro Funke  	
Engineers name Joachim Tr�tken	
Telephone Number  +49 (511) 61858  		
Fax Number	+49 (511) 619201
	
E-mail Address [email protected]	

Operating System, Version	
	OpenVMS 7.1
	C 5.5
	Cobol 2.4

Platform
Dec Alpha Station 200 4/100			

Problem Statement	
We are having problems call C sub programmes from Cobol

1How do we declare the external c function in cobol whoes output is a 
double?

2 How are the parameters excluding the double type to be given

3 Are there special compliers or link options which need to be 
installed for this constallation



Wir haben Probleme mit dem Aufruf von C-Unterprogrammen aus Cobol
heraus:


1. Wie ist in Cobol die externe C-Funktion (liefert Double-Wert 
zurueck)
zu deklarieren?

2. Wie sind die Parameter (ausschlie�lich vom Typ Double) zu 
uebergeben?


3. Gibt es spezielle Compiler- oder Link-Optionen, die fuer diese
Konstellation einzustellen sind?


Regards

Ciaran


	






In replying, please use [email protected]




RFC-822-headers:
Received: from reoexc1.reo.dec.com by rg71rw.reo.dec.com (PMDF V5.0-7 #15552)
 id <[email protected]> for [email protected]; Tue,
 13 May 1997 10:41:46 +0100
Received: by reoexc1.reo.dec.com with SMTP
 (Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63)
 id <[email protected]>; Tue, 13 May 1997 10:43:35 +0100
X-Mailer: Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63
T.RTitleUserPersonal
Name
DateLines
3615.1KZIN::HUDSONThat&#039;s what I thinkTue May 13 1997 12:401
see 3241 in cobol conf.
3615.2KZIN::HUDSONThat&#039;s what I thinkWed May 14 1997 06:2298
From:	DEC:.REO.REOVTX::HUDSON       "[email protected] - UK Software
Partner Engineering 830-4121" 14-MAY-1997 10:21:10.26
To:	vbormc::"[email protected]"
CC:	HUDSON
Subj:	RE: POINT 28083, COBOL/C double

Guten Tag Joachim Tr�tken

Sorry, my German is not very good.

Here is an example which I hope will help.  If this doesn't answer your
question please tell me...

Regards
Nick Hudson
Digital Software Partner Engineering

==============================================================================
$
$ type prog.cob
identification division.

program-id. cobol_test.
data division.

working-storage section.
01	double-result comp-2.
01	double-param comp-2.
01	int-val1 pic 9(6) comp.
01	int-val2 pic 9(6) comp.

procedure division.
main section.
p1.
	move 1 to int-val1.
	move 23 to int-val2.
	display "int-val1 is now " int-val1 with conversion.
	display "int-val2 is now " int-val2 with conversion.
	display "double-param is " double-param with conversion.
	display "Calling C to evaluate int-val1 / int-val2".
	call "routine1" using 
		by value int-val1 
		by reference int-val2
		by reference double-param
		giving double-result.
	display "int-val1 is now " int-val1 with conversion.
	display "int-val2 is now " int-val2 with conversion.
	display "double-param is " double-param with conversion.
	display "double-result is " double-result with conversion.
	
$ type sub.c
double routine1(int p1, int *p2, double *d1)
{
	double	x = ((double)p1 / (double) *p2);

	/* try and change the parameters */
	p1 = 0;
	*p2 = 0;
	*d1 = x;

	return x;
}

$ cob prog/flo=g_flo	!	default would be d_float
$ cc sub		!	default is g_float
$ link prog,sub
$ r prog
int-val1 is now 
     1
int-val2 is now 
    23
double-param is 
 0.00000000000000E+000
Calling C to evaluate int-val1 / int-val2
int-val1 is now 
     1
int-val2 is now 
     0
double-param is 
 4.34782608695652E-002
double-result is 
 4.34782608695652E-002
$
$! Or you can use D_FLOAT....
$ cob prog		! default will be D_FLOAT
$ cc sub/flo=d_flo	! force to D_FLOAT
$ lin prog,sub
$ r prog
int-val1 is now      1
int-val2 is now     23
double-param is  0.000000000000000E+00
Calling C to evaluate int-val1 / int-val2
int-val1 is now      1
int-val2 is now      0
double-param is  4.347826086956522E-02
double-result is  4.347826086956522E-02
$