And without a local mod, but requiring:
- RXTOD MODULE (IBM-distributed on MAINT 193)
- If the SPOOL userid is not the same that this  command is running on, or
the 'CLOSedate' option is requested, then Class 'E' privs are needed for
the
  CP LOCATE' and 'CP DISPLAY H' commands.

See the EXEC pasted after the signature.  It's old, but I believe that it
still works...

Mike Walter
Aon Corporation
The opinions expressed herein are mine alone, not my employer's.

/* Prolog; See Epilog for additional information ********************
 * Exec Name     - SFDATTIM EXEC                                    *
 * Unit Support  - IS                                               *
 * Status        - Version 1, Release 3.0                           *
 ********************************************************************/

   address COMMAND
   parse source xos xct xfn xft xfm xcmd xenvir .

   numeric digits 32
   ?function=(xct='FUNCTION')
   If ?function then
      Do
        operands = arg(1)
        options  = arg(2)
      End
   Else
      parse arg parms 0 operands '(' options ')' parmrest
   upper options
   parse upper var operands sfid userid .


   ?reply=0                          /* Any data to display/return? */
   If sfid='' | sfid='?' then Call Explain

   ?showopen =0
   ?showclose=0
   ?sfidopen =0                        /* Default-file clsoed       */
   ?tod  =0
   ?utc  =0
   ?timezone =0
   ?timezdef =0                        /* Defaulted to TIMEZONE?    */
   wkopts=options
   invopts=''
   Do while wkopts<>''
      parse var wkopts opt wkopts
      Select
        When abbrev('OPEN',opt,4)     then ?showopen=1
        When abbrev('CLOSE',opt,4)    then ?showclose=1
        When opt='BOTH'               then
                                           Do
                                             ?showopen=1
                                             ?showclose=1
                                           End
        When opt='UTC'                then ?utc=1
        When opt='TOD'                then ?tod=1
        When abbrev('TIMEZONE',opt,4) then
          Do
            parse var wkopts tzoffset wkopts
            parse var tzoffset L1tzoffset 2 tzhrs
            If tzoffset='' then
               Do
                 say xfn'; TIMEZONE option requested without any' ,
                          'offset.'
                 rc=20
                 Signal Exit
               End
            If L1tzoffset<>'+' & L1tzoffset<>'-' then
               Do
                 say xfn'; TIMEZONE offset must start with "+" or "-".'
                 say 'Found: "TIMEZONE' tzoffset'"'
                 rc=20
                 Signal Exit
               End
            If verify(tzhrs,0123456789)>0 then
               Do
                 say xfn'; TIMEZONE offset must be numeric, found:' ,
                    '"'tzhrs'".'
                 rc=20
                 Signal Exit
               End
            If tzhrs>23 then
               Do
                 say xfn'; TIMEZONE offset must be in the range 0-23' ,
                    'found "'tzhrs'".'
                 rc=20
                 Signal Exit
               End
            ?timezone=1
          End
        Otherwise invopts=invopts opt
      End
   End

   invopts=space(invopts)
   If invopts<>'' then
      Do
        say xfn'; Invalid options "'invopts'".'
        rc=20
        Signal Exit
      End
   If \?showopen & \?showclose then ?showopen=1  /* Provide default */
   If ?utc & ?timezone then
      Do
        say xfn'; Mutually exclusive options specified:' ,
                 'UTC and TIMEZONE'
        rc=20
        Signal Exit
      End

   If \?timezone & \?utc then
      Do                                           /* Set default   */
       'PIPE (NAME Timezone)' ,
          '| CP QUERY TIMEZONE' ,
          '| LOCATE ANYCASE / ACTIVE/' ,
          '| VAR cptz'
        parse upper var cptz . direction tzhrs'.' .
        If direction='WEST' then L1tzoffset='-'    /*Backup from UTC*/
                            else L1tzoffset='+'    /* Add to UTC    */
        tzhrs=strip(tzhrs)
        tzoffset=L1tzoffset||tzhrs
        ?timezdef=1
      End

   If userid='' then userid='*'
   /* ------------------------------------------------------------- */
   /* Operating system-dependent address offsets follow (ESA 121)   */
   sfbdate =x2d(40)          /* Hex offset in SFBLOK to Create date */
   spfclkop=x2d(30)          /* Hex offset in SPFBK to TOD @ open.  */
   spfclkcl=x2d(38)          /* Hex offset in SPFBK to TOD @ close. */
   /* ------------------------------------------------------------- */

   parse value diagrc(08,'CP LINK' userid) with ,
               rc cc qid 17 msg '15'x .
   ?cpid=(rc<>20 & rc<>52 & rc<>53)
   If \?cpid then
      Do
        say xfn'; 'msg
        Signal Exit
      End

   If verify(sfid,01234567890)>0 then
      Do
        say xfn'; sfid must be numeric, found: "'sfid'".'
        rc=20
        Signal Exit
      End

   sfidlen=length(sfid)
   If sfidlen<1 | sfidlen>4 then
      Do
        say xfn'; sfid must be 1-4 long, found: "'sfid'".'
        rc=20
        Signal Exit
      End

   /* --------------------------------------------------------------*/
   /* If the ID running the command owns the file                   */
   /* *and* they did not ask for close or TOD info (which is not    */
   /* available via DIAG 14).                                       */
   /* --------------------------------------------------------------*/

   If (userid=userid() | userid='*') & ,
      \?showclose & \?tod & \?timezone & ,    /* Not available from     */
      \?utc then                          /* ...diag 14 output.     */
      Do

       'PIPE CP ORDER' userid 'READER' sfid  /* Order sfid to top   */
        parse value diag(14,'RSFD',0) with , /* Start w/top file    */
              cc 2 . 3 Ryp1 7 . 9 . +(sfbdate) mmddyy +8 hhmmss +8 . ,
              0 9 sfb 153 .
        If cc<>0 then
           Do
             say xfn'; Condition code "'cc'" returned from' ,
                      'Diag 14 RSFD (0FFF).'
             rc=cc
             Signal Exit
             Call Exit
           End
        If ?showopen
           then reply=mmddyy hhmmss
           else reply=mmddyy
        ?reply=1
        rc=0
        Signal Exit
      End

   /* --------------------------------------------------------------*/
   /* If the ID running the command does NOT own the file, or       */
   /* does and requested priviledged options required access to the */
   /* SPFBK.                                                        */
   /* --------------------------------------------------------------*/
   parse value diagrc(08,'CP LOCATE SPFBK' userid sfid) with ,
              rc cc . 17 hdrline '15'x ,
              . . . spfbk .
   If rc<>0 then
      Do
        src=rc
        rc=strip(rc,'B')
        cc=strip(cc,'B')
        say xfn'; "CP LOCATE SPFBK' userid sfid'" rc='src', cc='cc'.'
        say hdrline
        parse value diag(08,'CP QUERY PRIVCLAS') with ,
                      . '15'x . currpriv .
        If pos('C',currpriv)=0 & ,
           pos('E',currpriv)=0 then
           say 'CP Privilege class "C" or "E" is required.'
        rc=src
        Signal Exit
      End

   /* Actual address of this field */
   @spfclkop=d2x( x2d(spfbk) + spfclkop )
   /* Actual address of this field */
   @spfclkcl=d2x( x2d(spfbk) + spfclkcl )

   /* Get the file creation/open TOD value */
   parse value diagrc(08,'CP DISPLAY H'@spfclkop'.8') with ,
               rc cc . 17 ,
               . spfclkopHW spfclkopLW . /* Open TOD High & LowWord */
   If rc<>0 then
      Do
        say xfn'; "CP DISPLAY H'@spfclkop'.8" rc='src', cc='cc'.'
        say 'CP Privilege class "C" or "E" is required.'
        Signal Exit
      End

   /* Get the file close TOD value */
   parse value diagrc(08,'CP DISPLAY H'@spfclkcl'.4') with ,
               rc cc . 17 ,
               . spfclkclHW .
   If rc<>0 then
      Do
        say xfn'; "CP DISPLAY H'@spfclkcl'.4" rc='rc',cc='cc'.'
        say 'CP Privilege class "C" or "E" is required.'
        Signal Exit
      End

   /* The low order word of a TOD value holds no more than          */
   /* 1.048575999755859375 seconds (FFFFFFFF-F4240000).             */
   /* That's 'close enough' for us to use as a close date/time.     */
   spfclkclLW='00000000'

   reply=''

   If ?timezone | ?timezdef then
      Call TodAdjust
   Else
      Do                             /* All below expect hex format */
        spfclkopHW=x2c(spfclkopHW)   /* Open TOD clock High Word    */
        spfclkopLW=x2c(spfclkopLW)   /* Open TOD clock Low Word     */
        spfclkclHW=x2c(spfclkclHW)   /* Close TOD clock High Word   */
        spfclkclLW=x2c(spfclkclLW)   /* Close TOD Clock Low Word    */
        If spfclkclHW='00000000'
           then ?sfidopen=1                       /* Not closed yet */
      End

   If ?tod then
      Do                             /* Return in hex format        */
        reply=''
        If ?sfidopen then spfclkclLW='00000000'x
        Select
          When ?showopen & \?showclose then
            reply=spfclkopHW||spfclkopLW
          When ?showclose & \?showopen then
            reply=spfclkclHW||spfclkclLW
          Otherwise
            reply=spfclkopHW||spfclkopLW ,
                  spfclkclHW||spfclkclLW
        End
        ?reply=1
        rc=0
        Signal Exit
      End

   open.=''
   close.=''


   If ?showopen then
      Do
        address CMS 'STATE RXTOD MODULE *'
        If rc=28 then
           say 'IBM distributes "RXTOD MODULE" on MAINT 193.'
        parse value tod('C',spfclkopHW||spfclkopLW) with ,
                    open.mmddyy +8 open.hhmmss +8 .
        If rc<>0 then
           Do
             say xfn'; "tod('C',spfclkopHW||spfclkopLW)" rc='rc
             Signal Exit
           End
        reply=open.mmddyy open.hhmmss
      End

   If ?showclose then
      Do
        address CMS 'STATE RXTOD MODULE *'
        If rc=28 then
           say 'IBM distributes "RXTOD MODULE" on MAINT 193.'
        If \?sfidopen then
           Do
             parse value tod('C',spfclkclHW||spfclkclLW) with ,
                         close.mmddyy +8 close.hhmmss +8 .
             If rc<>0 then
                Do
                  say xfn'; "tod('C',spfclkclHW||spfclkclLW)" rc='rc
                  Signal Exit
                End
              reply=reply close.mmddyy close.hhmmss
           End
        Else
           reply=reply '00/00/00 00:00:00'
      End

   reply=space(reply)
   ?reply=1
   rc=0
   Signal Exit
Call Exit 0 /* Doc only */

/********************************************************************/
/*                           SubRoutines                            */
/********************************************************************/
Exit:

   If verify(rc,01234567890)>0 then exitrc=999999
   If ?function then
      If ?reply then Return reply
                else Return rc(*-1)          /* Cause an error  */
   Else
      If ?reply then say reply
Exit rc


TODadjust:
AdjustTOD:

   TODsec=x2d('F4240000')              /* Clock Units (TOD) per sec;*/
                                       /* see 370-XA Princ. of Oper.*/
   TODhr=TODsec*60*60                  /* Clock Units (TOD) per hr  */
   adjhrs=tzhrs*TODhr                  /* Adjustment in hours       */

   If L1tzoffset='+' then
      Do
        adjopenTOD  = d2c( x2d(spfclkopHW||spfclkopLW) + adjhrs )
        If spfclkclHW='00000000' then                 /* Still open */
           Do
            adjcloseTOD='00000000'x||'00000000'X
            ?sfidopen=1
           End
        Else adjcloseTOD = d2c( x2d(spfclkclHW||spfclkclLW) + adjhrs )
      End
   Else
      Do
        adjopenTOD  = d2c( x2d(spfclkopHW||spfclkopLW) - adjhrs )
        If spfclkclHW='00000000' then                 /* Still open */
           Do
            adjcloseTOD='00000000'x||'00000000'X
            ?sfidopen=1
           End
        Else adjcloseTOD = d2c( x2d(spfclkclHW||spfclkclLW) - adjhrs )
      End

   parse var adjopenTOD  spfclkopHW 5 spfclkopLW
   parse var adjcloseTOD spfclkclHW 5 spfclkclLW
Return


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

SFDATTIMe is used to display the full mm/dd/yy and hh:mm:yy of a
specified SPOOL file.

                          +----*-----+
>--SFDATTIM--SpoolFileID--+--userid--+--+---------------------+-----><
                                        +-(-+-----------------+
                                            +- |Options |-+---+
                                                          +-)-+
or as a REXX function call:'

                               +----*----+
>--crdate=sfdattim(SpoolFileID-+-userid--+-+------------+-)---------><
                                           +-,|Options|-+


Where:

SpoolFileID
      is the 1-4 digit SPOOL file number of which the full mm/dd/yy
      creation date is to be returned.

userid
      is the userid which "owns" the SPOOL file.  If you have
      CP privclass "C" or "E" it may be an ID other than your own.
      DEFAULT=* (your own userid).


Options:

OPEN
     requests return of the "mm/dd/yy hh:mm:ss" when the SPOOL file was
     opened.
     Default=OPEN

CLOSe
     requests return of the "mm/dd/yy hh:mm:ss" when the SPOOL file was
     closed.  If the SPOOL file is still open, "00/00/00 00:00:00" is
     returned.
     This option is available only to those with system privclass of
     "C" or "E".'

BOTH
     requests return of both Open and Close date and time.
     Synonymous with "OPEN" and "CLOSE".

TIMEzone +n/-n
     Where "n" is the number of hours the system is running east or west
     of UTC (Coordinated Universal Time in Greenwich, England).
     "n" must be in the range 0-23.

     The open AND close date/time of SPOOL files are stored as UTC.  This
     option permits displaying the date and time of the file would be
     shown in response to a "CP Query Reader ALL" command.
     CP automatically offsets the SPOOL file date/time y the number of
     hours the system is east or west of UTC.

     In the United States, one would want to subtract a number of hours
     from the UTC on SPOOL to derive the local time, as the time in
     in Greenwich, England is some number of hours ahead of US times.

     The specified number of hours is added to or subtracted from the
     SPOOL file dates/times before display.
     Default=the active offset as displayed in response to a
     "CP Query TIMEZONE" command.

     When TIMEZONE is specified, the response is returned as:

     date1 time1 date2 time2

     Where: date1 = OpenDate (or CloseDate of only CLOSe was specified)
            time1 = OpenTime (or CloseTime of only CLOSe was specified)
            date2 = ClosDate (only when CLOSe was specified)
            time2 = ClosTime (only when CLOSe was specified)
     This option is available only to those with system privclass of
     "C" or "E".

UTC
     synonym for: TIMEzone +0.
     This option is available only to those with system privclass of
     "C" or "E".

TOD
     Return the 8-byte hexidecimal TOD clock values as requested for the
     OPEN and/or CLOSe times.  If the SPOOL file is still open, the
     right 4 bytes of the TOD will be returned as '00000000'x.
     This option is available only to those with system privclass of
     "C" or "E".

Usage notes.

If OPEN and CLOSe are both requested, OPEN date/time will always be
returned as the first tokens, followed by CLOSe date/time.

ExplainEnd:
*/
rc=4
Signal Exit

/* Epilog ***********************************************************
 * Function      - Provide open date of SPOOL file.                 *
 * Component of  - System Programmer's tool box.                    *
 * Command format- SFDATTIM sfid userid|*                           *
 * Called by     - command line or utility execs                    *
 * Dependencies  - VM/SP 3 or higher.                               *
 *               - RXTOD MODULE (IBM-distributed on MAINT 193)      *
 *               - If the SPOOL userid is not the same that this    *
 *                 command is running on, or the 'CLOSedate' option *
 *                 is requested, then Class 'E' privs are needed    *
 *                 for the 'CP LOCATE' and 'CP DISPLAY H'           *
 * Program Lang. - CMS REXX                                         *
 * Date Written  - 02/13/97                                         *
 * Author        - Michael R. Walter                                *
 * Changed | By  | Description of Change                            *
 * --------+-----+------------------------------------------------- *
 * 04/06/98  mrw -ORDER file to 1st if user's own file.             *
 *               -Add 'OPEN' and 'CLOSe' options.                   *
 * 04/14/98  mrw -Add UTC, TIMEZONE and TOD options.                *
 * 04/14/98  mrw -Correct verify() in Exit subrtn.                  *
 * 04/17/98  mrw -Add ?timezdef to permit G-class usage.            *
 * 05/18/98  adp -Use sfid=0 in Diag14 to get top file (just CP ORD)*
 * 10/20/99  mrw -Add 'BOTH' option.                                *
 * 20000224  mrw -Move 'numeric digits 32' from TOD processing to   *
 *                the start so machines with LARGE storage can      *
 *                process the large addresses.                      *
 * 20050531  mrw -Convert Explain: from rexx 'say' to Pipe.         *
 * 20070102  mrw -Replace IBM Logical Not sign with alteratives that*
 *                make it though e-mail.                            *
 *               -Report missing "RXTOD MODULE" distro location.    *
 *               -Return '00/00/00 00:00:00' for close time on open *
 *                spool files.                                      *
 * 20101109  mrw -Correct: adjcliseTOD='00000000'x||'00000000'X     *
 *                to:      adjcloseTOD='00000000'x||'00000000'X     *
 *                                                                  *
 ********************************************************************/




"Rob van der Heij" <[email protected]>

Sent by: "CMSTSO Pipelines Discussion List" <[email protected]>
05/05/2011 01:44 PM
Please respond to
"CMSTSO Pipelines Discussion List" <[email protected]>



To
[email protected]
cc

Subject
Re: Notification on logoff?






Iirc the reason was to have all blocks marked with the time stamp for
spool
recovery. We had a local mod to have the query show close time once it was
closed.
Rob
On May 5, 2011 8:21 PM, "Paul Gilmartin" <[email protected]> wrote:






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