09.12.2012 Views

Basic Characteristics RAPID

Basic Characteristics RAPID

Basic Characteristics RAPID

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Routines <strong>Basic</strong> <strong>Characteristics</strong> <strong>RAPID</strong><br />

3.2 Parameters<br />

The parameter list of a routine declaration specifies the arguments (actual parameters)<br />

that must/can be supplied when the routine is called.<br />

There are four different types of parameters (in the access mode):<br />

- Normally, a parameter is used only as an input and is treated as a routine variable.<br />

Changing this variable will not change the corresponding argument.<br />

- An INOUT parameter specifies that a corresponding argument must be a variable<br />

(entire, element or component) or an entire persistent which can be<br />

changed by the routine.<br />

- A VAR parameter specifies that a corresponding argument must be a variable<br />

(entire, element or component) which can be changed by the routine.<br />

- A PERS parameter specifies that a corresponding argument must be an entire<br />

persistent which can be changed by the routine.<br />

If an INOUT, VAR or PERS parameter is updated, this means, in actual fact, that the argument<br />

itself is updated, i.e. it makes it possible to use arguments to return values to the calling<br />

routine.<br />

Example: PROC routine1 (num in_par, INOUT num inout_par,<br />

VAR num var_par, PERS num pers_par)<br />

A parameter can be optional and may be omitted from the argument list of a routine<br />

call. An optional parameter is denoted by a backslash “\” before the parameter.<br />

Example: PROC routine2 (num required_par \num optional_par)<br />

The value of an optional parameter that is omitted in a routine call may not be referenced.<br />

This means that routine calls must be checked for optional parameters before an<br />

optional parameter is used.<br />

Two or more optional parameters may be mutually exclusive (i.e. declared to exclude<br />

each other), which means that only one of them may be present in a routine call. This<br />

is indicated by a stroke “|” between the parameters in question.<br />

Example: PROC routine3 (\num exclude1 | num exclude2)<br />

The special type, switch, may (only) be assigned to optional parameters and provides a<br />

means to use switch arguments, i.e. arguments that are only specified by names (not<br />

values). A value cannot be transferred to a switch parameter. The only way to use a<br />

switch parameter is to check for its presence using the predefined function, Present.<br />

Example: PROC routine4 (\switch on | switch off)<br />

...<br />

IF Present (off ) THEN<br />

...<br />

ENDPROC<br />

Arrays may be passed as arguments. The degree of an array argument must comply<br />

5-12 <strong>RAPID</strong> Reference Manual

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!