API QUSRJOI DCL PARM values?

30 pts.
Tags:
AS/400
JOBRCVR
What is the DCL value for JOBRCVR?
1

Answer Wiki

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

qusrjobi 

declare value for &jobrcvr 
I want to retrieve the status of the job on the system 
example code shows %subst(&jobrcvr 51 10)

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.
  • ChesterD

    qusrjobi 

    declare value for &jobrcvr 
    I want to retrieve the status of the job on the system 
    example code shows %subst(&jobrcvr 51 10)

    30 pointsBadges:
    report
  • bvining

    In order to know how to declare &JobRcvr you need first to look at the documentation associated with the Retrieve Job Information (QUSRJOBI) API. This documentation can be found here.

     

    Assuming you are using format JOBI0100 then, for complete information, you would declare the length as 86 bytes (the starting location of the last field -- Purge -- plus the length of Purge). The following sample program shows how to then substring out the Job Status information which is documented to have a starting position 51 for a length of 10 bytes.

     

    Pgm                                                                  
    Dcl        Var(&JobRcvr)    Type(*Char) Len(86)                      
    Dcl        Var(&LenJobRcvr) Type(*Int)  Value(86)                    
    Dcl        Var(&JobSts)     Type(*Char) Len(10)                      
    Call       Pgm(QUSRJOBI) Parm(&JobRcvr &LenJobRcvr JOBI0100 * ' ')   
    ChgVar     Var(&JobSts) Value(%substring(&JobRcvr 51 10))            
    SndPgmMsg  Msg(&JobSts) ToPgmQ(*Ext)                                 
    EndPgm                                             
     
    I however would tend to not use the %substring 
    approach. I would instead use this:
     
    Pgm                                                                
    Dcl        Var(&JobRcvr)    Type(*Char) Len(86)                    
      Dcl        Var(&JobSts)     Type(*Char) Len(10) +                
                   Stg(*Defined) DefVar(&JobRcvr 51)                   
    Dcl        Var(&LenJobRcvr) Type(*Int)  Value(86)                  
    Call       Pgm(QUSRJOBI) Parm(&JobRcvr &LenJobRcvr JOBI0100 * ' ') 
    SndPgmMsg  Msg(&JobSts) ToPgmQ(*Ext)                               
    EndPgm                                                             
    Using *Defined storage you eliminate the need for
    the %substring operation (runs faster) and you 
    avoid the duplicate storage allocation of 10 bytes
    for Job Status in &JobRcvr and &JobSts (less space).
     
    Bruce Vining
     
    7,070 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.

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

Following

Share this item with your network: