Job In Msg Wait

From MidrangeWiki
Revision as of 16:02, 17 December 2018 by DaveLClarkI (talk | contribs) (Summary)
Jump to: navigation, search


Summary

The following are the RPG/LE fully free-form definitions and instructions needed for using the Job In Msg Wait service procedure. This service procedure simply allows the caller to determine if a particular job is in a message wait on the system—or not.

By Dave Clark

Service Prototype

Place the following in a separate copybook for inclusion in both the caller and the service program source members.

**free

//******************************************************************************
// Determines if a specified job name is in a message wait status on the
// system.  Optionally, returns all job information.
//******************************************************************************
dcl-pr GenUtl_JobInMsgWait   ind;
  pJobName                   char(26);
  pJobInfo                   likeds(QUSI020000)  options(*nopass);
end-pr;

Service Procedure

Place the following in a service program source member.

**free
ctl-opt NoMain AlwNull(*UsrCtl) Debug Option(*SrcStmt:*NoDebugIo)
        DatFmt(*ISO) TimFmt(*ISO);

//******************************************************************************
// Determines if a specified job name is in a message wait status on the
// system.  Optionally, returns all job information.
//******************************************************************************
dcl-proc GenUtl_JobInMsgWait export;
  dcl-pi *n                  ind;
    pJobName                 char(26);
    pJobInfo                 likeds(QUSI020000)  options(*nopass);
  end-pi;

  callp IBMAPI_RtvJobInfo( QUSI020000: %len(QUSI020000): 'JOBI0200'
                         : pJobName: *blank: ApiErrC );
  if ApiErrC.BytAvail > *zero;         // if an error occurred
    %subst(pJobName:1:20) = '*ERROR    ' + ApiErrC.MsgId;
    return *on;                        // indicate an error
  endif;

  if %parms() > %parmnum(pJobName);    // if job information requested
    pJobInfo = QUSI020000;             // pass it back
  endif;

  return (QUSAJS = 'MSGW');            // indicate msg wait status
end-proc;

References