The $EXTRACT function returns a substring of a given string.
The format for the $EXTRACT function is:
$E[XTRACT](expr[,intexpr1[,intexpr2]])
The expression specifies a string from which $EXTRACT() derives a substring.
The first optional integer expression (second argument) specifies the starting character position in the string expr of the substring result. If the starting position is beyond the end of the expression, $EXTRACT() returns the null string. If the starting position is zero (0) or negative, $EXTRACT() starts at the first position in the expression; if this argument is omitted, $EXTRACT() returns the first character of the expression. $EXTRACT() numbers character positions starting at one (1) (i.e., the first character of a string is at position one (1)).
The second optional integer expression (third argument) specifies the ending character position for the result. If the ending position is beyond the end of the expression, $EXTRACT() stops with the last character of the expression. If the ending position precedes the starting position, $EXTRACT() returns the null string. If this argument is omitted, $EXTRACT() returns one character at most.
$EXTRACT() provides a tool for manipulating strings based on character positions.
A SET command argument can have something that has the format of a $EXTRACT() on the left-hand side of its equal sign (=). This construct permits easy maintenance of individual pieces within a string. It can also be used to right justify a value padded with blank characters. For more information on SET $EXTRACT(), refer to SET in the "Commands" chapter.