Reputation: 2984
I've got an array
DO WHILE (NOTEND = '1'B);
IF (LENGTH(VALUELIST) > 8) THEN DO;
VALUELIST = SUBSTR(VALUELIST,8);
END;
ELSE DO;
NOTEND='0'B;
END;
END;
Now my problem is: Length(valuelist) always returns the original definition of the characterfield: CHAR(500) thus 500. I didn't find any other command there though.
Thus my question is: How can I get the remaining length of that string (aka of its content not the char array itself)?
Upvotes: 2
Views: 88
Reputation: 1424
The solution provided by Lasse V. Karlsen is one method. A different, possibly more straight-forward solution would be to use CHAR VARYING
(a.k.a. VARCHAR
), which maintains the length of the string. After the assignment, LENGTH(VALUELIST)
will be correct (8 less than the previous length).
Upvotes: 1