How to: |
Available Languages: reporting
LENV returns the actual length of an AnV field or the size of an An field.
LENV(source_string, output)
where:
Alphanumeric of type An or AnV
Is the source string or field. If it is an An format field, the function returns its size, n. For a character string enclosed in quotation marks or a variable, the size of the string or variable is returned. For a field of AnV format, its length, taken from the length-in-bytes of the field, is returned.
Integer
Is the field to which the result is returned, or the format of the output value enclosed in single quotation marks (').
TRIMV creates an AnV field named TITLEV by removing trailing blanks from the TITLE value. Then LENV returns the actual length of each instance of TITLEV to the ALEN field:
TABLE FILE MOVIES PRINT COMPUTE TITLEV/A39V = TRIMV('T', TITLE, 39, ' ', 1, TITLEV); ALEN/I2 = LENV(TITLEV,ALEN); BY CATEGORY NOPRINT WHERE CATEGORY EQ 'CHILDREN' END
The output is:
TITLEV ALEN ------ ---- SMURFS, THE 11 SHAGGY DOG, THE 15 SCOOBY-DOO-A DOG IN THE RUFF 28 ALICE IN WONDERLAND 19 SESAME STREET-BEDTIME STORIES AND SONGS 39 ROMPER ROOM-ASK MISS MOLLY 26 SLEEPING BEAUTY 15 BAMBI 5