I have to find the length of the data which is stored in a working storage variable. Suppose in the working storage varaible ws-example I have the value "Welcome" . The ws-example is declared as PICx(20). I want to find the length of the data stored.

I want the length as 7 ("WELCOME") and not 20.

I have used the FUNCTION LENGTH(ws-example) but it is giving the length as 20 but not 7.