Kilowatt Software's
Classic Rexx Tutorial
Language Level 4.00 (TRL-2)

Function calls

Internal or external procedures, and built-in functions, can be called as functions using the following syntax. The result of the function call is processed in place as a term within the current instruction clause.

This invokes an internal or external procedure named functionName, or a built-in function, as a function. A series of arguments can optionally be prepared by the argumentExpression values. These arguments can be acquired in the invoked procedure by using either the parse arg or arg instructions, or the arg built-in function. The invoked procedure MUST return a result which is provided in place as a term within the current instruction clause.

The name provided as functionName can be provided as a quoted string -- e.g. 'X2C'. When it is a quoted string, an internal procedure is not invoked, and a built-in function or external procedure is invoked instead. When a built-in function is invoked, using this technique, the name in quotes should be in upper case.

The search order for the target procedure, or built-in function is:

  1. internal procedure -- unless the procedure name was enclosed in quotes
  2. built-in function
  3. external procedure

The mechanism for locating and activating an external procedure is implementation-dependent.

Click here to study the procedure instruction.

Click here to review the structure of Rexx programs and procedures.

Note: if a function call starts where an instruction is expected, the instruction is processed as a command! You should be particularly careful if you use isolated function calls in other programming languages; such as, C, C++, C#, Java, etc.

The following is an example of a function call.

Processing state information is SAVED during function and subroutine calls

The processing state of the following information is saved when a function or subroutine call is performed. The state of this information is restored when the function or subroutine returns.

Here is another example of a series of function calls within a single assignment instruction.


Kilowatt Software's -- Classic Rexx Tutorial -- Back to top
Click here if you have any comments or questions regarding this tutorial

Last updated on: 31 Aug 2002