COL1/COL2 Functions
Returns the numeric values of the column positions immediately preceding and following the substring specified by the FIELD function.
Syntax
COL1()
COL2()
Operation
COL1() returns the numeric value of the column position immediately preceding the substring selected by the most recently executed FIELD function.
COL2() returns the numeric value of the column position immediately following the substring selected by the most recently executed FIELD function.
If a FIELD function has not been executed in a program before executing a COL1() or COL2() function, a warning message is displayed and COL1() or COL2() returns zero.
If the most recent FIELD function delimiter is null, then COL2() = COL1() + 1. If the specified delimiter cannot be found in the string, COL2() returns zero.
Examples
Q = FIELD("ABCBA","B",2) R = COL1() S = COL2()
Assigns the string value C to variable Q, the numeric value 2 to variable R and the numeric value 4 to variable S.
X = "K" A = FIELD("123K456K789",X,2) B = COL1() PRINT B C = COL2() PRINT C
Assigns the string value of 456 to variable A. Assigns the numeric values of 4 to variable B and 8 to variable C. Prints B and C.