z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


PROMPT

z/OS TSO/E REXX Reference
SA32-0972-00

Read syntax diagramSkip visual syntax diagram
>>-PROMPT(-+--------+-)----------------------------------------><
           '-option-'     

PROMPT returns the value ON or OFF, which indicates the setting of prompting for the exec.

You can use the following options to set prompting on or off for interactive TSO/E commands, provided your profile allows for prompting. Only when your profile specifies PROMPT, can prompting be made available to TSO/E commands issued in an exec.
ON
returns the previous setting of prompt (ON or OFF) and sets prompting on for TSO/E commands issued within an exec.
OFF
returns the previous setting of prompt (ON or OFF) and sets prompting off for TSO/E commands issued within an exec.
Here are some examples:
promset = PROMPT()    -> 'OFF'  /* returns current setting (OFF)  */

setprom = PROMPT("ON")-> 'OFF'  /* returns previous setting (OFF)
                                   and sets prompting on          */

You can use the PROMPT function only in REXX execs that run in the TSO/E address space.

Environment Customization Considerations: If you use IRXINIT to initialize language processor environments, note that you can use PROMPT only in environments that are integrated into TSO/E (see "Interaction of Three Ways to Affect Prompting").

You can set prompting for an exec using the PROMPT keyword of the TSO/E EXEC command or the PROMPT function. The PROMPT function overrides the PROMPT keyword of the EXEC command. For more information about situations when one option overrides the other, see Interaction of Three Ways to Affect Prompting.

When an exec sets prompting on, prompting continues in other functions and subroutines called by the exec. Prompting ends when the PROMPT(OFF) function is used or when the original exec ends. When an exec invokes another exec or CLIST with the EXEC command, prompting in the new exec or CLIST depends on the setting in the profile and the use of the PROMPT keyword on the EXEC command.

If the data stack is not empty, commands that prompt retrieve information from the data stack before prompting a user at the terminal. To prevent a prompt from retrieving information from the data stack, issue a NEWSTACK command to create a new data stack for the exec.

When your TSO/E profile specifies NOPROMPT, no prompting is allowed in your terminal session even though the PROMPT function returns ON.

Interaction of Three Ways to Affect Prompting

You can control prompting within an exec in three ways:

  1. TSO/E profile

    The TSO/E PROFILE command controls whether prompting is allowed for TSO/E commands in your terminal session. The PROMPT operand of the PROFILE command sets prompting on and the NOPROMPT operand sets prompting off.

  2. TSO/E EXEC command

    When you invoke an exec with the EXEC command, you can specify the PROMPT operand to set prompting on for the TSO/E commands issued within the exec. The default is NOPROMPT.

  3. PROMPT external function

    You can use the PROMPT function to set prompting on or off within an exec.

Table 1 shows how the three ways to affect prompting interact and the final outcome of various interactions.

Table 1. Different ways prompting is affected
Interaction Prompting No prompting

PROFILE PROMPT
EXEC PROMPT
PROMPT(ON)

X  

PROFILE PROMPT
EXEC NOPROMPT
PROMPT(ON)

X  

PROFILE PROMPT
EXEC NOPROMPT
PROMPT()

  X

PROFILE PROMPT
EXEC NOPROMPT
PROMPT(OFF)

  X

PROFILE PROMPT
EXEC PROMPT
PROMPT()

X  

PROFILE PROMPT
EXEC PROMPT
PROMPT(OFF)

  X

PROFILE NOPROMPT
EXEC PROMPT
PROMPT(ON)

  X

PROFILE NOPROMPT
EXEC NOPROMPT
PROMPT(ON)

  X

PROFILE NOPROMPT
EXEC PROMPT
PROMPT(OFF)

  X

PROFILE NOPROMPT
EXEC NOPROMPT
PROMPT(OFF)

  X

PROFILE NOPROMPT
EXEC PROMPT
PROMPT()

  X

PROFILE NOPROMPT
EXEC NOPROMPT
PROMPT()

  X

Examples:

The following are some examples of using PROMPT.

  1. To check if prompting is available before issuing the interactive TRANSMIT command, use the PROMPT function as follows:
    "PROFILE PROMPT"
    IF PROMPT() = 'ON' THEN
      "TRANSMIT"
    ELSE
      DO
        x = PROMPT('ON')  /* Save prompt setting and turn prompting ON */
        "TRANSMIT"        /* Restore prompting setting */
        y = PROMPT(x)
      END
  2. Suppose you want to use the LISTDS command in an exec and want to ensure that prompting is done to the terminal. First check whether the data stack is empty. If the data stack is not empty, use the NEWSTACK command to create a new data stack. Use the PROMPT function before issuing the LISTDS command.
    IF QUEUED() > 0 THEN
      "NEWSTACK"
    ELSE NOP
    x = PROMPT('ON')
    "LISTDS"
    y = PROMPT(x)

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014