Long ago (as will be obvious from the comments herein) I realized that CMS 
app developers struggled even more than I did with WAKEUP.  So I wrote a 
short 'starter' exec to get them going when they needed to use WAKEUP.  It 
is pasted below, with a couple recent updates included based on this 
thread.

Mike Walter 
Hewitt Associates 
Any opinions expressed herein are mine alone and do not necessarily 
represent the opinions or policies of Hewitt Associates.



/* Prolog  See Epilog for additional information ********************
 * Exec Name     - WAKEUP   EXECSAMP                                *
 * Unit Support  - OSS/VM                                           *
 * Status        - Version 1, Release 1.0                           *
 ********************************************************************/

/* Notice: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  *
 *         It is STRONGLY RECOMMENDED that you do NOT name this     *
 *         as "WAKEUP EXEC" (or execs that run in the "address CMS" *
 *         environment will run this before "WAKEUP MODULE *"!      *
 *         "WAKEUP MODULE".  A better name might be "SINK EXEC".    *
 *         This is named "WAKEUP EXECSAMP" just so that it shows up *
 *         when entering "FILELIST WAKEUP * *"                      *
 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  */


   address COMMAND
   parse source xos xct xfn xft xfm xcmd xenvir .
   parse upper arg parms 1 operands '(' options ')' parmrest

   If operands='?' then Signal Explain

   Signal ON Syntax
   Signal ON NoValue
/* Signal ON ERROR */

   /* Save a few initial settings */
   parse value diag(08,'CP QUERY SET') with . 'CPCONIO' $cpconio .
   If cmsflag('CMSTYPE') then $cmstype='RT'
                         else $cmstype='HT'

  'SET CMSTYPE HT'
    'CP SET CPCONIO IUCV'  /* Intercept all CP console IO with IUCV */
    'WAKEUP +0 (NOEXT IUCVMSG QUIET'
  'SET CMSTYPE' $cmstype                         /* Restore cmstype */

   Do forever
     'CONWAIT'
     'DESBUF'
     'WAKEUP' operands '(CONS APPC EXT IO IUCVMSG NOREAD RDR SMSG' ,
                        'TIME VMCF FILE(WAKEUP TIMES *)'
      wrc = rc
      parse pull . wakedate waketime .

      /* Get past midnight */
      If waketime > '23:57:30' then 'CP SLEEP 3 MIN'
      /**************************************************************/
      /* Some event occurred - see what to do.                      */
      /* Return codes from 'WAKEUP' as follows:                     */
      /*                                                            */
      /*  -2 - 1st time invocation from CMS Subset (invalid)        */
      /*   0 - Nothing to wait for--all timer file options done     */
      /*   1 - VMCF or SMSG arrived & stacked                       */
      /*   2 - WAKEUP 'time' operand has elapsed                    */
      /*   3 - Time from 'WAKEUP TIMES' file reached                */
      /*   4 - Reader File of proper class has arrived              */
      /*   5 - IUCVMSG has arrived                                  */
      /*   6 - Virtual Cons. Interrupt (ENTER, PA1, PFn, etc.)      */
      /*   7 - I/O interrupt (EXCEPT console, whish is rc=6)        */
      /*   8 - External interrupt                                   */
      /* 100 - Explanation from 'WAKEUP ?" complete                 */
      /* 101 - Empty file in card rdr, RDR option (FSREAD rc)       */
      /* 103 - Unknown card rdr error, RDR option (FSREAD rc)       */
      /**************************************************************/
     Select
       When wrc=1 then                      /* VMCF or MSGS arrived */
         Do
           parse pull msgtype userid msgtext
           say msgtype userid msgtext
         End
       When wrc=2 then                      /* TIME +mm expired     */
         Do
           say 'TIME +mm expired:' wakedate waketime
         End
       When wrc=3 then                      /* WAKEUP Time reached  */
         Do
           parse pull . RecNo RecordFromFile
           say 'WAKEUP TIME reached:' RecNo RecordFromFile
         End
       When wrc=4 then                      /* RDR file arrived     */
         Do
           /* We'll call EXIT to keep from looping on the same      */
           /* reader file.  You COULD perform some other reader     */
           /* file processing (perhaps CALL a sub-routine to do it.)*/
           say 'A Reader file arrived, ending' xfn xft xfm
           Call Exit 0
         End
       When wrc=5 then                      /* IUCVMSG interrupt   */
         Do
           parse pull msgtype userid msgtext
           say msgtype userid msgtext
         End
       When wrc=6 then                       /* Console interrupt   */
         Do
           say 'Console interrupt at' time 'on' date,
               '-' xfn 'ending.'
           Call Exit wrc
         End
       When wrc=7 then                       /* non-CONS I/O intrpt */
         Do
           parse pull irpttype devaddr csw csw1 csw2
           say 'I/O interrupt:' irpttype devaddr csw csw1 csw2
         End
       When wrc=8 then                       /* EXT interrupt       */
         Do
           parse pull irpttype InterruptCode
           say 'EXTernal interrupt:' irpttype InterruptCode
         End
       Otherwise                             /* Unknown Return Code */
         Do
           say 'Error return code from WAKEUP =' wrc
           Call Exit wrc
         End
     End /* Select */
   End  /* forever */

/********************************************************************/
/*                   Sub-Routines below this point                  */
/********************************************************************/

Exit:
   parse arg exitrc todo
  'CP SET CPCONIO' $cpconio              /* Restore initial setting */
   If todo='?' then say 'For more help, enter:' xfn '?'
   If verify(exitrc,'-0123456789')>0 then Exit 999999
Exit exitrc


Error:
   etxt.1='+++ "ERROR:" error rtn entered in:' xfn xft xfm', rc='rc
   etxt.2='+++ from line:' sigl', which reads:'
   etxt.3='+++'sourceline(sigl)
   cmdline=strip(sourceline(sigl),'B')
   cmdline=value('CMDLINE')
   etxt.4='+++ which translates to:' cmdline
   etxt.0=4
  'PIPE STEM etxt. | CONS'
Call Exit 20


Syntax:
   etxt.1='+++ "SYNTAX:" error rtn entered in:' xfn xft xfm', rc='rc
   etxt.2='+++ from line:' sigl', which reads:'
   etxt.3='+++'sourceline(sigl)
   cmdline=strip(sourceline(sigl),'B')
   cmdline=value('CMDLINE')
   etxt.4='+++ which translates to:' cmdline
   etxt.0=4
  'PIPE STEM etxt. | CONS'
Call Exit 20


NoValue:
   etxt.1='+++ "NoValue:" error rtn entered in:' xfn xft xfm', rc='rc
   etxt.2='+++ from line:' sigl', which reads:'
   etxt.3='+++'sourceline(sigl)
   etxt.4='+++ Variable with no value is:' condition('Description')
   etxt.0=4
  'PIPE STEM etxt. | CONS'
Call Exit 24


Explain:
  'PIPE (NAME Explain)' ,
     '| <' xfn xft xfm ,
     '| INSIDE /ExplainBegin:/ /ExplainEnd:/' ,
     '| PREFACE STRLITERAL /'xfn xft xfm 'help.../' ,
     '| CONSOLE'
   Call Exit 0
/*
ExplainBegin:

===> Place command description and syntax here, between
===> lines beginning with "ExplainBegin:" and "ExplainEnd:"
===> A sample "railroad-style" syntax is shown below.

            +-default operands--+
>>-Cmdname--+-------------------+--+-------------------+---------------><
            +-optional operands-+  +-(-| Options |-+---+
                                                   +-)-+

|-Options-|


ExplainEnd:
*/


/* Epilog ***********************************************************
 * Function      - Sample EXEC to process WAKEUP module functions.  *
 * Component of  - WAKEUP module (from CMS Utilities Facility)      *
 * Command format- WAKEUP   <at> <hh:mm<:ss>>                       *
 *                          <+<hh:>mm<:ss>>                         *
 *               - For more information enter: HELP CMS WAKEUP      *
 * Called by     - User from console                                *
 * Dependencies  - VM/SP 3 or higher.                               *
 *                 WAKEUP   MODULE                                  *
 *                 WAKEUP   TIMES (parm file for WAKEUP event -     *
 *                          a sample of this is WAKEUP TIMES Y2)    *
 * Program Lang. - CMS REXX                                         *
 * Date Written  - 19880707                                         *
 * Author        - Michael R. Walter                                *
 * Changed | By  | Description of Change                            *
 * --------+-----+------------------------------------------------- *
 * 20001024  mrw - Add 'APPC' option                                *
 * 20081013  mrw - Save/restore CMSTYPE and CPCONIO settings.       *
 *                                                                  *
 ********************************************************************/




The information contained in this e-mail and any accompanying documents may 
contain information that is confidential or otherwise protected from 
disclosure. If you are not the intended recipient of this message, or if this 
message has been addressed to you in error, please immediately alert the sender 
by reply e-mail and then delete this message, including any attachments. Any 
dissemination, distribution or other use of the contents of this message by 
anyone other than the intended recipient is strictly prohibited. All messages 
sent to and from this e-mail address may be monitored as permitted by 
applicable law and regulations to ensure compliance with our internal policies 
and to protect our business. E-mails are not secure and cannot be guaranteed to 
be error free as they can be intercepted, amended, lost or destroyed, or 
contain viruses. You are deemed to have accepted these risks if you communicate 
with us by e-mail. 

Reply via email to