COL2() |
![]() ![]() ![]() |
The COL2() function returns the character position immediately following the substring extracted by the last FIELD() function.
Format
COL2()
The COL2() function is used after a FIELD() function to find the character position of the character immediately following the extracted substring.
The value of the COL2() function is maintained on a per-program basis. If an external subroutine is called between the FIELD() and COL2() functions, the value returned relates to the last use of FIELD() in the current program. Any FIELD() functions executed by the subroutine will have no effect on the COL2() value.
COL2() returns zero if No FIELD() function has been executed by this program The field number of the last FIELD() function was beyond the end of the string
Example
S = "A*BB*CCC*DDDD*EEEEE" X = FIELD(S, "*", 3, 2) N = COL2()
This program fragment extracts the string "CCC*DDDD" to variable X. The COL2() function returns 14 and assigns this to N.
See also: |