gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] Returning clause in procedure division


From: David Essex
Subject: Re: [open-cobol-list] Returning clause in procedure division
Date: Tue, 29 Jan 2008 08:02:32 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1b) Gecko/20020722

Bill Klein wrote:

> David Essex wrote:
>>
>> While the RETURNING clause is allowed in the CALL statement,
>> it seams to be missing from the 'PROCEDURE DIVISION'.
>> Doesn't the COBOL 2002 standard define the following ?
>>
>> CALL [ using-phrase ] [ RETURNING data-name-2 ]
>> PROCEDURE DIVISION [ using-phrase ] [ RETURNING data-name-2 ] ...
>
What the '02 Standard defines (having RETURNING in the Procedure Division
header) was a relatively late enhancement and was NOT something in any of
the (many) compilers that had the "returning" concept (and allowed it in a
CALL statement) - when the '02 Standard was approved.

According to an old I*M COBOL-85 language reference, both the 'CALL ... returning' and 'Procedure Division ... returning' are defined as an extension to the standard.

It certainly SHOULD be allowed there by any compiler conforming to the '02
Standard, but it is NOT needed for any compiler that is simply trying to
"match" the common extension to the '85 Standard.

The 'CALL ... returning' clause, even with limited return types,
facilitates interaction with other languages, in particular 'C'.

The 'Procedure Division ... returning' clause provides a better and more consistent approach used by (most) modern languages. it is certainly a better approach than using an implicit variable, such as 'RETURN-CODE'. Which, by the way, is also a common extension to the COBOL-85 standard.

The COBOL-2002 standard defines a very much enhanced 'RETURNING' clause. It's full implementation in OC would require a substantial amount of work. Implementing the 'Procedure Division ... returning' clause, even as a COBOL-85 extension, should only require a fraction the amount of work.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]