× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jared, I'm hesitant to offer any suggestions as I have never used COBOL.  
But, I do use C on a regular basis and being that there don't seem to be any
replies, I'll give it a try.

1)
In C there is a concept of a header file where you may define a prototype of
the function (procedure).  This prototype can then be included by one or
more C parts.
Can a C header file be included in COBOL? 
I ask, because there may be a mismatch between a header file prototype
declaration and actual C file definition.

2) 
If you are not using header files, but letting the compiler find the
prototype definition in the already compiled C module, check your C code.
Some compilers are sensitive about code that doesn't do a return in all
cases.
For example if you put your return statement within an if block, but not
outside the if block, compiler may complain that if the if block condition
is not satisfied, there is never a return.

3)
function returns a local variable that is not initialized in all
circumstances.

4)
some languages (i.e. BASIC) define 'procedure' as a routine that does NOT
return a value and 'function' as a routine that returns a value.  
Is there anything like that concept in COBOL?  
I see you mention a procedure and not a function (C term for both type of
routines is function).

What is a RETURN-CODE special register?

Elvis 

-----Original Message-----
From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx] On
Behalf Of jared
Sent: Friday, July 23, 2004 4:08 PM
To: C400 List; cobol400 list
Subject: [C400-L] ILE cobol / C procedure call

I'm trying to compile a COBOL program that CALLs a C procedure and uses
the RETURNING clause, but I keep getting the following compile error:

---
 Message . . . . :   A CALL statement expected a return value from a
   program that does not return a value or visa versa.
---

So first of all, the C procedure is declared to return int.  But since I'm
compiling the COBOL into one module, compiling the C procedure into a
service program, and binding the modules later on...how is the COBOL
compiler supposed to know anything at all about whether or not my
C procedure returns a value?!?  Is there a COBOL section for defining such
things?

This is all undertaken as a workaround, btw, since I still haven't gotten
the RETURN-CODE special register to reflect my C return values.

Have a good weekend, everyone-

-Jared

_______________________________________________
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.