Return-Path: <@OHSTVMA.ACS.OHIO-STATE.EDU:VM-UTIL@UBVM.BITNET>
Newsgroups: bit.listserv.vm-util
Date:         Thu, 21 Jan 1993 11:25:38 +0100
From:         Wolfram Fassbender <MAINT@DB0FUB11.BITNET>
Subject:      Re: change to originid rdr
              20 Jan 93 15:04:46 EST from <VALDIS@VTVM1.CC.VT.EDU>

On Wed, 20 Jan 93 15:04:46 EST Valdis Kletnieks said:
>
>
>On Tue, 19 Jan 1993 14:23:20 LCL you said:
>>jobs come to prtserv rdr). Then, it receives
>>the file with DEPRINT MODULE and does PRINT.
>>I like to skip this step: if I could change the
>>ORIGINID of the file in prtserv rdr, I could
>>transfer it directly to printer without having rscs
>>rejecting the file, after counting pages in rdr.
>>Therefore, I need a program to change the originid
>>of a rdr file. Prtserv has, of course, all necessary
>>privileged classes available to do this.
>
>Changing the userid of a spool file is fraught with danger.  The biggest
>problem is that there are a lot of pointers to "previous" and "next"
>files - and these get even more complicated in HPO(5/6/etc) and the
>XA and ESA systems...
>
>Thinking about the problem here, perhaps what you *really* need to do
>is create a CP mod that would count the pages of the file *as it prints*
>and do something reasonable.  Someplace on a tape I have mods I made to
>an SP/5 system to count pages on a 1403 or 3203 printer by watching
>the CCW chaing go by, and cut an accounting record at job end.  This
>had the advantage of Doing The Right Thing if the operator issued a
>'FLUSH 50F' to purge the job.  We also had hooks into RSCS to handle
>remote printers, and incoming files coming from other machines..
>

I have programmed such a beast a while ago. Of course, rotten, quick'n dirty
handmade ware. I guess that you have to make some changes to meet the needs
of HPO. Hopem this helps.


-Wolfram

btw. be careful, it patches directly in CP data areas :-))


/*- Scan Spool queues */
Arg Spid User
If Spid = '' | Spid = '?',
Then; Do;
        Say 'XFER Spid UserID'
        Exit
      End;
User = Left(User,8,' ');
 Call SpoolChk Diag(8,'DCP 388'); /* Test Rdr   queue */
exit
 Call SpoolChk Diag(8,'DCP 380'); /* Test Print queue */
 Call SpoolChk Diag(8,'DCP 384'); /* Test Punch queue */
exit
/*------------------------ Subroutine ------------------------*/
SpoolChk:
  Arg . Anchor .
/*
 *            +--------------+
 *            |   DevName    |
 *            +--------------+
 * Anchor --> |   SFBQueue   |
 *            +--------------+
 *
 * SFBlock.0  = Pointer to next SFBlock
 * SFBlock.8  = SFBOwner
 * SFBlock.10 = SFBOrigin
 * SFBlock.1E = Spool ID
 * SFBlock.40 = Creation Date
 * SFBlock.48 = Creation Time
 */

 Anchor = X2D(Left(Anchor,8)) - 4; /* we need Device */

 Parse Value Diag(8,'DCP 'D2X(Anchor)'.8') with . Device Chain .
 Device = X2C(Device); SFBAdr = X2D(Left(Chain,8))

  If SFBAdr = 0  Then Return 0
  Do Forever

  Parse Value Diag(8,'DCP 'D2X(SFBAdr)) with . SFBNext .
  SFBNext = X2D(Left(SFBNext,8))

  Parse Value Diag(8,'DCP 'D2X(SFBAdr+8)'.8') with . O1 O2 .
  SFBOwner = X2C(Left(O1,8))||X2C(Left(O2,8))

  Parse Value Diag(8,'DCP 'D2X(SFBAdr+16)'.8') with . O1 O2 .
  SFBOrigin = X2C(Left(O1,8))||X2C(Left(O2,8))


  Parse Value Diag(8,'DCP 'D2X(SFBAdr+30)) with . O1 O2 .
  SFBId = X2D(Substr(O1,5,4))

  If SFBid = SPid,
  Then; Do;
       'STCP 'D2X(SFBAdr+8) C2X(SubStr(User,1,4)) C2X(SubStr(User,5,4))
        Return 0
        End;

  Parse Value Diag(8,'DCP 'D2X(SFBAdr+64)'.8') with . O1 O2 .
  SFBDate = X2C(Left(O1,8))||X2C(Left(O2,8))

  Parse Value Diag(8,'DCP 'D2X(SFBAdr+72)'.8') with . O1 O2 .
  SFBTime = X2C(Left(O1,8))||X2C(Left(O2,8))
/*
  Say Device SFBOwner SFBOrigin SFBId SFBDate SFBTime
*/

  SFBAdr = SFBNext
  If SFBAdr = 0 Then Return 0
End;
Return 0 /* to be safe */