Monday, February 4, 2013

AE Properties


Application Engine
             
              Application Engine is used for BATCH or ONLINE processing where you have a large (or small) amount of data that needs to be processed without user intervention.
Application Engine is the People Tool that you use to develop BATCH or ONLINE PROGRAM that are effective alternatives to COBOL or SQR programs for Performance.

An AE program is a set of SQL statements, People Code, and Program Control Actions defined in Application Designer that performs a business process.
Think of Application Engine as a tool that allows you to define a program's framework, as in its algorithm, structure, and looping constructs.
Allows you to take advantage of features such as the People Code File objects and Interlink objects, Component Interfaces, Application Messaging, and so on


AE Structure




Setting Section Properties

Market – Default is GBL. You can set this property for a particular country/region.
Platform - Select the target database platform for which this section definition is to execute.
Effective Date - To make a particular section effective-dated, enter the target date.
Effective Status - Specify whether a section is active, or enabled at runtime.
Section Type - In the case of an abnormal termination of the program, the value of this system field specifies whether you must restart the section. If a section controls a procedure that, if not run to completion, could corrupt or desynchronize your data, select Critical Updates. Otherwise, use the default value of Preparation Only.
Auto Commit - You can have no commit or you can have PeopleSoft Application Engine commit after the step successfully completes.
Public - Select to enable a section to be called from another program.







Setting Step properties


Commit –
·         Default: Select to inherit whatever commit level you specified for the section in which the step resides.
·         Later: Select to postpone the commit until a subsequent commit occurs. Here you can override the section-level commit, if it happened to be set to After Step.
·         After Step: Select 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-
Enabled only when a step contains one of the following actions: Do While, Do Select, or Do Until. Enter the numeric frequency with which PeopleSoft Application Engine should commit. If non-zero, PeopleSoft Application Engine commits every N iterations, and then again after the last iteration

On Error
·         Abort: The application terminates with an error message.
·         Ignore: The program continues but logs an error message.
·         Suppress:The program continues and presents no error message.

Status
Select to activate a step. If the step is currently applicable to your program (and working) you’ll probably want to keep it active.

Note: The On Error property does not apply to compile errors (for example, specifying erroneous SQL statements). It checks only for execution-type errors. If your program has a syntax error, the program terminates.





Setting Action properties

Re-Use Statement property

The ReUse Statement property is available for all SQL action types (SQL, Do When, Do While, Do Until, Do Select). You use the ReUse Statement property to optimize the SQL in your batch program. ReUse Statement converts any %BIND references to state record fields into real bind variables (:1, :2, and so on), enabling the Application Engine runtime process to compile the statement once, dedicate a cursor, and then re-execute it with new data as often as your program requires. When you are using SQL or a Do action to process a large volume of rows, one at a time, inside a fetch loop, compiling each statement that you issue can be a considerable performance issue. ReUse Statement is a way to combat potential performance decreases.
Note. You can have PeopleSoft Application Engine recompile a reused statement by using the %ClearCursor function.
When setting the ReUse Statement option, choose between these values:
Bulk Insert
When used in conjunction with statements like INSERT INTO tablename (field1, field2...) VALUES (%BIND(ref1),
%BIND(ref2), the Bulk Insert feature offers the most powerful degree of performance enhancements related to the ReUse Statement feature. This option turns on ReUse Statement, and, in addition, it holds all the data in a buffer and performs an insert only after a large volume of rows has gathered in the buffer. The number of rows allowed to gather in the buffer depends on your database platform. Storing data in the buffers is applicable only if you’ve selected Bulk Insert and the SQL is an Insert statement. For statements other than Insert, the Bulk Insert option is ignored.
No
Select this option to disable ReUse Statement. With ReUse off, the Application Engine runtime process recompiles the SQL statement every time the loop executes. By default, ReUse Statement is disabled.
Yes
Select this option to enable basic ReUse Statement functionality.
Note. The ReUse Statement property can offer significant performance gains. However, do not use it if %BIND variables are building parts of the SQL statement or are in the field list of a Select statement (this does not apply if you use the Static option in %BIND).


SQL Action
Use this action to perform the following SQL commands (Insert, Update, Delete, and Select) on multiple rows.

Note. If you intend to include multiple SQL statements within a single action, you should use the meta-SQL construct %EXECUTE
No Rows Property
In addition to the ReUse Statement property, the No Rows property is available for SQL actions. If the SQL (Insert, Update, or Delete) associated with the SQL action does not return any rows, you must specify what the Application Engine program should do.
For example, you could use this in a case where you insert into a temporary table, and then you intend to perform further operations on the inserted rows (provided that some rows meet the criteria). If the initial combination of Insert and Select statements provides no rows, you could save the program from having to reselect on the temporary table prior to executing another operation, or you could also prevent the program from performing set operations on the table when there won't be any qualifying rows.

When you set the No Rows property, you choose from the following values:
Abort
The program terminates.
Section Break
PeopleSoft Application Engine exits the current section immediately, and control returns to the calling step.
Continue
The program continues processing.
Skip Step
PeopleSoft Application Engine exits the current step immediately and moves on to the next step. Application Engine ignores the commit for the current step at runtime. If the current step contains only one action, use Skip Step only to bypass the commit.
Note. Using No Rows in conjunction with a Truncate Table operation is unreliable. Some database platforms report zero rows affected for truncations, regardless of how many rows were in the table.



Specifying DO Actions

Do When
Is similar to IF condition. The following actions in the step is executed if the select statement in the Do When returns a row.
The only property that you can specify for the Do When action is the ReUse Statement property, which applies to all SQL-based actions.

Do While
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. If the Do While does not return any rows, the step is complete.
The only property that you can specify for the Do While action is the ReUse Statement property, which applies to all SQL-based actions.

Do Until
Subsequent actions within the step are executed in a loop as long as no rows are returned by the Select statement for the Do While action. If the Do While returns any rows, the step is complete.
The only property that you can specify for the Do While action is the ReUse Statement property, which applies to all SQL-based actions.

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. For instance, a Do Select can execute a SQL statement for each row returned from the Select statement.
Like the other Do actions, for the Do Select action you can specify the ReUse Statement property, which applies to all SQL-based actions. In addition to the ReUse Statement property, you must also specify another Do Select property: Do Select Type.


Do Select Type Property
1.     Select/Fetch
PeopleSoft Application Engine opens a cursor for the Do Select action, then, within that cursor, PeopleSoft Application Engine performs a Fetch statement for each iteration of the loop to get each row from the Select statement. When a Fetch statement results in an end of table message, the looping is complete. You can’t restart this type of Select statement, because PeopleSoft Application Engine does not perform a checkpoint or a commit within the step containing this action while Select/Fetch is running. Ultimately, your program ignores the commit settings at runtime until the outermost Select/Fetch completes.

2.     Re-Select
For each iteration of the loop, PeopleSoft Application Engine opens a cursor and fetches the first row. Your program processes the first row returned from the Select statement. The cursor is reopened for each iteration of the loop. With this type of Fetch statement, you typically want some aspect of the loop to eventually cause the Select statement to return no rows. Otherwise, there is no mechanism in place by which to exit the loop. This type of Do Select is restartable.

3.     Restartable
This option is similar to Select/Fetch in that PeopleSoft Application Engine opens the cursor associated with the Do Select action once, and then it performs a Fetch statement on each iteration of the loop to get each row from the Select statement. However, unlike the Select/Fetch option, you can restart this action, because PeopleSoft Application Engine performs a checkpoint in the middle of the step. PeopleSoft Application Engine treats this loop as if it is restartable, but it does not manage the restart. Make sure that the SQL you include within this action is such that, upon restart, the program recognizes where the previous run failed and where to restart processing. For example, you can employing a processed switch, or base the next Select statement on the key.


Specifying People code actions
With a PeopleCode action, there is only one property that you can specify—On Return. The On Return setting takes effect if your PeopleCode program issues a “return 1” or “exit 1.”
When you specify the On Return property, you choose from the following values:
4.     Abort
The program issues an error and exits immediately.

5.     Break
The program exits the current step and section, and control returns to the calling step.

6.     Skip Step
The program exits the current step, and continues processing at the next step in the section. If this is the last step in the section, the calling step resumes control of the processing.


Specifying Call section actions
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, and 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, which section can be called only from within the same program.

Program ID Property
Because you can call sections defined in the current program or within external programs, you must first specify the program ID of the program containing the section you intend to call.

Section Name Property
Select from names defined in the program that appears in the Program ID list box.

Dynamic Property
Use the AE_APPLID and AE_SECTION fields in the state record to execute different sections depending on the conditions a program encounters during runtime.
These two fields must be defined on the default state record for the program


Specifying Call section actions
Use this type of action to write a message to the message log.


Message Set and Number
Select the message defined in the message catalog.

Parameters
Enter values to insert in the log message. This field should be a comma-delimited list of values to substitute for the message variables (%1, %2, and so on) in the message text. These parameters can be hard-coded values or %Bind references.

1 comment:

Appsian said...

Thank you for sharing your blog, seems to be useful information can’t wait to dig deep!