Open List of Spooled Files (QGYOLSPL) API Filter Information Format OSPF0200

0 pts.
Tags:
DataCenter
RPGLE
Security
Our company has more than 85,000 spoolfiles to be filterd in different ways. I use List API QGYOLSPL with Filter Information Format OSPF0100 which was very qick. But to aply for a date range you have to use Format OSPF0200 where I got errors. Can anybody give a code example to flter usernames userid1 and userid2 + date range date1 to date2 + outq outqlib/outq. I've spent severel days to search for any example in the web but I coudnt find any. It is enough if you give th code of filter string which meets above selection, thanks. Ranjith Jayawardana
ASKED: March 9, 2006  6:53 AM
UPDATED: November 15, 2010  4:56 AM

Answer Wiki

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

Hi Ranjith

I’m afraid that you can’t subset the returned list of spool files by date the way you want to.

What you can do, though, is to sort the list into date order and then only process the list to the boundary of your date range.

All the best

Jonathan

====================================================

There is no reason to sort the list. Sorting will only make the process run slower.

The “Open List” APIs return single entries at a time or however many you can reserve space for. You need to check the date to see if it falls within the range when you have the entry. Adding each entry to some kind of array for sorting simply means that the sort is going to issue comparisons against each date anyway.

You’re better off not sorting.

Tom

====================================================

A basic set of subfields for filter OSPF0200 that filters spooled files for USERID1 and USERID2, created between Nov 12, 2010 9:00 AM and Nov 13, 2010 3:00 PM, on *OUTQ OUTQLIB/OUTQ, would look like this in CL:<pre>
dcl &OSPF0200 *char 150

dcl &lOSPF0200 *char 4 value( x’00000096′ ) /* 150 */
dcl &ofsUsers *char 4 value( x’0000006E’ ) /* 110 */
dcl &nbrUsers *char 4 value( x’00000002′ ) /* 2 */
dcl &lUsers *char 4 value( x’0000000A’ ) /* 10 */
dcl &ofsOutQs *char 4 value( x’00000082′ ) /* 130 */
dcl &nbrOutQs *char 4 value( x’00000001′ ) /* 1 */
dcl &lOutQs *char 4 value( x’00000014′ ) /* 20 */
dcl &filler1 *char 52 value( ‘……..’ )
dcl &StrDate *char 7 value( ’1101112′ )
dcl &StrTime *char 6 value( ’090000′ )
dcl &EndDate *char 7 value( ’1101113′ )
dcl &EndTime *char 6 value( ’150000′ )
dcl &filler2 *char 4 value( x’00000000′ )
dcl &User1 *char 10 value( ‘USERID1′ )
dcl &User2 *char 10 value( ‘USERID2′ )
dcl &OutQ *char 10 value( ‘OUTQ’ )
dcl &OutQLib *char 10 value( ‘OUTQLIB’ )</pre>
The entire filter structure fits in 150 bytes in this case. The first seven subfields are 4-byte integers. They are defined here as *CHAR(4) with hex values to show how the values fit in memory in the filter structure. All of the subfields can be concatenated together to build the &OSPF0200 structure. (In V5R4 CL or in HLLs, a data structure would allow setting the subfields directly in the data structure.)

The first field is &lOSPF0200. The x’96′ value is 150 in decimal to indicate that the complete structure is 150 bytes long. The structure can be longer, but only 150 bytes will be passed into the API.

The next subfield is &ofsUsers, x’6E’ (decimal 110), to mark the offset to the beginning of the list of users. The basic fixed length of OSPF0200 is 110 bytes, so the users list should not start before offset 110.

Next is &nbrUsers, x’02′, to indicate two users in the list. The length of user entries, &lUsers, is x’0A’, decimal 10. User entries can be longer than 10, but I don’t know why they should be.

Then, &ofsOutQs is x’82′ (decimal 130) to show that it follows the list of users. &nbrOutQs is x’01′ because there is only one in the list, and &lOutQs is x’14′ (decimal 20) because 20 bytes is plenty to hold an *OUTQ name and library.

The &filler1 field would be replaced by any other subfields that aren’t covered in this question. It covers 56 bytes of memory.

The &StrDate is a simple *CHAR(7) that holds a starting date in CYYMMDD format. &StrTime is *CHAR(6) that holds starting time in HHMMSS format.

The &EndDate is a simple *CHAR(7) that holds an ending date in CYYMMDD format. &EndTime is *CHAR(6) that holds ending time in HHMMSS format.

Together, the start/end dates/times provide the date range for selection in the resulting list.

The &filler2 field is a *CHAR(4) that is filled with binary zeros. It can be longer, but I wouldn’t trust it to be shorter if there are any selection fields after it. And if you make it longer, all of its bytes need to be filled with binary zeros.

Wherever that last field ends will be where any lists will start. You choose how far in memory you want to place your lists. I chose to start them right after the “reserved” area is defined in the specs.

The &User1 and &User2 fields are elements of an array of *CHAR(10) fields. You put as many elements there as you need. Your question asked about two user IDs. The &OutQ and &OutQLib fields are subfields of a *CHAR(20) array. You asked about a single *OUTQ.

If you leave any unused bytes between any arrays such as the user and outq arrays, those bytes should have binary zeros in them.

In ILE RPG (or V5R4 CL), you should probably base definitions for user and outq on the address just after the reserved field. Add element values one at a time, and increase the basing pointer by the length of each entry that you add. Keep count so you can add to the length that you specify in &lOSPF0200. Make sure you have enough memory allocated. Either create all of the memory allocation to hold as much as you’re going to populate for the whole structure or declare it big enough to hold the most you’ll ever use.

If you have trouble, post the related code and definitions. Also post the error message, particularly the message identifier.

Tom

Discuss This Question: 4  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Raydream
    First, you must sure your OS version. It is not supported OSPF2000 in V5R1.
    0 pointsBadges:
    report
  • astradyne
    Sorry, Raydream, but format OSPF0200 is available in release v5r1 - at least according to the API documentation at http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/apis/qgyolspl.htm However, irrespective of the version that OSPF0200 is available in, the filter passed to the API cannot make use of a date range. The only way to apply a date range to the results is within the program when it is processing the results. All the best Jonathan
    370 pointsBadges:
    report
  • Raydream
    You can find the member "QGYOLSPL" in the source file "QSYSINC/H", and search the declaration of QGYOLSPL. You will find the parameter of QGYOLSPL is only 9, not 10. You can find the different in V5R2.
    0 pointsBadges:
    report
  • TomLiotta
    You will find the parameter of QGYOLSPL is only 9, not 10.
    Note that the QSYSINC members are not official documentation. The presence or absence in those members does not indicate if a parameter is available or not. Don't rely on them. Only use them as the basis for creating your own copies. And modify your copies to match the official documentation. In other words, your QSYSINC member is wrong. Tom
    125,585 pointsBadges:
    report

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following