Difference between revisions of "Job Is Active"

From MidrangeWiki
Jump to: navigation, search
(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...")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:RPG Examples]]
 
[[Category:Sample Code]]
 
[[Category:Sample Code]]
 
[[Category:Service Procedures]]
 
[[Category:Service Procedures]]
Line 4: Line 5:
 
== Summary ==
 
== Summary ==
 
The following are the RPG/LE fully free-form definitions and instructions needed for using the {{AN}} service procedure.  This service procedure simply allows the caller to check if a particular job is active on the system—or not.
 
The following are the RPG/LE fully free-form definitions and instructions needed for using the {{AN}} service procedure.  This service procedure simply allows the caller to check if a particular job is active on the system—or not.
 +
 +
By [[User:DaveLClarkI|Dave Clark]]
  
 
== Service Prototype ==
 
== Service Prototype ==
Line 11: Line 14:
  
 
//******************************************************************************
 
//******************************************************************************
// Determines if a specific job name is active on the system.  For performance
+
// Determines if a specific job name is active on the system.  This procedure
// reasons, the GenUtl_GetJobList() procedure may be used to obtain a generic
+
// can be used by itself.  But, for improved performance, the GenUtl_GetJobList
// list of job names which this service procedure will search by supplying the
+
// procedure may be pre-called to obtain a generic list of job names which this
// space pointer which was returned by the GenUtl_GetJobList() procedure.
+
// service procedure can then search repeatedly by supplying the space pointer
 +
// which was returned by that procedure.  When finished with the list, or if a
 +
// new (or fresh) list is needed, call that procedure again to release the list.  
 
//******************************************************************************
 
//******************************************************************************
 
dcl-pr GenUtl_JobIsActive    ind;
 
dcl-pr GenUtl_JobIsActive    ind;
Line 31: Line 36:
  
 
//******************************************************************************
 
//******************************************************************************
// Determines if a specific job name is active on the system.  For performance
+
// Determines if a specific job name is active on the system.  This procedure
// reasons, the GenUtl_GetJobList() procedure may be used to obtain a generic
+
// can be used by itself.  But, for improved performance, the GenUtl_GetJobList
// list of job names which this service procedure will search by supplying the
+
// procedure may be pre-called to obtain a generic list of job names which this
// space pointer which was returned by the GenUtl_GetJobList() procedure.
+
// service procedure can then search repeatedly by supplying the space pointer
 +
// which was returned by that procedure.  When finished with the list, or if a
 +
// new (or fresh) list is needed, call that procedure again to release the list.  
 
//******************************************************************************
 
//******************************************************************************
 
dcl-proc GenUtl_JobIsActive  export;
 
dcl-proc GenUtl_JobIsActive  export;

Latest revision as of 19:55, 26 December 2018


Summary

The following are the RPG/LE fully free-form definitions and instructions needed for using the Job Is Active service procedure. This service procedure simply allows the caller to check if a particular job is active 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 specific job name is active on the system.  This procedure
// can be used by itself.  But, for improved performance, the GenUtl_GetJobList
// procedure may be pre-called to obtain a generic list of job names which this
// service procedure can then search repeatedly by supplying the space pointer
// which was returned by that procedure.  When finished with the list, or if a
// new (or fresh) list is needed, call that procedure again to release the list. 
//******************************************************************************
dcl-pr GenUtl_JobIsActive    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);

//******************************************************************************
// Determines if a specific job name is active on the system.  This procedure
// can be used by itself.  But, for improved performance, the GenUtl_GetJobList
// procedure may be pre-called to obtain a generic list of job names which this
// service procedure can then search repeatedly by supplying the space pointer
// which was returned by that procedure.  When finished with the list, or if a
// new (or fresh) list is needed, call that procedure again to release the list. 
//******************************************************************************
dcl-proc GenUtl_JobIsActive  export;
  dcl-pi *n                  ind;
    JobName                  char(10)  const;
    ListPtr                  pointer            options(*nopass:*omit);
    JobDesc                  likeds(QUSL010002) options(*nopass);
  end-pi;

  dcl-s JobIdx               packed(5:0);
  dcl-s JobPtr               pointer;

  if %parms() > %parmnum(JobName)      // if space pointer passed
  and %addr(ListPtr) <> *null;         // and was not omitted
    JobPtr = ListPtr;                  // use it
  else;                                // else, get a job list
    if GenUtl_GetJobList(JobName: 10: PROC_NAME: JobPtr) = *zero;
      callp GenUtl_GetJobList('*RESET': 10: PROC_NAME: JobPtr);
      return *off;                     // return if job not found
    endif;
  endif;

  GenUtl_JobL_Gen_Ptr = JobPtr + 0;    // map space header areas
  GenUtl_JobL_Inp_Ptr = JobPtr + GenUtl_JobL_Gen_DS.QUSOIP;
  GenUtl_JobL_Hdr_Ptr = JobPtr + GenUtl_JobL_Gen_DS.QUSOHS;
  GenUtl_JobL_Lst_Ptr = JobPtr + GenUtl_JobL_Gen_DS.QUSOLD;

  JobIdx = %lookup( JobName: GenUtl_JobL_Lst_DS.JobL_JobName
                  : 1: GenUtl_JobL_Gen_DS.QUSNBRLE ); // search list

  if JobIdx <> *zero                   // if job name found in list
  and %parms() > %parmnum(ListPtr);    // and job description requested
    JobDesc = GenUtl_JobL_Lst_DS.JobL_Entry(JobIdx); // pass it back
  endif;

  if %parms() < %parmnum(ListPtr)      // if space pointer not passed
  or %addr(ListPtr) = *null;           // or was omitted, reset new list
    callp GenUtl_GetJobList('*RESET': 10: PROC_NAME: JobPtr);
  endif;

  return (JobIdx <> *zero);            // indicate if job was found
end-proc;

References