Assigning Data Objects to Field Symbols
Before you can work with a field symbol, you must assign a data object to it. If you attach a structure to a field symbol, you assign a data object to it in the declaration. Untyped field symbols point to the
predefined data object SPACE once the program starts. SPACE has type C and length 1. Typed field symbols do not point to any field before a data object is assigned to them.During a program, you can assign data objects to field symbols at any time. You can also assign a series of different data objects to the same field symbol during a program.
To assign a data object to a field symbol, use the ASSIGN statement. The ASSIGN statement has several variants and parameters.
The Basic Form of the ASSIGN Statement Assigning Components of Structures to a Field Symbol Defining the Data Type of a Field SymbolSetting the Number of Decimal Places
Data Areas for Field SymbolsYou can assign a line of an internal table to a field symbol. For further information, refer to
Processing Internal Tables.The statement
UNASSIGN <FS>.
allows you to specify explicitly that a field symbol <FS> should not have a data object assigned to it. If you try to use an unassigned field symbol, a runtime error occurs. There is a special logical expression that you can use to check whether a data object is
assigned to a field symbol.