The CTRFLD function centers a character string within a field. The number of leading spaces is equal to or one less than the number of trailing spaces.
CTRFLD is useful for centering the contents of a field and its report column, or a heading that consists only of an embedded field. HEADING CENTER centers each field value including trailing spaces. To center the field value without the trailing spaces, first center the value within the field using CTRFLD.
CTRFLD(source_string, length, output)
Is the character string enclosed in single quotation marks, or a field or variable that contains the character string.
Is the number of characters in source_string and output. This argument must be greater than 0. A length less than 0 can cause unpredictable results.
CTRFLD centers LAST_NAME and stores the result in a column with the format A12:
CTRFLD(LAST_NAME, 12, 'A12')