First of all: WAKEUP gives RC=6 when someone at the 3270 console  where this
exec runs presses enter.
The usual reaction of REXX execs using WAKEUP is then to exit, stop the REXX
program.  Some REXX execs will first ask the user a confirmation if they
want to exit, or if if was a mistake

Secondly: when a message arrives via IUCV, WAKEUP will give return code 5

 So the DO forever loop looks like:
 Do forever
  'WAKEUP (IUCVMSG QUIET'
  Select
   when rc=6 then leave
   When rc=5 then do /* a MS arrived via IUCV */
     parse pull theMsg ....
       ...
     end
     Otherwise
       Say 'Unexpcetd RC' rc 'from WAKEUP'
       leave
  end
end /* Do Forever */
'WAKEUP RESET'
exit

Then; there is the difference between the program stack and the terminal
input buffer.
 - program stack is where e.g. WAKEUP or QUERY xxx (STACK store their data
 - terminal input buffer is where CMS stores what you enter at the console
PARSE PULL reads from the program stack, and if that is empty from the
terminal input buffer, and if that is empty too, a VM READ is posted.
PARSE EXTERNAL reads the terminal input buffer, and if that is empty, a VM
READ is posted.
Rexx function QUEUED() returns the number of lines in the program stack;
EXTERNALS() the number of lines in the terminal input buffer.

So; if you want to get the answer from an operator, it is better to use
PARSE <UPPER> EXTERNAL than PARSE <UPPER> PULL.

This is surely explained in more detail in our TCVM1 Telecourse
  http://www.vm.ibm.com/download/packages/descript.cgi?TCVM1


2008/10/11 Martin, Terry R. (CMS/CTR) (CTR) <[EMAIL PROTECTED]>:
> Hi
>
>
>
> I have been trying to figure out my problem but I cannot seem to find it
so
> I thought maybe someone more experience at this could help.
>
>
>
> Here is my current issue (I am sure there will be more to come but for
now!)
> when I do a SAY and try to PULL the ANSWER I keep getting what appears to
be
> left over messages not the expected data. The piece of code in RED is
where
> I am having the problem. Keep in mind that I am just testing certain
things
> out to get familiar with this so the code is my no means what I hope to
end
> up with.
>
>
>
> When I PULL the REPLY it is a message and therefore my check for the
answer
> never works. It is like something is left on the STACK. I am thinking it
has
> something to do with the 'WAKEUP +0 (IUCVMSG QUIET' .  I say this because
> when I put the code in RED above this the REPLY area is what I expect not
a
> message.
>
>
>
> Do I need to clear something? Thanks for the help in advance.
>
>
>
>
>
> /*  LINUX SHUTDOWN EXEC */
>
>  /*
>
>  TRACE i
>
>  SAY 'TO STOP LINUX GUESTS ENTER'
>
>  SAY 'ALL'
>
>  SAY 'OR'
>
>  SAY 'LINUX GUEST ID'
>
>  PULL GUEST
>
>
>
>  IF GUEST /= 'ALL' THEN
>
>    DO
>
>     SAY 'SHUTING DOWN' GUEST 'GUEST CHOOSE:
>
>     SAY 'REIPL'
>
>     SAY ' OR'
>
>     SAY 'SHUTDOWN'
>
>
>
>     PULL FUNCTION
>
>
>
>     'WAKEUP +0 (IUCVMSG QUIET'
>
>
>
>   /*'CP SIG SHUTDOWN' GUEST 'WITHIN 180'    WAIT 3 MINUTE THEN FORCE */
>
>
>
>     end
>
>   /*  IF RC=45 THEN*/
>
>   /*EXIT */
>
>   SAY '... WAITING FOR SHUTDOWN COMPLETION'
>
>
>
> DO FOREVER;               /* WILL GET MESSAGES UNTIL GUEST DOWN */
>
> 'WAKEUP (IUCVMSG QUIET'            /*   MESSAGE HAS ARRIVED */
>
>
>
> IF RC = 6 THEN
>
>   DO
>
>   IF FUNCTION = 'SHUTDOWN' THEN
>
>    DO
>
>     SAY GUEST 'VM USER LOGGING OFF'
>
>     'CP SEND CP' GUEST 'LOGOFF'
>
>   END
>
>         DO
>
>        'PIPE CP Q NAMES | LOCATE /'GUEST'/ | SPLIT | LOCATE /'GUEST'/',
>
>           '| > LINUX USERS A'
>
>
>
>
>
>             USERID = 'LINUX USERS A'
>
>        PARSE VALUE STREAM(USERID,'C','OPEN READ') WITH OK FILE_HANDL
>
>    end
>
>
>
>       IF OK /= 'READY:' THEN
>
>   DO
>
>     SAY 'LINUX USER HAS BEEN LOGGED OFF'
>
>     end
>
>    DO
>
>      SAY 'DO YOU WANT TO LOG' GUEST 'BACK ON'
>
>      SAY 'YES'
>
>      SAY ' OR'
>
>      SAY 'NO'
>
>        PULL REPLY
>
>       IF REPLY /= 'YES' THEN
>
>        EXIT
>
>        END
>
>     DO
>
>      'PIPE CP XAUTOLOG' GUEST
>
>
>
>       'PIPE CP XAUTOLOG' GUEST
>
>       SAY GUEST 'HAS BEEN LOGGED ON'
>
>
>
>      IF FUNCTION = 'REIPL' THEN
>
>       DO
>
>        SAY GUEST 'VM USER REIPL STARTED'
>
>        'CP SEND CP' GUEST 'IPL 700 CLEAR'
>
>        END
>
>      'CP I CMS'
>
>       EXIT
>
>     END
>
>     END
>
>  END  /* END OF DO FOREVER LOOP */
>
>
>
>  /* =================== END OF INDIVIDUAL GUEST SHUTDOWN ============ */
>
>
>
>      EXIT          /* RETURN TO CMS */
>

>
>
>



-- 
Kris Buelens,
IBM Belgium, VM customer support

Reply via email to