The schema is SYSIBM.
If start is positive, then the starting position is calculated from the beginning of the string. If start is greater than the length of string in 16-bit UTF-16 string units, then a zero length string is returned.
If start is negative, then the starting position is calculated from the end of the string by counting backwards. If the absolute value of startis greater than the length of string in 16-bit UTF-16 string units, then a zero length string is returned.
If start is 0, then a starting position of 1 is used.
If the value for length is greater than the number of 16-bit UTF-16 string units from the starting position to the end of the string, then the length of the resulting substring is the length of the first argument in 16-bit UTF-16 string units minus the starting position plus one.
If the value for length is less than or equal to zero, the result is a zero length string.
The default value for length is the number of CODEUNITS16 from the position specified by start to the last byte of string.
The length attribute of the result is the same as the length attribute of the first argument, unless the start or length arguments are specified as constants. When a constant is specified, the length attribute of the result is based on the first applicable row in the following table.
| String Argument | Start Argument1 | Length Argument | Length Attribute of Result2 |
|---|---|---|---|
| character type with length attribute A | any valid argument | constant value L<=0 | 0 |
| character type with length attribute A | constant value S and |(S)|>A | not specified or any valid argument | 0 |
| character type with length attribute A | not a constant | constant value L>0 | MIN(A, L×4) |
| character type with length attribute A | constant value S>0 | not specified or not a constant | A−S+1 |
| character type with length attribute A | constant value S<0 | not specified or not a constant | MIN(A, |(S)×4|) |
| character type with length attribute A | constant value S>0 | constant value L>0 | MIN(A−S+1, L×4) |
| character type with length attribute A | constant value S<0 | constant value L>0 | MIN(A,|(S)×4|, L×4) |
| graphic type with length attribute A | any valid argument | constant value L<=0 | 0 |
| graphic type with length attribute A | constant value S and |(S)|>A | not specified or any valid argument | 0 |
| graphic type with length attribute A | not a constant | constant value L>0 | MIN(A, L) |
| graphic type with length attribute A | constant value S>0 | not specified or not a constant | A−S+1 |
| graphic type with length attribute A | constant value S<0 | not specified or not a constant | |(S)| |
| graphic type with length attribute A | constant value S>0 | constant value L>0 | MIN(A−S+, L) |
| graphic type with length attribute A | constant value S<0 | constant value L>0 | MIN(|(S)|, L)| |
Notes 1 If a start argument value of 0 is specified, then use a value of 1 for S when referencing this table. 2 The length attribute
of the result for some of the character result types involves a constant
that is multiplied by a factor of 4. This multiplier covers the worst
case expansion derived from the following factors:
|
|||
SUBSTR2(:NAME, :SURNAME_POS)
returns the
value JürgenSUBSTR2(:NAME, :SURNAME_POS,2)
returns
the value JüSELECT * FROM PROJECT
WHERE SUBSTR2(PROJNAME,-3) = 'ING'