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


Coding responses to prompts - the DATA PROMPT-ENDDATA sequence

z/OS TSO/E CLISTs
SA32-0978-00

If you execute a CLIST in the background, a user cannot respond to prompts from the CLIST. To avoid this problem, use the DATA PROMPT-ENDDATA sequence. The DATA PROMPT-ENDDATA sequence lets you designate responses to prompts by TSO/E commands or subcommands.

To use the DATA PROMPT-ENDDATA sequence, code:
DATA PROMPT
⋮
           /* Responses */
ENDDATA

If the sequence is not immediately preceded by a TSO/E command or subcommand that prompts, an error occurs (error code 968 appears in control variable &LASTCC). You can ignore the error condition if a command or subcommand that might prompt, does not prompt.

The responses in the DATA PROMPT-ENDDATA sequence must appear exactly as if a user entered the response. Each DATA PROMPT-ENDDATA sequence can respond only to prompts issued by the immediately preceding command or subcommand. However, you can include multiple responses to satisfy multiple prompts. Excess responses can result in an error message and termination of the CLIST if an error routine is not present.

To stop TSO/E commands from prompting after a DATA PROMPT-ENDDATA sequence, code a null line after ENDDATA. To code a null line, first set a variable equal to null:
SET &abc =
Then place that variable on the line after ENDDATA:
ENDDATA
&abc
Some TSO/E commands prompt for input when you code certain operands. For example, the LINK command invokes the linkage editor. When you substitute an asterisk (*) for the data set name, TSO/E prompts for control statements. If you include such a LINK command in a CLIST that might run in the background, place the control statements within a DATA PROMPT-ENDDATA sequence. The following CLIST, when run in the background, link-edits the member X, which resides in the file DD1:
CONTROL PROMPT LIST
IF &SYSENV=FORE THEN /* CLIST is running in the foreground */  + 
    link (*)         /* Prompt user for control statements */ + 
    load('d32kds1.load') pr(*) ncal xref list let
ELSE                 /* CLIST is being run in the background */ + 
  DO
    SET NULL =   /* set null line to stop prompting after ENDDATA
    link (*) + 
    load('d32kds1.load') pr(*) ncal xref list let
    DATA PROMPT     /* Designate responses to prompts        */
    include dd1(x)
    entry x
    name x
    ENDDATA
    &NULL           /* null line stops prompting */
  END
There are additional considerations for using the DATA PROMPT-ENDDATA sequence:
  • The CLIST must allow prompting.
  • The CLIST performs symbolic substitution before using the responses to satisfy the prompt. (You can include variables in the responses.)

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014