how to code the parameters for API QUSRSPLA

75 pts.
Spool files
i want to get the last print file generated from a job which was created AFTER the time the program producing the print file ran. my methodology was to 1. rtvsysval qtime 2. execute the program 3. execute the api qusrspla 4. test the create time and determine if it was greater than the time i previously retrieved. i am having dififculties in getting the parameters coded and the on-line help does not provide an example i can use

Software/Hardware used:

Answer Wiki

Thanks. We'll let you know when a new response is added.

I’m most liikely missing something, but doesn’t the special value -1 for the spool number parameter meet your needs (assuming that a new printer file is written by the called program)? If not, then perhaps using the Retrieve Identity of Last Spooled File Created (QSPRILSP) API before and after running the program would be an easy way to determine the last print file generated (and not being from prior to running the program). Comparing the output of the before and after API calls would certainly tell you what I believe you are looking for.

QTIME could be used, but the logic may fail if run for instance during a daylight saving time transition where time is changed back an hour. As QTIME represents local time I wouldn’t be surprised in this situation if the time of the “last” entry was be before the time of the “last – 1” entry (though I didn’t test it either).

Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • matis
    this is a batch job and i email the report. yes, the job was emailing some other report produced - perhaps in this job stream - perhaps somewhere else - with the same name. i began doing research and came up with this particular api. which special value -1? in the qusrspla api? my difficulty is in actually defining and coding the parameters so i get the expected results. so far i've been getting a CPF3C20 when I call the api
    75 pointsBadges:
  • TomLiotta
    There are two parameters that might be most commonly declared incorrectly -- Length of receiver variable and Spooled file number. The API documentation shows both as BINARY(4). That essentially means they are "4-byte binary numbers". (Or 32-bit binary.) In ILE CL at V5R3 and later, they could both be declared as *INT, which defaults to *INT (4). In RPG IV, they could be declared as 10I 0. Note that because 'Spooled file number' can accept negative values, the declaration cannot be "10U 0". A sign must be accommodated. Also note that "BINARY(4)" is not precisely the same as RPG's 'B' data type. While the parms can generally be declared as data type 'B', there are plenty of reasons not to do so. Tom
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: