COL1()

Top  Previous  Next

 

The COL1() function returns the character position immediately preceding the substring extracted by the last FIELD() function.

 

 

Format

 

COL1()

 

 

The COL1() function is used after a FIELD() function to find the character position of the character immediately preceding the extracted substring.

 

The value of the COL1() function is maintained on a per-program basis. If an external subroutine is called between the FIELD() and COL1() 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 COL1() value.

 

COL1() returns zero if

No FIELD() function has been executed by this program

The last field extracted was at the start of the string

The delimiter to the last FIELD() function was a null string

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 = COL1()

 

This program fragment extracts the string "CCC*DDDD" to variable X. The COL1() function returns 5 and assigns this to N.

 

 

See also:

COL2(), FIELD()