Prompting

The prompt function helps you provide the necessary information for the syntax of the statement that you want to use. The prompt function can be used in any of these statement processing modes: *RUN, *VLD, and *SYN. Prompting is not available for all SQL statements and is not complete for many SQL statements. When prompting a statement using a period (.) for qualifying names in *SYS naming mode, the period will be changed to a slash (/). The GRANT and REVOKE statements do not support prompting when using the period in *SYS naming.

You have two options when using the prompter:

  • Type the verb of the statement before pressing F4=Prompt.

    The statement is parsed and the clauses that are completed are filled in on the prompt displays.

    If you type SELECT and press F4=Prompt, the following display appears:

                               Specify SELECT Statement
     
    Type SELECT statement information.  Press F4 for a list.
     
      FROM tables . . . . . . . .  _____________________________________________
      SELECT columns  . . . . . .  _____________________________________________
      WHERE conditions  . . . . .  _____________________________________________
      GROUP BY columns  . . . . .  _____________________________________________
      HAVING conditions . . . . .  _____________________________________________
      ORDER BY columns  . . . . .  _____________________________________________
      FOR UPDATE OF columns . . .  _____________________________________________
     
                                                                           Bottom
    Type choices, press Enter.
     
      DISTINCT rows in result table  . . . . . . . . .  N   Y=Yes, N=No
      UNION with another SELECT  . . . . . . . . . . .  N   Y=Yes, N=No
      Specify additional options . . . . . . . . . . .  N   Y=Yes, N=No
     
     
     
    F3=Exit         F4=Prompt   F5=Refresh   F6=Insert line   F9=Specify subquery
    F10=Copy line   F12=Cancel  F14=Delete line  F15=Split line  F24=More keys
     
  • Press F4=Prompt before typing anything on the Enter SQL Statements display. You are shown a list of statements. The list of statements varies and depends on the current interactive SQL statement processing mode. For syntax check mode with a language other than *NONE, the list includes all SQL statements. For run and validate modes, only statements that can be run in interactive SQL are shown. You can select the number of the statement you want to use. The system prompts you for the statement you selected.

    If you press F4=Prompt without typing anything, the following display appears:

                                 Select SQL Statement
     
    Select one of the following:
     
         1. ALTER TABLE
         2. CALL
         3. COMMENT ON
         4. COMMIT
         5. CONNECT
         6. CREATE ALIAS
         7. CREATE COLLECTION
         8. CREATE INDEX
         9. CREATE PROCEDURE
        10. CREATE TABLE
        11. CREATE VIEW
        12. DELETE
        13. DISCONNECT
        14. DROP ALIAS
                                                                         More...
    Selection
         __
     
    F3=Exit   F12=Cancel
     

If you press F21=Display Statement on a prompt display, the prompter displays the formatted SQL statement as it was filled in to that point.

When Enter is pressed within prompting, the statement that was built through the prompt screens is inserted into the session. If the statement processing mode is *RUN, the statement is run. The prompter remains in control if an error is encountered.