Don Russell wrote:
[snip]
That is, how can I determine what my ORIGINID would be if I sent a
spool file to another ID?
The LCLQRY package seems like the best solution.... however, even that
level of modification is a little sticky. As a compromise, I wrote the
following little EXEC (QALTID EXEC) I thought I'd share in case anybody
is looking for the same information.
/*--------------------------------------------------------------------*/
/* Provide a REXX function to obtain the ALTID in effect for the */
/* calling userid. If no ALTID is in effect, it returns the ID it is */
/* running on. */
/* */
/* altid = 'QALTID'() */
/* */
/* Don Russell - 29 December 2006 */
/* */
/*--------------------------------------------------------------------*/
trace Off
address command
'PIPE',
'CP QUERY ALTID|',
'SPECS W-1|',
'VAR ALTID'
if (rc = 0) then return altid
/*--------------------------------------------------------------------*/
/* CP QUERY ALTID is not available on this system ... ho hum */
/* Roll up our sleeves and do it the hard way. */
/*--------------------------------------------------------------------*/
'GETFMADR'
if (rc = 0) then parse pull . . vprt .
'PIPE',
'STRLITERAL /SPOOL' vprt 'TO' userid()'/|',
'STRLITERAL /DEFINE PRINTER' vprt'/|',
'CP'
'PIPE',
'STRLITERAL X0140|',
'URO' vprt'|',
'TAKE LAST 1|',
'SPECS /QUERY VIRTUAL' vprt'/|',
'CP|',
'DROP FIRST 3|',
'TAKE FIRST 1|',
'SPECS W5|',
'VAR SPID|',
'SPECS /CLOSE 'vprt'/ 1 WRITE /DETACH 'vprt'/ 1|',
'CP'
parse value diag('F8',spid) with 13 origin +8 .
origin = strip(origin)
parse value diag('08','PURGE * RDR' spid) with .
return origin
--- end of exec ---
I thought I could do it all with a single pipe line, but when I do that the URO
fails saying the specified device doesn't exist. Splitting it in two was
simpler than figuring it out further.
Of course comments, improvements are welcome.
Don Russell