Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Assigning an initial value

&pagelevel(5)&pagelevel

The INITIAL-VALUE operand of the DECLARE-PARAMETER command specifies whether an initial value is to be assigned to the procedure parameter. The possible operand values for INITIAL-VALUE are *NONE, *PROMPT and the direct specification of an initial value.

  • *NONE is the default setting. It means that no initial value is assigned to the parameter. However, a value must be assigned to the parameter when the procedure is called.

  • If the setting is *PROMPT, a value will be requested when the procedure is executed, unless one is passed with the procedure call. However, it can also be specifically requested via READ-VARIABLE.

Example

/SET-PROCEDURE-OPTIONS
/DECLARE-VARIABLE NAME(INITIAL-VALUE=*PROMPT)
/...
/IF (NOT IS-INITIALIZED('NAME'))
/ WRITE-TEXT 'PLEASE ENTER YOUR NAME HERE!'
/ READ-VARIABLE NAME,INPUT=*TERMINAL
/END-IF

The third possibility is to use INITIAL-VALUE to directly specify an initial value. The data type of the value specified must match that of the procedure parameter. The initial value will apply unless another value is passed with the call.