Input prompts are often required to drive processing forward. The NSK agent provides an opportunity to react to these prompts automatically.
In each individual NSK job, you can specify predefined inputs for particular prompts. If job execution reaches a prompt, the agent searches for a predefined input. Processing continues automatically if it finds one. If prompt handling has not been defined, further processing depends on the specifications that are made in the Job object. If a virtual terminal has been specified in the Guardian/NSK tab, the prompt is redirected to it and manual intervention is required. If a terminal has not been determined, the agent assigns an EOF input to the prompt.
This function is only supported for NonStop agent environments and TACL.
Prompt inputs can be defined using the function UC4_AUTO_ANSWER. In a NSK job script, this function can be used once or several times. Definitions only apply for one particular job. The syntax is:
UC4_AUTO_ANSWER "Prompt description" "Input"
The first parameter describes the prompt. You can either use the full name or specify wildcards using the characters ? and *. The latter one serves to use the same input on several prompts without having to enter an extra script line.
Add the character \ if \, ? or * should be read as normal characters.
The second parameter represents the input that is automatically assigned to the prompt. Enter a string, a script variable or a TACL expression. You can also use <EOF!> in order to respond to the prompt with an EOF input (Ctrl Y).
Note that both parameters must not include inverted commas.
The agent uses the input definitions which already occurred in the script. The search is made in strict rotation; the first definition that complies with the prompt description is used.
Use the function UC4_AUTO_ANSWER_CLEAN to invalidate all input definitions that occurred in the script so far. The agent then searches all definitions starting with this script line. You can use this function to separate script sections in which different prompt handling should apply. UC4_AUTO_ANSWER_CLEAN does not have parameters.
The function UC4_AUTO_ANSWER_TRACELEVEL can be used if you require more detailed information about the search for prompt input definitions. Depending on the specified level, more detailed messages are written to the job report and the virtual terminal. Its syntax is:
UC4_AUTO_ANSWER_TRACELEVELLevel
Enter a number between 0 and 3 for the level.
0 - No output is made about prompt comparison (default value).
1 - A message is sent for each coinciding prompt comparison.
2 - A message is sent for each non-coinciding prompt comparison.
3 - Output of level 2 and 3 messages
Example 1
The PURGE statement requires the specification of Y or N. The following script example shows an automated form of input handling:
UC4_AUTO_ANSWER "PURGE * (y/[n])?" y
PURGE *
UC4_AUTO_ANSWER_CLEAN
The first line defines y as the response to the prompt for the PURGE statement. In doing so, the PURGE call in the next line is automatically filled with y. Due to UC4_AUTO_ANSWER_CLEAN, this input definition does not apply for the job's remaining script.
Example 2
Job report abstract of a script which uses the function UC4_AUTO_ANSWER_TRACELEVEL.
UC4_AUTO_ANSWER "*is no prompt*" "Answer 1"
UC4_AUTO_ANSWER "*is a prompt*" "Answer 2"
UC4_AUTO_ANSWER "*is what*" "Answer 3"
UC4_AUTO_ANSWER "*is nothing*" "Answer 4"
run $data01.uc4.prompt
This is a prompt>Answer 2
Answer to the prompt received: Answer 2
UC4_AUTO_ANSWER_TRACELEVEL 1
run $data01.uc4.prompt
*** Pattern checked: "*is a prompt*", matched, answer generated: "Answer 2"
This is a prompt>Answer 2
Answer to the prompt received: Answer 2
UC4_AUTO_ANSWER_TRACELEVEL 3
run $data01.uc4.prompt
*** Pattern checked: "*is no prompt*", no match
*** Pattern checked: "*is a prompt*", matched, answer generated: "Answer 2"
This is a prompt>Answer 2
Answer to the prompt received: Answer 2