× 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.


  • Subject: CALL PROCEDURE RETURNING with different return fields
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Fri, 18 May 01 20:21:41 +1000
  • Cc: "Peter McMullen" <pmcm@xxxxxxxxxxx>


Hello All,

Help!  I've just discovered something rather weird with the ILE COBOL compiler 
(on VRM440 but I doubt the release matters).

<=========== The story so far ======================>
SPECIAL-NAMES.
        linkage procedure for "GETDELIMITEDSTRING"
                using all described.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 inString     pic     x(100).
01 delimiter    pic     x(1).
01 char10       pic     x(10).
01 char100      pic     x(100).

PROCEDURE DIVISION.
MAINLINE SECTION.

        call "GETDELIMITEDSTRING" using inString delimiter
                returning char10

        call "GETDELIMITEDSTRING" using inString delimiter
                returning char100
<============ End of story =============>

The compiler barfs with LNC2756 "The CALL GIVEING/RETURNING item does not match 
the specified return item."

Changing the calls to:
        call "GETDELIMITEDSTRING" using inString delimiter
                returning char10

        call "GETDELIMITEDSTRING" using inString delimiter

causes the compiler to vomit with LNC2757 "A call statement expected a return 
value from a program that does not return a value or vice versa."

Neither of the error message is truly indicative of the real problem.  The only 
way the module will compile is if the calls to GETDELIMITEDSTRING are returning 
identical data items.  That is any of the following will work:

        call "GETDELIMITEDSTRING" using inString delimiter
        call "GETDELIMITEDSTRING" using inString delimiter
or
        call "GETDELIMITEDSTRING" using inString delimiter
                returning char10
        call "GETDELIMITEDSTRING" using inString delimiter
                returning char10
or
        call "GETDELIMITEDSTRING" using inString delimiter
                returning char100
        call "GETDELIMITEDSTRING" using inString delimiter
                returning char100

but you cannot have different calls to the same procedure in a single module.  
Isn't that peculiar?????????

The parameter items can differ in definition but the return items must be 
identical.  Does anyone know why that is so?  I couldn't find any documentation 
to say this is a requirement.  While it is possible to work around this problem 
it does seem an odd restriction:  I might want to ignore the return value on 
some calls to a procedure, in other calls I might want to store the result in 
different sized data items.  Comments?

Regards,
Simon Coulter.

«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software         AS/400 Technical Specialists       «»
«» Eclipse the competition - run your business on an IBM AS/400.  «»
«»                                                                «»
«» Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\   «»
«» Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /   «»
«»                                                           X    «»
«»               ASCII Ribbon campaign against HTML E-Mail  / \   «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the COBOL/400 Mailing List!
| To submit a new message, send your mail to COBOL400-L@midrange.com.
| To subscribe to this list send email to COBOL400-L-SUB@midrange.com.
| To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---END


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.