Application Engine


                                                      APPLICATION ENGINE

      What is Application Engine?
      Application Engine is a Development PeopleTool designed to create applications, these applications are useful to perform the background SQL process, means we can develop, test, and run background SQL processing programs. It is a set of SQL statements people code and program control actions defined in A.D that performs business process.

What is the use of A.E program?
We can use PeopleSoft Application Engine for straight row-by-row processing, but the most efficient Application Engine programs are written to perform set-based processing.
PeopleSoft Application Engine does not generate SQL or PeopleCode it executes the SQL and PeopleCode that we include in an Application Engine action as part of our overall program.
PeopleSoft Application Engine is designed for batch processing where we have a large amount of data that must be processed without user intervention. Ex: calculating the salaries in payroll processing

What are the advantages with Application Engine over SQR and Cobol/SQL?
      A.E is a PeopelTool Object remaining or 3rd party tools.
  1. Using A.E we can run parallel processing
  2. The main advantage is restart facility.
  3. Meta SQL support is there.

Encapsulation: Application Engine programs reside completely within the database. In COBOL or SQR; programs reside completely within the File server. If we make any changes on objects it will effect across the database. In Application Engine, there is no need to compile our programs, there are no statements to store, and there is no need to directly interact with the operating environment. We can develop our entire program from scratch, including the table definitions; we can run and debug our applications without leaving the PeopleTools environment. We can Build, run and debug our applications without existing PeopleTools.

Easy Up gradation: For this PeopleSoft People gave some scripts, by running these scripts we can upgrade easily. But we can't do this things in COBOL and SQR, for this we have to do the record change then modify our batch programs using some other mechanism all while make sure to keep track of what was changed and how and where it affects the batch program. With Application Engine and PeopleTools, it's all taken care of automatically.   

Portable to Operating System: We can call different versions of a section for different platforms, as needed. Supported RDBMS platforms are DB2, Oracle, Informix, DB2/Unix, Sybase, and Microsoft. If there is no RDBMS-specific version, Application Engine uses the default version.

PeopleCode & SQL Editors: PeopleCode & SQL Editors are available in the Application Engine, these are useful to validate the program while writing program. In SQR we can write the programs on Notepad or WordPad. Here we won’t validate the program.

Restart Facility: Suppose we are executing an Application Program, after executing some line due to some problems the program is aborted. After rectifying the error, now we want to run the program from where the program was aborted. It is possible to restart the program from one point where we last executed successfully, and continues with the processing from that point. This type of built-in logic does not exist in COBOL or SQR.

Meta-SQL support: It supports the meta-SQL, so that we can make the program platform independent that is RDBMS independent. By using Meta SQL we can generate portions of SQL statements.

Graphical Development Interface: It supports the GDI environment, so that we easily develop the objects.
The Application Designer offers Application Engine developers the following benefits:
          I.    At a time we can open multiple Application Engine programs.
        II.    Ability to work at once on the entire Application Engine program.
       III.    It supports two views. The Definition view and the Program flow view. In the Definition view we can create and modify the programs. In the Program Flow view we can see the actual order in which the program will execute the statements (It shows the graphical representation of the program execution).

Effective Dating: Application sections are effective-dated, means at a particular date we can activate/deactivate a section.

Reuse Business Logic: In the Application Engine program we can invoke the peopleCode using the call Application Engine program. Using this we can call other Application Engine program.

      How many types of A.E program’s are there?
There are 5 types of A.E programs are there.
1.     Standard, which is a normal entry-point program.
2.     Upgrade only, which is used in PeopleSoft Upgrade utilities.
3.     Import only, which is used by PeopleSoft Import utilities.
4.     Daemon Only, a special type of program used as a daemon process.
5.     Transform only, another special program type used to support XSLT.

What is demon A.E program?
PSDAEMON, runs continuously when the Process Scheduler is running, and is intended for recurrent jobs. It polls the system checking for certain conditions to be true for events and when true, it schedules a process to handle the event. The most common usage of the PSDEMON is to check for files that have been loaded to the server and when found launch a process to import the file. The purpose of Daemon program is to poll the system for a condition and when the condition is true initiate a process.

What is demon group?
Once the demon programs are created they need to be defined in a Daemon Group. The Daemon Group contains all the daemon programs for one server. Daemon Group is attached to Process Scheduler Server and Daemon is enabled.

What is Transform program type?
These types of programs enable different systems to communicate with one another by transforming messages into appropriate formats. When we specify an Application Engine as a Transform Only program, we must specify an Action Type of XSLT. We can use transform programs to do any of the following:
·         Apply a transformation to a message to make its structure comply with the target system's requirements.
·         Perform a data translation on a message so its data is represented according to the target system's conventions.
·         Determine whether to pass a message through to its target, by filtering it based on its content.

Where will you use XSLT action?
In Transform only program type we will use XSLT action.

What are the other Tools, which are useful to execute the background SQL processing programs?
  1. COBAL / SQL.  
  2. SQR Process.  
  3. Mass Change
COBAL / SQL and SQR are belongs to 3rd party tools not belongs to PeopleSoft. Mass change is peopleTools.

Why we are not using the Mass Change as background SQL Process for PeopleSoft Applications?
      The problem is there is no program logic. But the advantage is we can generate SQL, no need to write anything for this.

What is the purpose of the Back Ground SQL Process?
We can validate the data.
We can move the data from one or more tables to one or more tables (Reporting Tables).
We can update Database.

What is meant by Scheduling processing?
Processing the data without user involvement.

What is the name of the Application Engine executable and what language is it written in?
PSAE.exe and It is written in standard C++.
And this file resides in c:\<PS_Home>\bin\Client\Winx86\PSAE.exe.

Where are Application Engine programs stored?
Application Engine programs are stored in the PeopleSoft database.

Where can we create the Application Engine programs?
In the Application Designer.

What is the limitation to the Application Engine program name?
12 characters.

Can we generate the SQL using the Application Engine?
      No. Application Engine does not generate SQL, it executes the SQL what we provide. We can generate the SQL by using the Query Tool.

How can we make the database as platform independent?
By using the meta-SQL in our programs.

How many types of components can include the Application Engine?
      Application Engine includes two distinct components: one is the "front-end" used to define batch program and the other is "back-end” used to run the program what we developed.                                                                                                                            

What are the changes from 7.5 Version to 8.x Version?
      Up to 7.5 the importance of the Application Engine Program is very less.
      Designing purpose: In 7.5 Application Engine is useful. In 8.x Application Designer is useful.
In 8 Application Designer is useful for only designing purpose, for execution purpose Application Engine is useful. But in 8.4 both are possible in Application Designer only.
Programming: There is no such type of programming languages in 7.5. PeopleCode is the programming language for writing the programs in 8.x.
Cache Records:  (Cache records are useful for Memory purpose). 7.5 support only one cache record. 8.x supports more than one cache record.
Temporary Tables: These are useful for increasing the performance of the program by storing the intermediate results during a program run. No such type of tables in 7.5. Available in 8.x
Messages: No multi language support in 7.5, Available in 8.x.

How many components include Application Engine Program? The Structure of the Application Engine Program?
Program: An executable program must contain at least one Section, called MAIN. The execution of the program always starts from the MAIN section, and used to identify the starting point of the program.
Sections: A Section is a set of ordered Steps. When a section is called, its steps are executed sequentially. The execution starts with the first step of the MAIN section and ends with the last step. We can call Sections (and other programs) from Steps within other Sections. We can put n number of sections in the program, but at least one section should be there, that is MAIN. Without MAIN section we can also develop Application Engine Program, but we can use this as an Application Library. They can't be executed directly because they have no MAIN Section.
Steps: A Step is the smallest unit of work. We can use a Step to execute a PeopleCode command or log a message, execute a SQL statement or to call another Section. Every program begins by executing the first Step of the MAIN Section and ends after the last Step in the last Section completes successfully. We can specify the properties to the Section level and Step level.
Actions: It contains the code we wish to execute. The primary type is a SQL statement. But we also have log messages, people code, call other section, and perform transformations.

What should we get when we open a new Application Engine program?
We can get only one section that is MAIN and Step01 (with no actions yet).

What is the purpose of the Program?
      An Application Engine program identifies the set of processes to execute a given task.

Can we change the name of the MAIN section?
No, we can’t. This is only one section we can’t rename.

Can we have A.E program without MAIN?
No,

What is an Application Library?
Application Library is program that contains collection of callable sections. We can’t run the Application Library as a standalone program.

What are the properties of the Sections?
Section name: We can specify the section name and the limitation is 8 characters.

Description: We can write some description about the section.

Market: Select the Market for which the section is intended. If a particular Market is irrelevant to your batch program, keep the default Market value of Global (GBL).
                       
Platform: In some cases, we may develop an application for some other RDBMS. For this we can specify the Platform name here only.

Effective Date: We can make a particular section effective-dated and we can enter the effective date. The default effective date is 01/01/1900.

Effective Status: Specify whether a section is active or not. Active refers to being enabled at runtime. Inactive Sections are bypassed 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.                       

Auto Commit: You can opt to have no commit or you can have Application Engine commit after the step successfully completes.       

Access: We can specify that a section can or can’t be called from another program. If select this check box means we can’t call this from other section. Otherwise we can call this form other section.

Comments: We can add additional comments for this section.

What are the parameters of the steps?
            Step Name: We can specify the Step name.
            Step Description: We can write some description about the Step.
            Commit After: We can determine when commit will be executed.
Default: uses value supplied for the section.
Later: don’t commit now.
After step: commit when step completes.
       Frequency: Only available in Loops.
            On Error: We can specify any one action to take when an error occurs.
Abort: The program terminates and will write the message-to-message log.
Ignore: It will write message-to-message log and continue.
Suppress: no message will be written, but the program will continue.
Comment: We can add additional comments for this Step.

How can we view the comments of a particular section?
      By selecting View, Show all comments or by pressing F2 or Right click on a particular section in that select Show Comment.

How many actions can Application Engine supports?
      8 actions.
  1. SQL                 
  2. PeopleCode.    
  3. Call Section.    
  4. Log Messages.
  5. Do Select
  6. Do While
  7. Do Until           
  8. Do when

What is the sequence of execution of A.E. program?
         Do When
         Do while

         Do select

         SQL \ call section
         People code

         Log message

         Do until

At a time how many actions allows the Application Engine program?
      7 actions.

What are the mutually exclusive actions?
SQL and Call Section are mutually exclusive.

Why call section and SQL are mutually exclusive?
Both SQL and call section is used to perform DML operations so we will use either SQL or call section.

Can we put same action in one step?
      We can't put same action in one step.

      Can we have commits after every step?
      Yes we can have commit after every step.

What is the use of the Log Messages?
      A Log Message Action can be used to write a message to the MESSAGE_LOG based on a particular condition in the program. This gives your program multi-language capability. The Message Log refers to the People Tools table (PS_MESSAGE_LOG) where execution messages reside. Any substitution parameters are written to PS_MESSAGE_LOGPARM

What is the purpose of the Do Select?
Do Select is nothing but a For Loop and is used to populate state record values within the Application Engine program. Do select statement is a select statement that executes subsequent actions with in the step once for every row of data that is returned.

What are the select types of the DO SELECT?
  1. Select/fetch
  2. Reselect
  3. Restartable

What is Select/fetch?
Select and fetch opens the cursor to the database.
Selects the first row that meets the sql condition in the Do Select.
Executes the actions in the step (call section, sql, etc).
Once the subsequent actions are completed the program returns to the open cursor from the Do Select, retrieves the next row and continues again with the rest of the actions.

What is Reselect?
Reselect opens a cursor to the database.
Selects the first row that meets the sql condition in Do Select.
Closes the cursor.
Executes the following Actions in the step (Call Section, sql, etc)
Once the subsequent Actions are completed the program returns to the sql in the do select and opens a cursor again.

What is Restartable?                                                                                
It will acts like select and fetch but the only difference is we will use this with reselect option.

What is the purpose of the Do While?
      It is a SELECT statement that runs before subsequent actions of the step. The subsequent actions within the step are executed in a loop as long as the SELECT statement returns at least one row for the Do while action. Do While is nothing but a While Loop.

What is the purpose of the DO until?
A Do until action is a Select statement that runs after each action when a step completes. If the Select returns any rows of data, the step terminates. Do Until is nothing but a Repeat Loop.

What is the purpose of the 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 is the first executable statement with in the step. Do when is nothing but an If Loop. It contains SQL that tests for a condition. If the condition is true then it returns a row of data, and it executes the subsequent actions within the step. If the condition is false then no row of data returned and it terminates the entire step. If there are no more steps to execute, the program will end.

What is the purpose of the SQL action?
SQL Statements are used to perform the DDL, DML, and DCL operations. Majority cases we are using the DML commands (UPDATE, DELETE, INSERT, SELECT).

What is the use of the Call Section?
Call Section is used to call one section from another section. The "called" Section can be in the same program as the calling Section, or it can be in an external program. If a Section already exists in one program, rather than copying it into another program, just call it.

      What is the use of people code action in A.E program?
People code provides reusing common faction libraries of A.E program. And used to build dynamic SQL performs simple if /then/else edits set defaults and perform other tasks that don’t required trip to the database.

What is difference between Do select and SQL?
The Do Select action is a SELECT statement that executes subsequent actions once for every row of data that the Do Select returns. It works like a FOR loop. It returns a row. Do Select is a test condition. Where as SQL executes DML and Meta SQL.

What is difference between call section action and dynamic call check box?
Call Section is used to call one section from another section. The "called" Section can be in the same program as the calling Section, or it can be in an external program. If a Section already exists in one program, rather than copying it into another program, just call it.

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. 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.
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. 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.
Selecting dynamic automatically populates the AE_SECTION field with the symbolic value %Section, and the Program ID field with the symbolic value %AEAPPLID. At runtime, the program calls the section name stored in AE_SECTION that belongs to the program name defined by AE_APPLID.

How can we expand all the nodes in the Application Engine program?
By using the + icon or by selecting View, Expand All or (Ctrl+Shift+X) or expand all nodes toolbar button available in the standard toolbar.

How can we hide all the nodes in the Application Engine program?
Select View, Collapse All and View, Hide All Details. Or (Ctrl+Shift+C)

How can we filter some particular sections?
      Select View > Section Filtering > Custom. Then specify the market type (ex: GBR) and click
      OK. So that we can get only some section which are belongs to the GBR market type. To
      disable this option select View > Section Filtering > No Filtering.

How many levels of actions support the Application Engine program?
      Application Engine supports up to 99 levels of nested Call Section Actions.
      For example, the first called Section can call a second, which can call a third, and so on, up to 99 calls.
 
STATE RECORD

Can we have more than one state record in single A.E?
Yes we can have more than one state record in A.E but one should be the default state record.

Tell me what you know about state record?
State records are used to assign variables for Application Engine program. State Record used as a  worktable. Key field is Process_instance. It can be a derived work record or SQL table. No people code fires on AE state record. To restart facility we put the Process_instance field.

How will u pass variable from one A.E. to another A.E. program?
Through state record.

What is the purpose of the State Record?
To pass the variables for the Application Engine program.

What is the other name to the State Record?
Cache record.

How many state records can be associated with an Application Engine program?
      An Application Engine program may have zero, one, or many state records. Only one state
      record will be the default.

Where do we associate a state record with an Application Engine program?
Program Properties.

Who creates the State Record in the Application Engine program?
The State Record must be created and maintained by the Application Engine developer.

What type of record is a state record?
      Can be a Physical record (SQL table) or a derived work record. If it is Physical table we
      should build before using this.

What is the extension to the state record?
_AET. Then only the system identifies the record as a state record.

How many rows we can have in state record?
We will have one row in state record. But in case if multiple A.E programs use same state record as default state record then there will be multiple rows in state record. i.e. one row for each record.

What field is used as the key field on a state record?
PROCESS_INSTANCE.

Why we are using the PROCESS_INSTANCE as a key field in the state record?
For restart facility.

What Meta SQL is used to retrieve values form a state record?
%BIND.

What Meta SQL is used to store values into a state record?
%SELECT.

Can we specify the Date type field as a required field?
No, we can specify only character and numeric fields as required fields.

Is people code fires on A.E sate record?
No PeoplCode fires on an Application Engine state record.

                                    PROPERTIES OF THE APPLICATION ENGINE PROGRAM

How can we access the properties of the Application Engine Programs?
If we want to view and modify the properties of an Application Engine program open it in the Application Designer, select File > Object Properties while the program is open and press the Properties button. We can also press ALT+ENTER. Then it displays the Program Properties Dialog Box, and it consists of 4 controls.
  1. General           
  2. State Records  
  3. Temp Tables    
  4. Advanced

      1.General:

Description: Used to enter a descriptive name. In this edit box we can enter up to 30-character only.

Comments: Used to enter the comments about the program. Or add any other useful comments that development or administrative staff may need to see.

Owner ID: Used to enter the Owner ID for the program. Owner ID is a way to identify which objects are owned by which PeopleSoft products, such as General Ledger, Accounts Receivables, and so on. The values in the dropdown list are Translate table values associated with the OBJECTOWNERID field. This field is entirely optional.

2.State Records:

Qualify Search: By default, the Record List box will contain all record names that end with the extension AET. We can also specify the state record name.

Get List: Press this button, to populate the Record List box.

Record List: This text box contains the results of the State Record search.                                     

Selected: This group box is where we select State Records for use with a particular program. Use the Add button to include selected records that appear in the Record List. Use the Remove button to exclude selected records that appear in the selected list box. Indicate which State Record will act as the default State Record by selecting its checkbox. For the default State Record, we only need to reference fieldnames in the PeopleCode and SQL (for the active program). When we reference a non-default State Record, we do so by using recname.fieldname.

3.Temporary Tables:

Qualify Search: This edit box is useful to enter any wild card characters or complete table names to limit the results that will appear in the Record List. By default, the Record List box only will contain records that are of type "Temporary Table". This is an attribute applied at the time you create the Record in Application Designer.

Get List: Press this button, to populate the Record List box.

Record List: This text box contains the results of the Temp Table search.

Selected: This group box is where you select temporary tables for use with a particular program. Use the Add button to include selected records that appear in the Record list. Use the Remove button to exclude selected records that appear in the selected list box.

Instance Count: The Instance Count value controls the number of physical tables to be created for each dedicated table for this program during the SQL Build procedure in Application Designer. Typically, you would set this number to equal the number of parallel program runs that you anticipate. For instance if you expect up to five instances of the same program to run simultaneously, then you would set the Instance Count to 5.

Insert Selected List into Project: If the active Application Engine program definition belongs to a Project, then you can opt to include the dedicated temporary tables for this program within the same project.

Runtime: When you are implementing dedicated temporary tables, you must consider how your program should behave in the event the number of active processes exceeds the number of dedicated temporary table instances. Do you want the program to abort, or do you want it to use the base table (PS_recname with no suffix), which is a non-dedicated table. The Runtime options enable you to control how an Application Engine program behaves in the event that an instance of its specified dedicated temporary tables are not available. If you select Continue, then Application Engine uses the base version, or undedicated version, of the temporary tables. If you select Abort, then the program exits with a meaningful error message.

4. Advanced:

Disable Restart: Application Engine has built-in restart capabilities. In many cases, we will want to have Restart enabled. To disable restart for a particular program, select DisableRestart.

Application Library: Most Application Engine programs are defined to be executable. An executable program has a main entry point in its definition: the Section MAIN. This defines the entry point so whatever method we choose to invoke the program, such as command line or Process Scheduler, can initiate the program. However, in some cases, we may want a program to only contain a collection, or "library," of common routines (in the form of "callable" Sections) that we do not want to run as a standalone program. When sections are defined as "Public," other programs can call the Sections, or routines, that exist in the "library" at runtime. Because this type of Program is not designed to run as a stand-alone program, it does not require the MAIN Section, or initial entry point. Setting the Application Library option renames or removes any existing MAIN Section.
Note: Application Libraries are the appropriate spot to store a collection of shared Application Engine program Sections. It is not intended to store a specific SQL Action with in a Section. To share common SQL, use the SQL repository.

Upgrade Only: This option is for programs intended to be used for upgrade purposes only. PeopleSoft delivers some Application Engine programs for upgrade-only uses. Unless you are responsible for the upgrade procedure at your site, you won't need to deal with these programs. These programs are documented specifically within the Upgrade documentation accompanying your shipment. Message Set. Specify the message set value that you want assigned as the default message set number for this Application Engine program. The system uses this Message Set value for all Log Message Actions where the message set isn't specified.
                                               
                                                EXECUTION OF A.E PROGRAM

Difference between online and batch execution:
Online Execution
Batch Execution
Started by CallAppEngine from PeopleCode.
Started through PeopleSoft Process Scheduler.
Program runs quickly, synchronously, and at random times.
Programs run for longer amounts of time, asynchronously, and at scheduled times.
Potential for simultaneous execution.
Can be designed for parallel execution for performance.
Uses the Online Temporary Table pool.
Uses the Batch/Dedicated Temporary Table pool.




How many ways we can execute A.E program?
Batch Using PeopleSoft Process Scheduler
Online Using PeopleCode
Manual Using the Command Line

Batch Using PeopleSoft Process Scheduler
This is the most typical mode of execution. You invoke programs that run in this mode using PeopleSoft Process Scheduler or the Application Engine Process Request Page. Batch mode is also referred to as asynchronous execution meaning that it runs independently in the background. PeopleSoft Application Engine runs on any operating system that PeopleSoft supports as an application server.

To run Application Engine programs on the batch server, you must install Tuxedo. This applies to both UNIX and Windows NT batch servers. If you run your batch server on the same server machine as your application server, then the application server and the batch server can share one Tuxedo install. If your batch server is separate from your application server, then you must install the Tuxedo CD-ROM to your batch server.

Online Using PeopleCode
Application Engine programs that execute online typically get executed from a page with the CallAppEngine PeopleCode function. Such online processes are synchronous meaning that subsequent processes wait on the results. For instance, a page may be "frozen" until the online process returns the necessary results. With CallAppEngine there are no COMMITs issued. There is an asynchronous online PeopleCode option, ProcessRequest. With ProcessRequest, COMMITs are allowed.

Manual Using the Command Line
Usually, you use this technique only during testing or if you need to manually restart the program.
In this section, we discuss how to:

Most Application Engine programs are scheduled to run using the Process Scheduler. In 4 ways we can execute A.E program, they are
·         Use Process Scheduler to start Application Engine batch programs.
·         Use the Application Engine Process Request page.
·         Use PeopleCode to call an Application Engine program.
·         Use the command line to invoke an Application Engine program

1.     Running From within the Application Engine
For this we have RUN PROGRAM icon on the Application Engine Tool bar.
Create new record (ID, Name, and Salary). Save (EMP_TBL) and Build.
Create page, component, and menu. Register the component.
Create new Application Engine Program, insert SQL action and write
INSERT INTO PS_EMP_TBL (ID, NAME, SALARY) VAULES (‘100’, ‘NUTAN’, 20000);
 Click on RUN Button.

2. Through PeopleCode
To run through peoplecode we should create a push button on a page. When we click the push button, Filed change PeopleCode is triggered and associated PeopleCode will be executed.
Create new record (ID, Name, and Salary), then save (EMP_TBL) and build.
Write PeopleCode (Salary field and Field Change Event)
CALLAPPENGINE (“EMP_AE);
Create new page, insert record fields (ID, Name, and Salary). And insert a push button. Then double click on the push button and specify the record name and field name. Then click on label tab and select any image ID. Click OK.
Create component and menu.
Create new Application Engine program. Insert SQL Action. 
INSERT INTO EMP_TBL (ID, NAME, SALARY) VALUES (‘100’, ‘NUTAN’, 30000);
Save the program with EMP_AE.
Open the component click the Push Button. Then observe the results.

3. Running From PeopleSoft Process Scheduler.
Create one record (ID, Name, salary). Create Page and Component and Menu. Register the Component. Save the record with EMP_TBL.
Create new Application Engine object, insert SQL action, Then write the SQL, INSET INTO PS_EMP_TBL (ID, NAME, SALARY) VALUES (‘100’, ‘NUTAN’, 50000); then save the program with EMP_AE.
Open Browser environment PeopleTools > Application Engine > Request AE then click on add new value then enter User ID and Run control ID and Program name. SAVE.
Go to Process Scheduler > Process, Click on Add New value, then enter the Process type as Application Engine and Process name (Program name).
Go to the Process Definition Options tab; specify the server name and Component name as AE request and Process Group.
Again go to the request AE (PeopleTools, Application Engine, and Request AE). Open the process which we created. Then click on RUN button.
Go to the Process Monitor click on Refresh.

1.     Running From Command Line
For this we should create .BAT file.
Open any notepad file, write C:\PT8.42\bin\server\WINX86\PSAE -CD <database name> -CO <userID> -CP <User Password> -R <Run Control ID> -AI <Program Name>
Then save the file with .BAT extension.
Run Time Parameters for END-USER
  1. -CT:      Database Platform
  2. -CD:      Database Name
  3. -CO:     User ID
  4. -CP:      User Password
  5. -R:                    Run Control ID
  6. -AI:                   Program Name
  7. _I:                    Instance Number
Run Time Parameters for Developers
  1. -TRACE n:                    Generate AE Trace File
  2. -DEBUG a:                    Invoke Online AE Debugger
  3. -CONVERT:        Convert to release 7 to 8

What is the function used to call A.E program through people code?
CallAppEngine function

In which events of people code we can write CallAppEngine function?
You need to include the CallAppEngine PeopleCode function within events that allow database updates. This includes the following PeopleCode events:
1.     SavePreChange (Record)
2.     SavePostChange (Page)
3.     Workflow
4.     Subscription (Message)
5.     FieldChange

Diff between online A.E program and batch job?
Online A.E program is executed from a page with the call app engine people code function. In this process the page, which is calling from Online will be frozen until the process returns any results. No commits are issued until the program complets.
Batch process is the typical mode of execution, in this mode programs are run using process scheduler or A.E request page.

 

DEBUGGING OF A.E PROGRAMS


Why we need the Debugging concept?
      After completion of the program successfully, due to some problems the output is not what we expected, the problem may be the network, hardware, system software, database, procedures or application software, So that we need to find the mistake. That means we have to debug the program.

Where can we view the failure details of the program?
Process Monitor.

 Application Engine supports what type of Debugging Tools?
  1. Process Monitor
  2. Application Engine Trace file (In the Configuration Manager)
  3. Application Engine Interactive Debugger
  4. PeopleCode Debugger.

How can we access the Application Engine Interactive Debugger?
Set the Debug check box on, in the Process Scheduler folder tab in the Configuration Manager.
Open the Configuration Manager.
First click on the Trace tab and turn off the statement timings.
Click on the profile tab.
Click on the Edit push button.
On the Process Scheduler page, we will find the Application Engine options.
Select the Debug check box.
Click the OK to save the new configuration.

When we use A.E Interactive Debugger?
It can be used while running on the client or when running directly on the server –out side of the process scheduler.

How can we access the Debug Commands?
After specifying the Debug option in the Configuration Manger, Run any program then we will see the DOS communication window, then type a ? And press ENTER. Then it displays all the debugging commands.

How can we set A.E Trace file?
For process running on a windows workstation, we can set trace option in configuration manager.
In configuration manager > Trace tab > A.E Trace will be there in that we can set trace.

What do the A.E Trace file shows you?
      A.E Trace will show the steps and sql issued in the order and complete information. In addition it shows execution timings.

      How can you debug A.E program form command line argument and other?
PSAE.EXE —CT <DB_TYPE> -CD <DB_NAME> -CO <OPRID> -CP <PASSWORD> -R <RUN_CONTROL> -AI <PROGRAM_NAME> -I <PROCESS_INSTANCE>



What errors you got when you are running A.E program?



How do you debug an A.E program?
You can set the Debug option in the following locations:
·         Start PeopleSoft Configuration Manager and select the Process Scheduler tab. In the Application Engine group, enable Debug by selecting the Debug check box. This is the method that applies to all methods of invocation.
·         If you used the command line option to invoke your Application Engine program, then you can just include the —DEBUG Y parameter in the command line you submit to PSAE.EXE. If you already have the Debug check box selected in PeopleSoft Configuration Manager, then you do not need to include the —DEBUG parameter in your command line.
·         If you have PeopleCode in your Application Engine program, you should also enable the PeopleCode Debugger. When you launch your program and the PeopleCode Action executes, you will enter the PeopleCode Debugger at that point.

Note. Setting the debug capabilities in either PeopleSoft Configuration Manager or the command line will turn debug mode on. The only situation where this is not true is when you have Debug enabled in Configuration Manager and you explicitly submit —DEBUG N on the command line. In this case, the PeopleSoft Configuration Manager setting defines your "default" command line value, and the command line can override the default.

How do you enable the PeopleCode Debugger for Application Engine?

1.     Sign on to PeopleTools using the same User ID that you are going to use to invoke the Application Engine program.
2.     Open PeopleSoft Application Designer.
3.     Select Debug, PeopleCode Debugger Mode.
4.     Your Application Engine program can be open on the desktop, but you do not need to open the Application Engine program or the PeopleCode action that you want to debug.
5.     Select Debug, Break at Start.
6.     This causes the Application Engine program to break prior to executing any PeopleCode programs within it.

TEMPARARY TABLES IN A.E PROGAMS


What is temparary table and instances?
Temporary table is buffer allocation, which consists of row and columns. Application Engine programs run in batch mode, multiple instances of the same program often execute in parallel processing. When this happens, there is a significant risk of data contention and deadlocks on tables. To avoid this PeopleSoft PeopleTools has a feature that enables you to dedicate specific instances of temporary tables for each program run.You can also use temporary tables to improve performance. Instances determine the no… of  temp tables to be created.

Difference between online and batch job temporary table instances?









What is work record?
It’s a temp table used to store temporary values.
 
Difference between _Tmp and _Tao?
For on line process we will use _tmp and for batch process we will use _tao

How you assign the temp tables to A.E program?
         Open a.e program >program properities>temp tables

         Select the table you want

         Click ok

         Save the program

         Open app designer
         Open the record
         Build the record
         Save

What is A.E run control record?
A.E Run control record stores the values of A.E program parameters.

What is restart facility?
The restart facility is used to restart the A.E program where it was stopped.

What you need to do for making restart facility in A.E program?
At least one state record needs to be physical record as the data will be available in case of abend.
We have to select the restart check box in A.E program properties.
In configuration manager select the process scheduler tab and uncheck the disable restart.

How you improve performance of A.E. Program?
By using temp tables we can improve performance.
By using traces and reusing options.
Avoid using SQL execution logic in a people code action. Instead use the logic in do conditions.
Bulk insert option can speed up your program with in a loop.

Define the following Meta sqls
%Bind:  Used for retrieve data from the state record
%Select: Inserting values in to state record
%Table: For referencing a table across multiple databases
%Truncate: To delete the temporary table
%DateIn: Where dt is either a Date value or a date literal in YYYY-MM-DD format, expands into platform-specific SQL syntax for the date. %DateIn should be used whenever a date literal or Date bind variable is used in a comparison in the WHERE clause of a SELECT or UPDATE statement, or when a Date value is passed in an INSERT statement
%DateOut: Where dt is a date column, expands to a platform-specific SQL substring representing dt in the SELECT clause of an SQL query.
%Mode: Gives the correct user action Mode, like add/update…
%Execute edit: Enables People Soft Application Engine to support data dictionary edits in batch
%Join: Expands the join dynamically while executing this Meta sql

What is the max no of temp table instances can be created?
The system creates a maximum of 99 temporary table instances only, even if the sum exceeds 99 for a particular temporary table.
The naming convention for the temporary table instances is as follows.
Where nn is a number between 1 and 99, as in PS_TEST_TMP23.


What is parallel processing?
The ability for multiple instances of the same programme to run simultaneously is called parallel or concurrent processing.

What is set processing?
Set processing is nothing but processing sets of rows at one time rather than processing each row individually. Set processing enables you to apply your business rule directly on the data (preferably while it resides in a temporary table) in the database using an update or insert/select statement. Most of the performance gain is because the processing occurs in the database instead of loading the data into the application program, processing it, and then inserting the results back into the database tables. Because the data never leaves the database with set processing, you effectively eliminate the network round trip and database API overhead.
Note. Because the updates in set processing occur within the database, PeopleSoft encourages you to use temporary tables to hold transient data while your program runs. Although temporary tables are not required for set processing, they are often essential to achieve optimum performance in your batch program. The only select statements used in set processing appear in sub queries of an insert and update statements,

Example for Row by Row processing query
declare A cursor for select dept_id from department where profit
> 50000;
open A;
fetch A into p_dept_id
while sql_status == OK
   update personnel set salary = (salary+1000) where dept_id =
p_dept_id;
   fetch A into p_dept_id;
end while;
close A;
free A;
Example for set processing query

update personnel set salary = (salary + 1000)
   where exists
      (select 'X' from department
         where profit > 50000
         and personnel.dept_id =
department.dept_id)
     
What is bulk insert?
Inserting buffering rows into database. PeopleSoft Application Engine offers this non-standard SQL enhancement on the following databases: Oracle, Microsoft SQLServer, and DB2. This feature is named Bulk Insert. For those database platforms that do not support bulk insert, this flag is ignored.
You should consider using this feature only when the INSERT SQL is called multiple times in the absence of intervening COMMITs
When used in conjunction with statements like INSERT INTO tablename (field1, field2...) VALUES (%BIND(ref1), %BIND(ref2), Bulk Insert offers the most powerful degree of performance enhancements related to ReUse. This option turns on ReUse, 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. Keep in mind that 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/...VALUES, the Bulk Insert option is ignored.
This option is only applicable if the sql in our sql action contains a sql insert

Where we have to set options for disable and enable restart facility?
There are three places that we can enable or disable restart
·         Check box on the Program Properties dialog box
·         Check box in the Configuration Manager Profile
·         To disable, include the option —DR Y to the command line of PSAE.EXE (or delete to enable restart)
If in any of these three places you've disabled restart, then restart is disabled.

To enable or disable restart in Program Properties dialog box:
1.     Select File, Definition Properties or click the Properties button.
2.     Select the Advanced tab and select or clear the Disable Restart check box appropriately.
3.     If you are developing programs and are ready to test but don't want a restart condition to get in the way, you could leave the Disable Restart check box clear in the Program Properties. Then, you could have the Disable Restart check box on the Configuration Manager selected, or if you are invoking your program from the command line, you could have the Restart flag enabled. This allows you to test new development and avoid errors about forcing you to restart during your testing. At the same time it prevents you from inadvertently leaving Disable Restart selected in the Program Properties when you moved the program into production.

To enable or disable restart in PeopleSoft Configuration Manager:
1.     Start Configuration Manager. Select the Profile tab and click the Edit button.
2.     Select the Process Scheduler tab and select or clear the Disable Restart check box appropriately.

What we have to do for restart facility?
Program level:
One state record should be sql table.
On the advanced tab in the program properties dialog box make sure that disable restart is not checked
      In configuration manager make sure that disable restart is not selected on the process schedular tab
Section level:
The options for section type should be prepare only and critical updates.
If the section is only preparing data as selecting it populating temporary tables or updating temporary tables the section type should be prepare only.
If the section is updating permanent application tables in the database we should select critical updates.
Step Level:
We need to have some conditions that reduce the answer set returned by the doselect
Add and order by clause:
%select field1
select field1
from ps_some_record
where field1>%bind(field1)
order by field1
Add a switch to the selected table
Select column1, column2
From ps_table1
Where processing_switch = ‘N’
Delete processed rows.

What code we used for restart facility?
%select field1
select field1
from ps_some_record
where field1>%bind(field1)
order by field1
Add a switch to the selected table
Select column1, column2
From ps_table1
Where processing_switch = ‘N’
Delete processed rows.

How can we validate application engine data?
What is the syntax for reading and writing a file from people code action?
The following example opens an existing Unicode file for reading:
&MYFILE.Open(&SOMENAME, "E", "U");
If &MYFILE.IsOpen Then
   while &MYFILE.ReadLine(&SOMESTRING)
      /* Process the contents of each &SOMESTRING */
   End-While;
   &MYFILE.Close();
End-If;

The following example opens a numbered file for writing in ANSI format, without overwriting any existing files:
&MYFILE.Open("C:\temp\item*.txt", "N",
%FilePath_Absolute);
If &MYFILE.IsOpen Then
   &MYFILE.WriteLine("Some text.");
   &MYFILE.Close();
End-If;                                                                   
                                                                                                                    
      How can we call a section dynamically in app engine?
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. 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.
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. 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.
Selecting dynamic automatically populates the AE_SECTION field with the symbolic value %Section, and the Program ID field with the symbolic value %AEAPPLID. At runtime, the program calls the section name stored in AE_SECTION that belongs to the program name defined by AE_APPLID.

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I use basically superior fabrics : you will discover these products by: https://igraphicbox.co.nz

    ReplyDelete