75 pts.
 how to code the parameters for API QUSRSPLA
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:
cl
ASKED: February 11, 2010  3:55 PM
UPDATED: February 12, 2010  8:46 PM

Answer Wiki:
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).
Last Wiki Answer Submitted:  February 12, 2010  3:15 pm  by  bvining   6,055 pts.
All Answer Wiki Contributors:  bvining   6,055 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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 pts.

 

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

 108,135 pts.