MAC-PAC Homecontact ussupport login 
Documentation > MAC-PAC Reference Library > Reference > Common Features > Key Concepts and Procedures > Creating a BPM Extract Program or Query > Creating an Extract Program

Creating an Extract Program

  

 

Extracts for events with extract types of program actually consist of two programs:  a CL program and an RPG program.  Eight sample RPG extract programs (with nine CL programs) have been provided with the software.  See the Sample BPM Extract Programs section for information about these samples.

CL Program

Input parameters:

      Event type
Last extract date
Last extract time

The processing flow for CL extract programs is as follows:

A.   Allocate *SHRRD the input files to the extract program.  The workfile is already allocated *SHRUPD by the Business Process Manager (BPM) Asynchronous Monitor (BPMASYCMON).

B.   Call the RPG extract program.

The calling CL program name should be specified as the extract program on the Event Maintenance Detail screen.

RPG Program

Input parameters:

      Event type
Last extract date
Last extract time

The flow for RPG extract programs is as follows:

A.   Read in a loop the driving extract input file.

B.   Determine if the record read should be extracted.  This consists, at a minimum, of determining if the record indicates that the event has occurred.  For example, the extract for the overdue purchase order lines event type would check if the balance due quantity for the purchase order line is greater than zero and if the due date for the line is the current date or earlier.

      You may want to include other logic to limit the number of records extracted.  For example, you might only extract information that has occurred since the date and time of the last extract.  See the AP Matched Invoices with Quantity/Price Variances extract program (CF925E) for an example of this processing.

      Also, you can use the 40-character detail information field in the logical Extracted Event Master File by Event (CF201ML1) to determine if a particular record has already been extracted.  This will help limit the number of records extracted.  See the  sample extract Overdue Purchase Orders program (CF900E) for an example of this logic.

      If reading records from a large file, you can also define a minimum amount for the control value to limit the number of records extracted.

C.   If the record should be extracted, format the necessary extract record fields on the Extracted Data Workfile (accessing related files as necessary) and write the record.

D.   Read the next record on the driving input file.

Testing Your Extract Program

Once you have created your extract program, you should test it to make certain it extracts the proper information.  Follow these steps to test your extract:

A.   Make a copy of the Extracted Data Workfile (CF201AP1) in your own library and set up your library list so that the extract program outputs to the Extracted Data Workfile in your library.  Otherwise, if the BPM Asynchronous Monitor is running, it may pick up the output file.

B.   Call or submit the calling CL of the extract program.  Check the Extracted Data Workfile to verify the formatting of the fields and that the appropriate records were selected.