29 Working with Subsystem Jobs

This chapter contains the following topics:

29.1 Understanding Subsystem Jobs

Within Oracle's JD Edwards EnterpriseOne, subsystem jobs are batch processes that continually run independent of, but asynchronously with, JD Edwards EnterpriseOne applications. These subsystem jobs function with the system's logical process or queue defined for the server platform. You can configure JD Edwards EnterpriseOne to use one or more subsystems.

Use subsystem jobs to:

  • Off-load processor resources.

  • Protect server processes.

  • Perform repetitive and frequent processes to maximize output throughput.

Examples of applications that are suited for subsystem processing include:

  • Logistics Warehousing

  • Inventory

  • Sales Order Processing

For example, you can execute the Sales Order Entry application on a workstation and automatically print pick slips when all orders are entered. If you are using a version of pick slips that has the subsystem job function enabled, the pick slip request is routed to and processed by the subsystem job on the defined enterprise server. As a result, no additional processing resources are required of the workstation.

When a JD Edwards EnterpriseOne application issues a request for a job to run as a subsystem job, it places a record in the Subsystem Job Master (F986113) table. This record is identified by a subsystem job name and version, and contains status and operational indicators. Embedded in the record is key information that enables the subsystem to process the record without additional interaction with the requesting application. Key information includes the values for the processing options and the values for the report interconnect data structure. The continuously running subsystem monitors this table for records. If the subsystem finds a record with the appropriate status indicators for the specific report and version being run, it processes the record and updates the status accordingly.

This diagram illustrates how the system processes a subsystem job:

Figure 29-1 Subsystem processing

Description of Figure 29-1 follows
Description of "Figure 29-1 Subsystem processing"

29.2 Defining Subsystem Jobs

This section provides overviews of subsystem job definitions and the process of adding records to the subsystem table using an API, lists the prerequisites, and discusses how to:

  • Define reports as subsystem jobs.

  • Add records to the subsystem table.

29.2.1 Understanding Subsystem Job Definitions

Subsystem jobs are jobs that continuously process records from a data queue. This type of job runs until you request termination.

The tasks performed by subsystem jobs are:

  • Reading records one at a time from a subsystem table.

  • Retrieving information for the specific record.

  • Running the batch engine for each record.

You run a subsystem job in the same way that you run a regular batch job; no difference exists between running a subsystem job and running a batch job. Before processing, the system ensures that limits for the subsystem job on the defined server have not been exceeded. If exceeded, the batch engine does not process the subsystem job. At the end of the records, instead of ending the job, subsystem jobs sleep for a defined period and then retrieve the information for the next record. For each subsystem job, multiple records can exist in the subsystem table.

29.2.2 Understanding the Process of Adding Records to the Subsystem Table Using an API

You can use an API to add records to the subsystem table to enable the subsystem job to perform batch processes. To add records to the subsystem table:

  1. Create a business function using Microsoft Visual C++.

  2. In Oracle's JD Edwards EnterpriseOne Report Design Aid (RDA), create a report data structure in the report template.

    Add the appropriate data items to the report data structure.

  3. Generate a header file in the report template.

    The header file takes the form of Report_Name.h and is located in the $environ\include subdirectory under the folder.

    E812

    This example illustrates the subsystem job header file:

    #include <jde.h>
    /************************************************************
     Report : R98SSUBE * ReportId : 8123244 * DSTRId : 380813 *
    * Note: * Do not edit the following typedef
    * To make modifications, use the Report Design Aid Tool to
     Generate a revised version.
    *************************************************************/
    #ifndef REPORT_DS_380813 #define REPORT_DS_380813
    typedef struct tagDS_RI_380813 { char       
    ProgramId[11]; } DSRI380813, *LPDSRI380813;
    #define IDERRProgramId_1         1L
    #endif /* #define REPORT_DS_380813*/
    #endif /* #define_R98SSUBE_H */
    
  4. Add the header file to the business function using Microsoft Visual C++.

  5. In the program to be called, call the business function using the appropriate event in Event Rules Design.

For example, you can create event rules that call a business function when the user clicks OK in the Oracle's JD Edwards EnterpriseOne Sales Order Entry (P4210) application. The business function uses the report's data structure and the subsystem's APIs to trigger the subsystem report. The API record retrieves the data structure and user information from the cache. If the server name is not passed, the API finds Object Map Record from the Data Source Master (F98611) table. If the record exists, it uses the record to send a JDENet Message to the server's subsystem kernel to add the record to the subsystem table on the server. However, if the user provides an override server name, the JDENet message is sent to that server's subsystem kernel instead. Each server is allowed to have only one subsystem kernel running.

29.2.3 Prerequisites

Before you begin defining subsystem jobs, ensure that you:

  • Create a batch application object.

  • Complete the design of the report template.

  • Create a data structure, including the appropriate data items, for use in the business function.

29.2.4 Defining Reports as Subsystem Jobs

Open the report template in RDA.

  1. From the File menu, select Report Data Structure.

  2. On the Report Data Structure form, enter a data item alias on the QBE line to display the required data item.

  3. From Dictionary Items, drag the required data item over to Structure Members and click OK.

  4. From the File menu, select Report Properties.

  5. On the Properties form, select the Advanced tab and select the Subsystem option.

  6. Enter an appropriate value in the Wait Time (ms) field.

    The value in the Wait Time field is entered in milliseconds (1000 milliseconds equals one second). This represents the time that the subsystem job sleeps until checking the subsystem file for new records to process.

  7. Click the Generate button to create a header file.

29.2.5 Adding Records to the Subsystem Table

Add a business function object in Oracle's JD Edwards EnterpriseOne Object Management Workbench.

  1. On the Business Function Design form, select the Design Tools tab and click Start Business Function Design Aid.

  2. Complete the function name and description and then attach the appropriate data structure.

  3. In Microsoft Visual C++, open the business function include (.h) file and add the name of the header file that you generated.

    For example, the header file statement is emphasize in this business function include (.h) file:

    /***************************************************************************
     Table Header Inclusions
    ****************************************************************************/
    
    /***************************************************************************/
    External Business Function Header Inclusions
    ****************************************************************************/
    #include <R98SSUBE.h>
    /***************************************************************************
     Global Definitions
    ****************************************************************************/
    
    /***************************************************************************
    * Structure Definitions
    ****************************************************************************/
    * TYPEDEF for Data Structure
    * Template Name:  Report Interconnect Data Structure
    * Template ID:   D983059
    * Generated:   Wed Oct 18 14:01:22 1995
    
  4. In Microsoft Visual C++, open the business function source (.c) file and add lines to declare the variable of this data structure type and populate the members of the data structure.

    For example, the variable declaration for the report interconnect data structure is emphasize in this business function source (.c) file:

    #include <jde.h>
    /****************************************************************************
    * Variable declarations
    *****************************************************************************/
    HUSER hUser=NULL;
    LPSTR szServer=NULL;
    DSRI380813 dsRI;
    /* Declare the variable of type REPORT INTERCONNECT DATA STRUCTURE */
    BOOL bRet= FALSE;
    JDEDB_RESULT rcode;
    /****************************************************************************
    Declare structures
    *****************************************************************************/
    
    /****************************************************************************
    Declare pointers
    *****************************************************************************/
    
    /****************************************************************************
    Check for NULL pointers
    *****************************************************************************/
    if ((lpBhvrCom == NULL) ||
      (lpVoid == NULL)  ||
      (lpDS == NULL))
    
  5. In the business function source (.c) file, call the API to add the record to the subsystem table.

    For example, the API call to add the record to the subsystem table is emphasize in this business function source (.c) file:

    *****************************************************************************
    Main Processing
    *****************************************************************************/
    memset(&dsRI, 0, sizeof(DSRI380813));
    /* Populate the members of the Report Interconnect Data Structure */
     strcpy(dsRI.ProgramId,lpDS->szString01);
    /* Call Subsystem API to add the record to the Subsystem Table */
    /* Note : As Environment Name is set to NULL, this API will use OCM to find the⇒
     default
    Environment of this UBE */
    bRet=ubeReport_AddSubsystemRecord( hUser,/* User Handle */
       "R98SSUBE", /* Name of the subsystem */
       "XJDEOOO1", /* Name of the Subsystem Version*/
       NULL, /* Name of the override env - not used */
       szServer,  /* Name of the server */
     &dsRI);   /* Subsystem Connect DS */
    /**************************************************************************/
    
  6. After you call the ubeReport_AddSubsystemRecord API to attach the record, build the business function.

  7. Call the business function from the event rules process of the program to be called. This program can be either an interactive or batch application.