Domain: String processing
The EXTEND-SDF-LIST( ) function appends a new element to an SDF list. This new element may itself be an SDF list.
Format
EXTEND-SDF-LIST( ) |
LIST = string_expression ,ELEMENT = string_expression ,POSITION = *LAST / *FIRST / arithm_expression |
Result type
STRING
Input parameters
LIST = string_expression
Designates an SDF list. An empty list must be specified as ‘()‘. The validity of the input is checked internally by IS-SDF-LIST.
ELEMENT = string_expression
Designates the element to be appended.
POSITION =
Specifies where the element is to be appended.
POSITION = *LAST
The element is appended at the end of the list.
POSITION = *FIRST
The element is appended before the list.
POSITION = arithm_expression
The element is inserted at the specified position.
If the specified position is outside the permissible range, *LAST is assumed.
Result
Expression as an extended string
Error messages
SDP0447 THE GIVEN STRING IS NO SDF-LIST SDP0481 VALUE OF OPERAND 'POSITION' MUST BE GREATER THAN ZERO
Example
A=EXTEND-SDF-LIST(LIST='(val1,val2)',ELEMENT='val3',POSITION=*last) /SHOW-VARIABLE A A = (val1,val2,val3) /A=EXTEND-SDF-LIST(LIST=A,ELEMENT='val0',POSITION=*first) /SHOW-VARIABLE A A = (val0,val1,val2,val3) /A=EXTEND-SDF-LIST(LIST=A,ELEMENT='(val4,val5)',POSITION=*last) /SHOW-VARIABLE A A = (val0,val1,val2,val3,(val4,val5))