GO (Go to Menu)

GO Command syntax diagram

 

Purpose

The Go to Menu (GO) command allows the user to specify either a particular menu or a generic menu name. The user may optionally specify whether or not to return to the menu or display from which the command is entered after running the menu specified by the GO command.

Use the Previous and Exit Keys

A menu is placed on an internal menu stack before it is run. If a stack is not available for the menu, one is created. When the Cancel key is pressed for a menu, the previous menu in the stack is shown. Each menu stack is ten elements (menus) deep. When the eleventh menu is placed on the menu stack, the first, or oldest, menu is removed from the stack. This menu cannot be returned to by using the Cancel key.

Pressing the Exit key returns the user to the last display or menu from which a GO command was entered with RTNPNT(*YES). (Note that *YES is the default value for the optional RTNPNT parameter.) The display that the user is returned to is found by removing menus from the menu stack until a return point is found. This process may also cause a program in the call stack to return to its calling program unless the program is a return point.

Pressing either the Exit or Cancel key while viewing help for a menu returns the user to the menu.

 

Restrictions

  1. The user must have *USE authority for the menu and its display and message files or program (whichever applies) to use this command.
  2. The user must also have *USE authority for the library where the menu is located.

 

Required Parameters

MENU
Specifies the qualified name of the menu being run.

The name of the menu can be qualified by one of the following library values:

*LIBL: All libraries in the job's library list are searched until the first match is found.

*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.

*USRLIBL: Only the libraries in the user portion of the job's library list are searched.

*ALL: All libraries in the system, including QSYS, are searched.

*ALLUSR Libraries

library-name: Specify the name of the library to be searched.

*ALL: A list of all menus in the given library are presented to allow the selection of the menu to be run.

menu-name: Specify the name of the menu being run.

generic*-menu-name: Specify the generic name of the menu. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk substitutes for any valid characters. A generic name specifies all objects with names that begin with the generic prefix for which the user has authority. If an asterisk is not included with the generic (prefix) name, the system assumes it to be the complete object name. If the complete object name is specified, and multiple libraries are searched, multiple objects can be specified only if *ALL or *ALLUSR library values can be specified for the name. For more information on the use of generic names, refer to generic names.

 

Optional Parameters

RTNPNT
Specifies whether the display where the command is entered is returned to when the Exit key is pressed.

*YES: The display where the command is entered is shown when the Exit key is pressed.

*NO: The display where the command is entered is not shown when the Exit key is pressed.

Example for GO

GO   MENU(PERSMENU)

This command runs a menu called PERSMENU, located in a library found by searching the library list (*LIBL default value).

If the Exit key is pressed while PERSMENU is being shown, the display where the GO command was entered (*YES default value on the RTNPNT parameter) is shown.

Error messages for GO

*ESCAPE Messages

CPF6ACD
Menu &1 in &2 is wrong version for system.
CPF6AC7
Menu &1 in library &2 not displayed.