> From: rick.baird@xxxxxxxxxxxxxxx
> 
> can someone provide me an example of a cobol program calling a
procedure
> that returns a value?  - or point to a reference in the archives?

Okay, I've got one example that doesn't return a value.  Let's start
with that (on Christmas Eve, no less!).

CALL LINKAGE TYPE IS PROCEDURE 'SCCEXECOVRDBF' USING    
    BY REFERENCE SOURCE-I, R-LIBRARY, R-FILE, R-MEMBER  

This allows me to invoke the following procedure:

DSccExecOvrdbf    PR                        
D FromFile                      10    const 
D ToLib                         10    const 
D ToFile                        10    const 
D ToMember                      10    const

The module with the procedure has to be in whatever binding directory
you use to compile your program.  I don't know a compiler directive for
COBOL that does that.

Additional information here:

http://www.midrangeserver.com/guruo/mgo040502-story02.html

The only part I haven't used yet is the return value, but I believe
that's simply using the RETURNING INTO clause (covered in the ILE COBOL
manual starting on page 215).  The clause of the CALL should be
RETURNING INTO, being careful to specify a variable of the appropriate
type.  That information can be found in the IL COBOL manual on page 265.

The ILE COBOL Manual:

http://publib.boulder.ibm.com/html/as400/v5r1/ic2924/books/c0925402.pdf


Joe


This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2020 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].