> I am writing a job in which I need to have user input
> during the job in several places. I can do this within a command file,
> but the same logic fails when written into a job.
I apologize if this has already been answered. Scripts and UDCs when
invoked from a session (and without $STDIN and/or $STDLIST redirected)
are interactive. Thus, the :input command and the input() CI function
will be able to write a prompt to $STDLIST and read a response from
$STDIN.
Jobs are not interactive with the user that streamed the job. There is
a CI variable that shows if a job/session is interactive named
HPINTERACTIVE. There are 3rd party products that allow you to pass
interactive input to jobs in clever ways, but the CI does not support
this.
> Is there a way to do this, or should I just get the info in advance
> and pass the parms into the job? I've tried a variety of other ways,
> but know I "just don't get it" yet - I am too new to this.
There is a CI enhancement to the INPUT command that allows you
to read input from the system console, but not from an arbitrary
session or LDEV. I tried a few tricks, which did not work, but
which still might be useful to some folks.
In the job being streamed:
!job jfoo,...
!setvar s word(hpstreamedby,'()',-2)
! # S holds the job/session number of the user that streamed me
!setvar ldev jinfo(s,'ldevin')
! # ldev holds the LDEV of 'S'
!file term;dev=!ldev;acc=inout
! # term points to the stdin/stdlist device of 'S'
!input foo,'Prompt:' <*term >*term
! # this does NOT work -- the job hangs here but can be aborted
!...
...
> Job logic that does not work:
>
> 7 ! input _a;prompt="Is this an EIFA site (Y/N):"
> job does not stop
> for input, just blows on by and complains that the "else"
> has no "if"
> 8 ! if (ups("!_a")) = "Y"
...
Yes, as has been mentioned, INPUT reads from $STDIN, and for a job
$STDIN is the input spoolfile. Thus, the input command above reads
from the STDIN spoolfile and reads the line: ! if (ups("!_a"....
This line is not available for the CI to read and you get the missing
IF error.
Hope this help some, but I know it does not solve your original question,
Jeff Vance, CSY
|