Sorry for the late reply (hey, what do you want for free!?).  I was at 
CAVMEN all-day yesterday.

The following handy-dandy SFDATTIME EXEC does what you're looking for, and 
more.  It deals with UTC as well.  I just tried the simplest form on z/VM 
5.1 and it still works even though it was written "a while" ago (pre-Y2K). 
 It's helped me out a bunch of times.

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     - SFDATTIM EXEC                                    *
 * Unit Support  - IS                                               *
 * Status        - Version 1, Release 2.0                           *
 ********************************************************************/

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

   numeric digits 32
   ?function=(xct='FUNCTION')
   If ?function
      then parse var operands sfid userid','options
      else parse var operands sfid userid .

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

   ?open =0
   ?close=0
   ?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 ?open=1
        When abbrev('CLOSE',opt,4)    then ?close=1
        When opt='BOTH'               then
                                           Do
                                             ?open=1
                                             ?close=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 \?open & \?close then ?open=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='*') & ,
      \?close & \?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 ?open
           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)
        spfclkopLW=x2c(spfclkopLW)
        spfclkclHW=x2c(spfclkclHW)
        spfclkclLW=x2c('00000000')
      End

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

   open.=''
   close.=''

   If ?open then
      Do
        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 ?close 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

   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 )
        adjcloseTOD = d2c( x2d(spfclkclHW||spfclkclLW) + adjhrs )
      End
   Else
      Do
        adjopenTOD  = d2c( x2d(spfclkopHW||spfclkopLW) - adjhrs )
        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.
     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.
     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.         *
 *                                                                  *
 ********************************************************************/




"Horlick, Michael" <[EMAIL PROTECTED]> 

Sent by: "The IBM z/VM Operating System" <IBMVM@LISTSERV.UARK.EDU>
01/25/2007 08:55 AM
Please respond to
"The IBM z/VM Operating System" <IBMVM@LISTSERV.UARK.EDU>



To
IBMVM@LISTSERV.UARK.EDU
cc

Subject
How to determine the creation date of open spool file & RSCS printer issue






Greetings,

First question: Is there a way to determine the date and time of an open
spool file?

q rdr rscs all

ORIGINID FILE CLASS RECORDS  CPY HOLD DATE       TIME     NAME      TYPE

RSCS     0264 N PRT 00000007 001 NONE OPEN- 0F01          MP75
OUTPUT
RSCS     8712 N PRT 00000007 001 NONE 2007-01-18 14:39:04 MP75
OUTPUT
RSCS     5191 X PRT 00000118 002 NONE OPEN- 0F00          DIEJ008G
OUTPUT
<mike> Ready; 

Since we have converted a lot of our printers from SNA to LPR I have
noticed that sometimes a queue gets established for a printer or
printers. I have written a REXX exec , converted for VM:Operator that
checks and reports on spool files older than 2 hours old (except I can't
determine that for open spool files) 

When this happens I have informed the operator to ping the printer, do
some RSCS QUERY commands, a DRAIN on the printer, followed by a FLUSH
HOLD, a START and then QUERY to see if anything is being printed. If
this doesn't help they call the client.

Sometimes this works and I'm assuming that the LPD running within that
printer is "lost" in those cases.

Second question: Has this ever happened to you?

When it fails we assume there something physically wrong with the
printer. 
Since this whole error recovery procedure is a bit of a hassle for the
operator I am thinking of automating it.

Last question: Anyone go through the same exercise?

Thanks,

Mike Horlick

 

 




 
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.

Reply via email to