× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is very old but working:


/*--------------------------------------------------------*/
DCL VAR(&RCVVAR) TYPE(*CHAR) LEN(70)
DCL VAR(&RCVVARLEN) TYPE(*CHAR) LEN(4)
DCL VAR(&ERRCODE) TYPE(*CHAR) LEN(8)

/* FIELDS FROM FORMAT SPRL0100 */
DCL VAR(&BYTESRTN) TYPE(*DEC) LEN(10 0)
DCL VAR(&BYTESAVL) TYPE(*DEC) LEN(10 0)
DCL VAR(&SPLFNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&USERNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
DCL VAR(&SPLFNBR) TYPE(*DEC) LEN(6 0)
DCL VAR(&SYSTEMNAME) TYPE(*CHAR) LEN(8)
DCL VAR(&CREATEDATE) TYPE(*CHAR) LEN(7)
DCL VAR(&CREATETIME) TYPE(*CHAR) LEN(6)

/*--------------------------------------------------------*/
CHGVAR VAR(%BIN(&ERRCODE 1 4)) VALUE(0)

/* &RCVVARLEN NEEDS TO BE SET TO THE SIZE OF &RCVVAR. +
IF YOU CHANGE THE SIZE OF &RCVVAR, CHANGE IT ON THE +
LINE BELOW AS WELL! (CL HAS NO %SIZE BIF!!) */

CHGVAR VAR(%BIN(&RCVVARLEN 1 4)) VALUE(70)

CALL PGM(QSPRILSP) PARM( &RCVVAR &RCVVARLEN 'SPRL0100'
&ERRCODE )

/* SINCE CL HAS NO SUCH THING AS A DATA STRUCTURE, I'VE +
PUT ALL OF THE FIELDS INTO ONE BIG &RCVVAR FIELD, +
AND WILL SPLIT IT INTO SUBFIELDS BELOW: */

CHGVAR VAR(&BYTESRTN) VALUE(%BIN(&RCVVAR 1 4))
CHGVAR VAR(&BYTESAVL) VALUE(%BIN(&RCVVAR 5 4))
CHGVAR VAR(&SPLFNAME) VALUE(%SST(&RCVVAR 9 10))
CHGVAR VAR(&JOBNAME) VALUE(%SST(&RCVVAR 19 10))
CHGVAR VAR(&USERNAME) VALUE(%SST(&RCVVAR 29 10))
CHGVAR VAR(&JOBNBR) VALUE(%SST(&RCVVAR 39 6))
CHGVAR VAR(&SPLFNBR) VALUE(%BIN(&RCVVAR 45 4))
CHGVAR VAR(&SYSTEMNAME) VALUE(%SST(&RCVVAR 49 8))
CHGVAR VAR(&CREATEDATE) VALUE(%SST(&RCVVAR 57 7))
CHGVAR VAR(&CREATETIME) VALUE(%SST(&RCVVAR 65 6))

/* THE FIELDS ABOVE NOW CONTAIN INFO ABOUT THE LAST +
SPOOLED FILE CREATED IN THE JOB. */

HTH
--
Marco Facchinetti

Mr S.r.l.

Tel. 035 962885
Cel. 393 9620498

Skype: facchinettimarco


Il giorno gio 25 nov 2021 alle ore 15:15 Jay <tegger@xxxxxxxxxxx> ha
scritto:

I'll have to give the QSPRILSP program a shot.

Thanks!

On 11/24/2021 11:58 PM Scott Klement <web400@xxxxxxxxxxxxxxxx> wrote:


Hello Jay,

I believe that when you refer to an "HTTP session", you really mean a
CGI program running under the IBM HTTP Server (Powered by Apache).

The IBM HTTP Server will user the operating system's "profile token"
support to switch userids. By default, it switches your job from the
QTMHHTTP profile to QTMHHTP1, but this can be changed in the Apache
configuration. At any rate, whenever a job switches profiles, this
affects spooled files. This is not specific to the HTTP server, it is
true of ANY job that switches profiles for any reason. For security
purposes, the current job id is not associated with spooled files, but
instead, a QPRTJOB job is used.

You can learn more about this by reading about the Profile Token APIs,
here:
https://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/apis/qsysetpt.htm
(There's similar information under "Profile Handles" as well, since they
work the same way.) Just look for QPRTJOB in the page to understand
about how spooled files are named with a different job id, you don't
necessarily have to read the entire page.

To solve your dilemna, you can call the Retrieve Identity of Last
Spooled File Created (QSPRILSP) program. Just call it, and it tells you
the appropriate job id, et al, that you would need to know in order to
use CPYSPLF
https://www.ibm.com/docs/en/i/7.4?topic=ssw_ibm_i_74/apis/QSPRILSP.htm

Alternately, you can eliminate the CPYSPLF and use OVRPRTF instead.

Good Luck

--
Scott Klement
http://www.scottklement.com



On 11/24/21 3:26 PM, Jay wrote:
I am extending an existing application to permit printing directly
from the HTTP session.
So far, okay. It prints when it is told to send to a printer.
When I added in the ability to copy the spool file to a PDF file, I
run into issues.
The printer file name is okay, but the job is not longer the current
job. It's the QPRTJOB session that handled the request.
So, copying the spool file blows up.

Is there a way to capture the actual printer job handling the print
request?
I'm expecting it to be 123456/QMHHTTP/username, but I wind up with a
spool file in 123456/QPRTJOB/username.


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.