QSPOLJBQ – API

pts.
Tags:
Application development
AS/400
DataCenter
RPGLE
Web development
I am using QSPOLJBQ (open list of job queues) API to generate a list of all job queues on the system. Need help to use this API.. All I get is "Receiver value too small to hold result." (MCH1210). But the help is not enough to resolve. I tried changing the parameters in many ways. Still I end up getting this error. Anyone used this API.. PLEASE HELP Thanks

Answer Wiki

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

Jonathan provides excellent help below. The answer to your problem isn’t quite the same though. Unfortunately no one can tell you what you’re doing wrong because you haven’t shown us what you’re doing. All you tell us is that you get an error. We already know that because you wouldn’t be asking questions if everything was working well.

Show us how you define the prototype or the parm list, and show us how your call statement looks. If you show us the code that has the problem, we might be able to explain why the problem shows up.

Tom

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

Hi

The message you are getting is telling you that you are trying to receive too much data from the API than you have allowed for. For example, you might have defined a data structure to receive the job queue information, and then told the API that you want to receive 2 or more records into the data structure.

The way I code for this is to tell the API to return one record at a time, in most of the applications I’ve seen saving the odd nano-second by returning more than one record really matters.

The following example generates a list of all job queues in QGPL and then displays them on the screen.

D* Open List of Job Queues (QSPOLJBQ) API Prototype
D OpnLstJobQ Pr ExtPgm(‘QSPOLJBQ’)
D oRcvVar Like(OJBQ0100)
D iRcvVarLen 10i 0
D iRcvVarFmt 8a
D oListInfo 80a
D iFilter Like(Filter)
D iSort Like(Sort)
D iNbrRecs 10i 0
D iAPIError Like(APIError)

D* Get List Entries (QGYGTLE) API Prototype
D GetListEntries Pr ExtPgm(‘QGYGTLE’)
D oRcvVar Like(OJBQ0100)
D iRcvVarLen 10i 0
D iRqsHandle 4a
D oListInfo 80a
D iNbrRecs 10i 0
D iStartRec 10i 0
D oAPIError Like(APIError)

D* Close List (QGYCLST) API Prototype
D CloseList Pr ExtPgm(‘QGYCLST’)
D iRqsHandle 4a
D oAPIError Like(APIError)

D* Format of Open List Information
D ListInfo Ds
D TotalRecs 10i 0
D RecsRtn 10i 0
D ReqsHandle 4a
D RecLen 10i 0
D Complete 1a
D Timestamp 13a
D ListStatus 1a
D 1a
D InfoLen 10i 0
D FirstRec 10i 0
D 40a

D* Format of Filter for API Call
D Filter Ds
D FilterLen 10i 0 Inz(%Len(Filter))
D Jobq 10a
D JobqLib 10a
D ActSubSys 10a
D 1a Inz(x’00′)

D* Format of Sort for API Call
D Sort Ds
D NbrKeys 10i 0 Inz(0)
D KeyStartPos 10i 0 Inz(0)
D KeyLen 10i 0 Inz(0)
D KeyType 5i 0 Inz(x’00′)
D SortOrder 1a Inz(x’00′)
D 1a Inz(x’00′)

D* Format of Receiver Variable for API Call
D OJBQ0100 Ds
D oJobq 10a
D oJobqLib 10a
D oJobqSts 1a
D oSbsName 10a
D oSbsLib 10a
D 3a
D oNbrJobs 10i 0
D oSeqNbr 10i 0
D oMaxAct 10i 0
D oCurAct 10i 0
D oDesc 50a

D* Standard API Error Data Structure
D ApiError DS
D ApiBytes 10I 0 Inz(%Size(ApiError))
D ApiBytesOut 10I 0
D ApiErrID 7A
D ApiReserved 1A
D ApiErInDta 256A

D* Work fields
D wRecNo s 10i 0 Inz(*Zeros)
D wRcvVarLen s 10i 0 Inz(%Len(OJBQ0100))
D wRcvVarFmt s 8a Inz(‘OJBQ0100′)
D wNbrRecs s 10i 0 Inz(1)
D wReply s 1a Inz(*Blanks)

C* Prepare the Filter data structure to retrieve the job queues we want…
C Eval Jobq = ‘*ALL’
C Eval JobqLib = ‘QGPL’
C Eval ActSubSys = *Blanks

C* Call the API to build the list…
C CallP OpnLstJobq(OJBQ0100 : wRcvVarLen :
C wRcvVarFmt : ListInfo : Filter : Sort :
C wNbrRecs : APIError)

C* Once the list has been created we can read through it using the
C* GetListEntry (QGYGTLE) API…

C* Read through all records in the list…
C For wRecNo = 1 to TotalRecs

C* Call the API to read an entry from the list…
C CallP GetListEntries(OJBQ0100 : wRcvVarLen :
C ReqsHandle : ListInfo : wNbrRecs : wRecNo :
C APIError)

C* Display the name of the job queue and get the next record…
C oJobq Dsply
C EndFor

C ‘*Finished*’ Dsply wReply

C* Finally close the list and exit the program…
C CallP CloseList(ReqsHandle : APIError)

C Eval *InLR = *On
C Return

Hope it helps

All the best

Jonathan

Discuss This Question:  

 
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

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