This example demonstrates the use of the &EXPAND GPA to obtain the name of the expanded view, display the name to the user, and expand another view.
STRING/EXPVW(30), CHKVW(30)EXPVW = 'TOP@1CHKVW = &EXPAND$$IFTHEN/CHKVW == 'OFF'MESSG/'No view is currently expanded.'ELSEMESSG/'The following view is currently expanded: '+CHKVWENDIFIFTHEN/EXPVW == CHKVWMESSG/'The currently expanded view will be unexpanded.'&EXPAND = 'OFF'ELSEMESSG/'The following view will be unexpanded: ' + EXPVW&EXPAND ='OFF'&EXPAND = EXPVWENDIFHALT