Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

RETURNS option and attribute

If a procedure is a function procedure, you must specify the RETURNS option on the procedure statement. Further, in the invoking procedure or package, you must declare such a procedure as an entry with the RETURNS attribute. The RETURNS option and the RETURNS attribute are used to specify the attributes of the value that is being returned. The attributes in the RETURNS option must match the attributes in the RETURNS attribute.

Procedures that are subroutines (and are therefore invoked using the CALL statement) must not have the RETURNS option on the procedure statement and their entry declaration must not have the RETURNS attribute.

Read syntax diagramSkip visual syntax diagram               .-----------.
               V           |
>>-RETURNS--(----attribute-+--)--------------------------------><
 

If more than one attribute is specified, they must be separated by blanks (except attributes such as precision that are enclosed in parentheses).

The attributes are specified in the same way as they are in a declare statement. Defaults are applied in the normal way.

The attributes that can be specified are any of the data attributes and alignment attributes for scalar variables (as shown in Table 8). ENTRY variables must have the LIMITED attribute. In addition, you can specify the TYPE attribute to name user-defined types, ordinals, and typed structures and unions.

String lengths and area sizes must be specified by constants. The returned value has the specified length or size.

BYADDR and BYVALUE can also be specified in the list of attributes for RETURNS. The BYADDR attribute must be in effect if a procedure contains any ENTRY statements and the procedure or any of its secondary entry points returns:

On z/OS, BYADDR is the default for RETURNS. If a C function is called, BYVALUE must be specified in the list of attributes for RETURNS. For a discussion of these attributes, see Using BYVALUE and BYADDR.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)