Job In Msg Wait

From MidrangeWiki
Revision as of 16:57, 14 December 2018 by DaveLClarkI (talk | contribs) (Created page with "Category:Sample Code Category:Service Procedures __FORCETOC__ == Summary == The following are the RPG/LE fully free-form definitions and instructions needed for using...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

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