I was quite surprised to find that it's possible for an RPG procedure which is defined as returning a value to end without returning a value. When this happens escape message RNX0224 ('RPG procedure &1 ended without returning a value') is sent and the call to the procedure ends in error (RNQ0202).
I had assumed (wrongly) that the compiler would disallow any such procedures with an error such as RNF5415, but apparently as long as at least one RETURN operation exists within the procedure then it compiles successfully.
Is it known what the intended use is for such procedures? I think I'm right in saying that in other programming languages (e.g. Java) this isn't possible.
I had assumed (wrongly) that the compiler would disallow any such procedures with an error such as RNF5415, but apparently as long as at least one RETURN operation exists within the procedure then it compiles successfully.
Is it known what the intended use is for such procedures? I think I'm right in saying that in other programming languages (e.g. Java) this isn't possible.
Comment