Using Text Fields in DEFINE and COMPUTE

Text fields can be assigned to alphanumeric fields and receive assignment from alphanumeric fields. If an alphanumeric field is assigned the value of a text field that is too long for the alphanumeric field, the value is truncated before being assigned to the alphanumeric field.

Note: COMPUTE commands in Maintain do not support text fields.


Top of page

Example: Assigning the Result of an Alphanumeric Expression to a Text Field

This example uses the COURSES data source, which contains a text field, to create an alphanumeric field named ADESC, which truncates the text field at 36 characters, and a new text field named NEWDESC, which is a text version of ADESC:

DEFINE FILE COURSES
ADESC/A36   = DESCRIPTION;
NEWDESC/TX36 = ADESC;
END
 
TABLE FILE COURSES
PRINT ADESC NEWDESC
END

The output is:

ADESC                                 NEWDESC
-----                                 -------
This course provides the DP professi  This course provides the DP professi
Anyone responsible for designing FOC  Anyone responsible for designing FOC
This is a course in FOCUS efficienci  This is a course in FOCUS efficienci

WebFOCUS