| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== WHAT (return field from group) ====== | [[watch automatic concurrency check .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[where return field position in group .htm|{{btn_next_n.gif|Next page}}]] | | || **WHAT(**// group, number //[//,dimension//]// //**)** {{blk2blue.jpg|blk2blue.jpg}} | **WHAT** | Returns a specified field from a //group// structure. | | //group// | The label of a GROUP, RECORD, CLASS, or QUEUE declaration. | | //number// | An integer expression specifying the ordinal position of a field in the //group//. | | //dimension// | An optional dimension element number, if applicable. | The **WHAT** statement returns the //number// specified field from a //group// structure. Generally, this would be assigned to an ANY variable. If the number specified field is a dimensioned field, then WHAT returns a reference to the //dimension// element of the //number// field. If the field with an ordinal position equal to the passed second parameter is defined as an ANY type or has the DIM attribute, the returned value can only be used in "reference equality" ( &= ) operations. Any attempt to access the field will cause a run-time error. **Return Data Type:     **ANY **Example:** MyGroup GROUP F1 LONG(3) !Field number 1 F2 SHORT !Field number 2 F3 STRING(30) !Field number 3 InGroup GROUP !Field number 4 F1 LONG !Field number 5 F2 SHORT(2) !Field number 6 F3 STRING(30),DIM(2) !Field number 7 F4 LONG,DIM(3,3) !Field number 8 F5 ANY END END CurrentField ANY CODE CurrentField &= WHAT(MyGroup,1) !Returns contents of MyGroup.F1 (3) CurrentField &= WHAT(MyGroup,6) !Returns contents of MyGroup.Ingroup.F2 (2) CurrentField &= WHAT(MyGroup,7) !Returns contents of MyGroup.Ingroup.F3[1] IF CurrentField &= RefVar !LEGAL CurrentField = 2 !INVALID – posts a runtime error END CurrentField &= WHAT(MyGroup,8,3) !Returns contents of MyGroup.Ingroup.F4[1,3] CurrentField &= WHAT(MyGroup,8,5) !Returns contents of MyGroup.Ingroup.F4[2,2] !For String Comparison, the returned field must be moved into a work field: CurrentField &= WHAT(MyGroup,8,7) !Returns contents of MyGroup.Ingroup.F4[3,1] IF CurrentField = 'xyz' !do something END **See Also:** [[any any simple data type .htm|ANY]] [[where return field position in group .htm|WHERE]] [[who return field name from group .htm|WHO]] [[getgroup return reference to group .htm|GETGROUP]] [[group compound data structure .htm|GROUP]] [[howmany return dimensions .htm|HOWMANY]] [[isstring return field string type or not .htm|ISSTRING]] [[isgroup return group type or not .htm|ISGROUP]] [[record declare record structure .htm|RECORD]] [[class object declaration .htm|CLASS]] [[queue declare a memory queue structure .htm|QUEUE]]