ARGLEN: Measuring the Length of a Character String

Available Operating Systems: All

Available Languages: reporting, Maintain

How to:

Measure the Length of a Character String

Example:

Measuring the Length of a Character String

The ARGLEN function measures the length of a character string within a field, excluding trailing spaces. The field format in a Master File specifies the length of a field, including trailing spaces.

In Dialogue Manager, you can measure the length of a supplied character string using the .LENGTH suffix.


Top of page

Syntax: How to Measure the Length of a Character String

ARGLEN(inlength, infield, outfield)

where:

inlength

Integer

Is the length of the field containing the character string, or a field that contains the length.

infield

Alphanumeric

Is the name of the field containing the character string.

outfield

Integer

Is the field that contains the result, or the format of the output value enclosed in single quotation marks.

In Dialogue Manager, you must specify the format. In Maintain, you must specify the name of the field.


Top of page

Example: Measuring the Length of a Character String

ARGLEN determines the length of the character string in LAST_NAME and stores the result in NAME_LEN:

TABLE FILE EMPLOYEE
PRINT LAST_NAME AND COMPUTE
NAME_LEN/I3 = ARGLEN(15, LAST_NAME, NAME_LEN);
WHERE DEPARTMENT EQ 'MIS';
END

The output is:

LAST_NAME        NAME_LEN
‑‑‑‑‑‑‑‑‑ ‑‑‑‑‑‑‑‑
SMITH 5
JONES 5
MCCOY 5
BLACKWOOD 9
GREENSPAN 9
CROSS 5