Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Simple procedure creation

&pagelevel(5)&pagelevel

S procedures have a standard format that is set up to facilitate the programmer’s work with variables as much as possible, through implicit variable declaration, a dynamically changing data type and the dynamic expansion of complex variables.

Implicit variable declaration

“Implicit declaration” means that variables do not have to be declared explicitly by means of a command. They are automatically declared when they are assigned a value.

Unless otherwise specified, variables can be declared implicitly in S procedures; they are then created with standard attributes, as simple variables with a dynamically changing data type (see below) and the scope “current procedure”. This means that only those variables can be accessed that are contained in the current procedure and in procedures that are called within this procedure with the INCLUDE-PROCEDURE command (for further details, see section “Scope of variables”).

Dynamically changing data type

The data type determines the values that a variable can assume, such as an integer value (data type = integer) or a random string (data type = string).
Unless otherwise specified, variables in S procedures are created with a dynamically changing data type.

“Dynamically changing data type” means that the data type is not determined when the variable is declared; it is first determined when a value is assigned. It can then change with each assignment, i.e. a variable can, for example, be assigned an integer value, a string, and again an integer value, one after the other.

The current data type can be queried by means of the predefined function CURRENT-TYPE() (for information on predefined functions, see "CURRENT-TYPE( ) Request variable type ").

Dynamic expansion of complex variables

Complex variables are variables that are made up of several variable elements. Complex variables must be declared explicitly. For this explicit declaration, the variable elements do not have to be known, nor do their number of elements or their names or data types.

Unless otherwise specified, complex variables are declared as dynamically extendable in S procedures. “Dynamically extendable” means that if, during processing, these complex variables require more elements than are currently available, elements are added automatically (the complex variable is extended).