ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

API QUSLSPL and Qualified Job Name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • API QUSLSPL and Qualified Job Name

    I have used the QUSLSPL API for listing spool files using the output queue parameter and user name parameter with no issues. This is for format SPLF0300. I now need to use the optional parameter of the qualified job name. I want to return all the spool files for a specific job name. I keep getting errors with it. My data structure looks this:

    ================================================== ========
    D QUSLSPL PR extpgm('QUSLSPL')
    ?* required parameters
    D UsrSpc 20A const
    D Format 8A const
    D UserName 10A const
    D QualOutQ 20A const
    D FormType 10A const
    D UserData 10A const
    ?* optional group 1:
    D ErrorCode 32766A options(*nopass: *varsize)
    ?* optional group 2:
    D QualJob 26A options(*nopass) const
    D FieldKeys 10I 0 options(*nopass: *varsize)
    D dim(9999)
    D NumFields 10I 0 options(*nopass) const
    ?* optional group 3:
    D AuxStgPool 10I 0 options(*nopass) const
    ?* optional group 4:
    D JobSysName 8A options(*nopass) const
    D StartCrtDate 7A options(*nopass) const
    D StartCrtTime 6A options(*nopass) const
    D EndCrtDate 7A options(*nopass) const
    D EndCrtTime 6A options(*nopass) const

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

    When I try to just include the qualified job name parameter into my call I get a number of parameters not valid error. If I include the field keys and number of fields then I get a number of fields not valid error. I don't want any key fields, I just want the list to return the spool files for the specific job in spool file number order as the API documentation says it will. Here is my call without the key field and number of fields parameters:

    quslspl(myspace:
    'SPLF0300':
    '*ALL':
    '*ALL':
    '*ALL':
    '*ALL':
    ApiError:
    qual_job);


    This give me a hard error and stops the program. If I include the field keys and number of field parameters I don't get the hard error but do get CPF34C0 returned to the error parameter:

    quslspl(myspace:
    'SPLF0300':
    '*ALL':
    '*ALL':
    '*ALL':
    '*ALL':
    ApiError:
    qual_job:
    spl_keyfld:
    spl_key#);

    I've tried all kind of combinations in the key parameters from a valid key field (205) with number of fields = 1 to zero in each. Just cannot get it out of an error condition.

    What am I missing here? And sorry but I cannot for the life of me remember how to embed code here.

    Thanks in advance!!!!

  • #2
    The documentation http://www.ibm.com/support/knowledge...is/QUSLSPL.htm says that with format SPLF0300, Number of Fields to Return must be 0, and that if the number is 0, the Keys parameter is ignored.

    When I'm working on a new API call, I find it much easier to debug if I put 0 in the first bytes-provided subfield of the error code. That way, the error message goes in the joblog, which makes it easier to see everything in the message. Once I have it working, I change the error-code parameter back.

    (To embed code, select the code and then click on the # sign.)

    Comment


    • #3
      Hey Barbara! I tried using number of key fields equal to zero with my qualified job name but still get the CPF34C2 error. I'm not sure what is going wrong. My qualified job name is job name, job user, and job number in that order. It looks fine in debug. I'll keep plugging.

      Comment


      • #4
        Never mind. I got it. If the qualified job name is used then the user name, the qualified output queue name, the form type, and user-specified data parameters must be blank. I thought I had done that but must have had other parameters messed up when trying it like that.

        Bottom line is I have it working now.

        quslspl(myspace:
        'SPLF0300':
        ' ':
        ' ':
        ' ':
        ' ':
        ApiError:
        qual_job:
        spl_keyfld:
        spl_key#);

        Comment

        Working...
        X