Skip to main content

[archive] Lengh of string

  • February 8, 2008
  • 5 replies
  • 0 views

[Migrated content. Thread originally posted on 07 February 2008]

Hello,
Is there an easy way to determine the number of characters entered in an entry field? For example, if the entry field is defined as x(30), but only 6 characters are entered, is there an easy way of determining this? (Without redefines and checking each byte).

Thanks.:confused:

5 replies

[Migrated content. Thread originally posted on 07 February 2008]

Hello,
Is there an easy way to determine the number of characters entered in an entry field? For example, if the entry field is defined as x(30), but only 6 characters are entered, is there an easy way of determining this? (Without redefines and checking each byte).

Thanks.:confused:
You could use INSPECT TALLYING FOR TRAILING SPACES.

[Migrated content. Thread originally posted on 07 February 2008]

Hello,
Is there an easy way to determine the number of characters entered in an entry field? For example, if the entry field is defined as x(30), but only 6 characters are entered, is there an easy way of determining this? (Without redefines and checking each byte).

Thanks.:confused:
You could use INSPECT TALLYING FOR TRAILING SPACES.

[Migrated content. Thread originally posted on 07 February 2008]

Hello,
Is there an easy way to determine the number of characters entered in an entry field? For example, if the entry field is defined as x(30), but only 6 characters are entered, is there an easy way of determining this? (Without redefines and checking each byte).

Thanks.:confused:
01 x-tally pic 9(4).
01 x-data pic x(30).
01 w-len pic 99.


move 0 to x-tally
inspect x-data tallying x-tally for trailing spaces
compute w-len = length of x-data - x-tally.



W-LEN has the number of chars in the field.

[Migrated content. Thread originally posted on 07 February 2008]

Hello,
Is there an easy way to determine the number of characters entered in an entry field? For example, if the entry field is defined as x(30), but only 6 characters are entered, is there an easy way of determining this? (Without redefines and checking each byte).

Thanks.:confused:
01 x-tally pic 9(4).
01 x-data pic x(30).
01 w-len pic 99.


move 0 to x-tally
inspect x-data tallying x-tally for trailing spaces
compute w-len = length of x-data - x-tally.



W-LEN has the number of chars in the field.

[Migrated content. Thread originally posted on 07 February 2008]

Hello,
Is there an easy way to determine the number of characters entered in an entry field? For example, if the entry field is defined as x(30), but only 6 characters are entered, is there an easy way of determining this? (Without redefines and checking each byte).

Thanks.:confused:
You can also INQUIRE on the ENTRY-FIELD to get the value of CURSOR, but that assumes that the cursor is at the end of the text in the control.