Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

S variables and procedure parameters

&pagelevel(4)&pagelevel

Procedure parameters in BS2000 are parameters which are passed from the caller to the procedure when the procedure is called. They serve to pass information from one procedure to another

Both S and non-S procedures can use procedure parameters.

In S procedures, procedure parameters are created and processed as S variables. However, the attributes of procedure parameters are not quite the same as for “normal”
S variables; they differ from the latter in their function, location and the commands used to declare them, and also in that not all variable attributes apply to procedure parameters.

The following table shows the differences and common features.


S variable

Procedure parameter

Location of declaration

Procedure body

Procedure head

Command used for the
declaration

DECLARE-VARIABLE
DECLARE-ELEMENT

DECLARE-PARAMETER

Variable type

Simple variable
Complex variable

Simple variable

Permissible data types

ANY
STRING
INTEGER
BOOLEAN

ANY
STRING
INTEGER
BOOLEAN

Scope

Explicitly definable:
current procedure
task

Implicitly definable:
Current

Container

As variable container:
S variable
job variable

No container

Whereas, in non-S procedures, procedure parameters can only be used at procedure call to pass values to the called procedure, in S procedures procedure parameters can be used in addition to access the contents of variables in superordinate procedures. For this to be possible, either the procedure must be called by an INCLUDE-PROCEDURE or the variables concerned must be task-global variables. (For further details, see section “Scope of variables”.)

The link between variables and procedure parameters is effected by declaring the procedure parameters in a DECLARE-PARAMETER command, with TRANSFER-TYPE = *BY-REFERENCE. The string that is transferred in the procedure parameter is then inter-

preted as a variable name. In the called procedure, the variable from the calling procedure is then accessed. (For further details see section “Passing procedure parameters” )