COL2()

COL2()

Top  Previous  Next

 

The COL2() function returns the character position immediately following the substring extracted by the last FIELD() or LAST() function.

 

 

Format

 

COL2()

 

 

The COL2() function is used after a FIELD() or LAST() 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 extracting the data and use of the COL2() function, the positional data is not lost by any use of the FIELD() or LAST() function in the subroutine.

 

COL2() returns zero if

No FIELD() or LAST() 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:

COL1(), FIELD(), LAST()