Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Function call

&pagelevel(3)&pagelevel

Functions are called by means of their function name.

SDF-P recognizes a function by the parentheses that follow the function name,e.g. USER-IDENTIFICATION( ).

These parentheses can be omitted if the function call does not contain any input parameters. In this case, however, SDF-P first interprets the (function) name as a variable name. SDF-P interprets the name as a function name only if no variable with this name exists.

If a variable of the same name exists, SDF-P accesses the variable and inserts the variable value, if any.

Note

The parentheses should always be included in the function call in order to avoid any possibility of confusion with variables.

Functions are components of expressions. This means they can be called wherever expressions are allowed.

In assignments, all functions can be called that appear on the right-hand side of the assignment (i.e. to the right of the equals sign). In this way, for example, the result value of the function is assigned to a variable.

Example

/USER = USER-IDENTIFICATION( )

The user ID is assigned as a value to the USER variable.

If functions are called in expressions, when the expression is evaluated SDF-P inserts the result of the function at the location in the expression from which the function was called.

Example

/DECLARE-VARIABLE VAR-A
/NAME = 'ELEM1' // FIRST-VARIABLE-NAME('VAR-A')
/SHOW-VARIABLE NAME
NAME = ELEM1*END

The NAME variable is assigned a string made up of the string ELEM1 and the string returned as the result of the function (in this case *END).

In command calls, functions can be inserted in order to build up a command. For example, functions can be called when operand values are assigned. They can also be used like variables in & replacement.

Example

/DECLARE-VARIABLE ST(TYPE=*STRUCTURE(*DYNAMIC))
/SET-VARIABLE ST.A1 = 'ANNA'
/SHOW-VARIABLE ST.A1
ST.A1=ANNA
/SET-VARIABLE &(FIRST-VARIABLE-NAME('ST')) = 'MARIA'
/SHOW-VARIABLE ST.A1
ST.A1 = MARIA

The first element of structure ST, which can be determined by & replacement of the function FIRST-VARIABLE-NAME( ), is assigned the string ’MARIA’ as its contents (thus overwriting the old contents).