PeopleSoft Application Engine

Application Engine is a peopletools used for BATCH or ONLINE processing where you have a large (or small) amount of data that needs to be processed without user intervention. It performs HIGH VOLUME BACK GROUND PROCESSING against your data.

An AE program is a set of SQL statements, People Code, and Program Control Actions defined in Application Designer that performs a business process.

 Application Engine programs reside completely within your database.

 No Compilation required.

 Database Flexibility.

 Does not generate SQL or PeopleCode.

 Built in Re-Start Logic.

 Mostly used for SET based processing.

 PeopleCode can be written.

 AE program can be called from People Code.

-A Step represents the smallest unit of work that can be committed in a program.

-When you first create a program, you have a default MAIN Section and Step, initially named Step01.

-All programs require at least one Section, all Sections should contain at least one Step, and all Steps should contain at least one Action.

Section Properties.

 Section Type : Critical Update & Prepare Only

In the case of an abnormal termination of the program, the value of this system field specifies whether or not you will need to Restart the Section.

If a Section controls a procedure that, if not run to completion, could corrupt or desynchronize your data, choose Critical Updates.
Otherwise, use the default value of Prepare Only.

 Execution Precedence
If a Section for the current Market exists, execute it.
If a Section for the current Platform, or RDBMS, exists, execute it.
If a Section for the current Effective Date exists, execute it.


AE step properties

Commit
• Default , After Step , Later

 Default. You can opt to select Default, which means the Step will inherit what ever Commit level you have specified for the Section in which the Step resides.

 Later. By selecting Later, you postpone the commit until a subsequent Commit occurs, as specified by developers. Again, here you can override the Section-level commit, if it happened to be set to After Step.

 After Step. Selecting After Step is useful if you have a Commit level of None specified at the Section level. This way, you can override the Section-level commit, and commit a specific Step within a Section with no other commits.
-Frequency

 Blank default (any number can be added)

 The Frequency control only becomes enabled when a Step contains one of the following Actions: Do While, Do Select, or Do Until. This control will only accept numeric values. The value indicates the frequency of the rows with which Application Engine should commit.

 If non-zero, Application Engine commits every N iterations, and then again after the last iteration.

-Action

 Contains all the code of Application Engine Program

 There are eight types of Actions that you can include within a Step, and a Step can contain multiple Actions.

 You can only include one of each Action type within a single Step.

 The only mutually exclusive Actions within a single Step are Call Section and SQL Statement


Action execution hierarchy

Program Flow Actions

• Program Flow Actions are used to control the execution of your program. With these Action types you can control the execution of subsequent Sections, Action(s), or SQL statements depending on the results of a "Do" SQL statement in the form of a SELECT.

Below are the four types of Program Flow Actions
 Do When
 Do While
 Do Select
 Do Until

DO When

• The DO When Action is a SELECT statement that allows subsequent actions to be executed if any rows of data are returned.

• This Action is similar to a COBOL "IF" statement.

• A DO When statement runs before any other actions in the Step.

• If the DO When statement returns any rows, the next Action will be executed. If the Do When conditions are not met, the remaining Actions within that Step are not executed.

• Your program executes a DO When Action only once when the owning Step executes.

Configurable Properties

1. RE-USE Statement :
Selecting this means the database engine only needs to compile the SQL once, which reduces
SQL overhead.

Options
 Bulk Insert. Holds all the data in a buffer and only performs an insert after a large volume of rows has gathered in the buffer.

 No. Select this option to disable ReUse. With ReUse off, the Application Engine runtime process recompiles the SQL statement every time the loop executes. By default, ReUse will be disabled.

 Yes. Select this option to enable basic ReUse functionality.


-DO While

 The Do While is identical to the COBOL "WHILE" function. In other words, the subsequent Actions within the Step are executed in a loop as long as at least one row is returned by the SELECT statement for the DO While Action.

-Do Select

 The DO Select Action is a SELECT statement that executes subsequent Actions once for every row of data that the Do Select returns.

 DO Select can execute a SQL statement for each row returned from the SELECT statement. The subsequent Actions within the Step are executed in a loop based on the results of the SELECT statement.


Do Select Type

 Select/Fetch. Performs a Fetch for each iteration of the loop to get each row from the SELECT. When a FETCH results in an "end of table", the looping is complete. It cannot be restarted.

 Re-Select. It opens a cursor and fetches the first row. This means that, with Re-Select, your program processes the "first row" returned from the Select statement. Cursor gets re-opened for each iteration of the loop.

 Restartable. This option is similar to the Select/Fetch in that Application Engine opens the cursor associated with the DO Select once, and then it performs a Fetch on each iteration of the loop to get each row from the SELECT. It can be Restarted.


Do Until

 Use a Do Until if you want the "processing actions" to execute at least once, and to execute over and over until a certain condition is true, such as until a SELECT returns some rows.


Peoplecode in AE

• PeopleCode Actions allow you to take advantage of IF-THEN logic, messaging, File Layouts, Component Interface and various other features all from within your Application Engine programs.

Call section

• Use the Call Section Action to Call Another Section defined in an Application Engine program.

• You can call a (local) Section defined within your current program, otherwise Section MAIN would be the only Section executed.

• Also you can make external calls to a Section defined in another Application Engine program.

• The external Section you intend to call must have its Access property set to Public.

• If a Section's Access property is set to Private, that Section can only be called from within the same program.

• Call Section is the only supported way to call Application Engine programs or Sections from other Application Engine programs or Sections.

Dynamic: When issuing a dynamic call, both the section and the Program ID must be dynamically set. You enable a dynamic call by first having your program store different section names in the AE_SECTION field, and different program names in AE_APPLID field. These two fields must be defined on the default state record of the program. The values you insert in these fields are normally based on various conditions met within your program. You then create a Call Section action that calls the section name defined in the State record field by selecting the Dynamic check box.

If AE_APPLID is not present or is blank (at run time), the current program is substituted for the AE_APPLID value. If AE_SECTION is not present or is blank, an error occurs.


State Record:

 The Application Engine State Record is the method by which you allocate variables for your Application Engine program.

 It is also the method by which Section, Steps, and Actions pass values to subsequent program steps.

 You can think of State Records in Application Engine as global variables without scope limiting rules.

 Only one record can be the default State Record

 Record Types as SQL and Derived/Work Records

 Process Instance is the key Field and the only Key Field is used for maintaining session

 Notice the _AET naming convention

 When a program starts, it INSERTS a row into the State Record that corresponds to the Process Instance assigned to that program run. Application Engine updates the record whenever a COMMIT occurs. When Restart is enabled and a commit occurs, all State Records that have been updated in memory will be written to the database, except for derived State Records, which are instead initialized.
 Then, after the program completes successfully, Application Engine deletes the corresponding row in the State Record. There is only one row in the State Record for each Process Instance, or program. Multiple programs can use the same State Record, and each program has it's own row based on the unique Process Instance key.
o To set values in the State Record, you use the %SELECT construct in a SQL statement or write PeopleCode that references the State Field with the standard "record.field" notation.
o To reference fields in the State Record you use the %BIND construct.

Temporary tables:

 PeopleSoft batch applications employ the technique of SET processing, and set processing (in most cases) involves extensive use of temporary tables.

 Temp Tables are used to store transient or intermediate results

 Improve performance for e.g. if you find that multiple times during a run of program access a small set of rows from a much larger table , you can insert the necessary rows into a temp table as as initialization task .

 Any Program can access temporary tables.

 When AE “manages ” a dedicated temp table instance , it controls the locking of table before use and unlocking after use



Share/Bookmark