Job Not Active

From MidrangeWiki
Jump to: navigation, search


Summary

The following are the RPG/LE fully free-form definitions and instructions needed for using the Job Not Active service procedure. This service procedure simply allows the caller to make sure that a particular job is not active on the system.

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

//******************************************************************************
// Simply reverses the result of the 'Job Is Active' service procedure.
//******************************************************************************
dcl-pr GenUtl_JobNotActive   ind;
  JobName                    char(10)  const;
  ListPtr                    pointer            options(*nopass:*omit);
  JobDesc                    likeds(QUSL010002) 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);

//******************************************************************************
// Simply reverses the result of the 'Job Is Active' service procedure.
//******************************************************************************
dcl-proc GenUtl_JobNotActive export;
  dcl-pi *n                  ind;
    JobName                  char(10)  const;
    ListPtr                  pointer            options(*nopass:*omit);
    JobDesc                  likeds(QUSL010002) options(*nopass);
  end-pi;

  select;                              // determine how called
    when %parms() < %parmnum(ListPtr)
    or   %parms() = %parmnum(ListPtr)
    and  %addr(ListPtr) = *null;
      return (not GenUtl_JobIsActive(JobName));
    when %parms() < %parmnum(JobDesc);
      return (not GenUtl_JobIsActive(JobName: ListPtr));
    when %addr(ListPtr) = *null;
      return (not GenUtl_JobIsActive(JobName: *omit: JobDesc));
  endsl;

  return (not GenUtl_JobIsActive(JobName: ListPtr: JobDesc));
end-proc;

References