Friday, February 24, 2006

Developer's Short cut to launch AE programs as processes

You can use this method to launch AE programs as processes without having specific individual Process Definitions created using AE Request Page.

The idea is to replace %%PRCSNAME%% with %%RUNCNTLID%% so that you run AE Programs by creating run control id = AE Program name.

1. Create a New Process Definition FASTTEST of Type App engine and in the OverRide Options Tab, Specify Parameter List -> Override as follows

-CT %%DBTYPE%% -CD %%DBNAME%% -CO %%OPRID%% -CP %%OPRPSWD%% -R %%RUNCNTLID%% -I %%INSTANCE%% -AI %%RUNCNTLID%% -OT %%OUTDESTTYPE%% -FP %%OUTDEST%% -OF %%OUTDESTFORMAT%%

Also associate it with AE_REQUEST component & TLSALL Process Group on the Process Defintion options tab

You can then navigate to PeopleTools -> Application Engine -> Request AE -> Add
User ID TEST
Run Control AEPROGNAME
Program name AEPROGNAME

When the Request page opens, select process frequency always and hit the run button. Select the server Name and FASTTEST.

Note: You will not get Redirected Terminal Output (the standard output for the Application Engine program 2-tier). If run via Process Scheduler, there will be no log file generated, because a specific Process Definition for the Application Engine program was not used. Also use this method to test only in Dev Environment.

Thursday, February 23, 2006

Initialize Application Engine State Records

Sometimes you need to Re initialize application angine state record (AET) to its default values in your steps other than the first one. Instead of using the SetDefault peoplecode for each field of the state record, you can do this using a simple peoplecode function in peoplecode action or using %SelectInit Meta SQL construct in SQL action.

PeopleCode Solution.
Function SetDefaultValues(&rec As Record)
For &I = 1 To &rec.FieldCount
&statefld = &rec.GetField(&I);
/* PROCESS_INSTANCE is a reserved state field that cannot be modified */
If &statefld.Name <> "PROCESS_INSTANCE" Then
&rec.GetField(&I).SetDefault();
End-If;
End-For;
End-Function;

/* Sample PeopleCode to Call this function */
Declare Function SetDefaultValues PeopleCode FUNCLIB_UTIL.FUNCTION_FIELD FieldFormula;
Local Record &staterec;
Local Field &statefld;

/* Get the Record variable for the State Record) */
&staterec = GetRecord(Record.GF_ATTACH_AET);
MY_AET.OPRID = "xxxxxx";
MessageBox(0, "test", 0, 0, "Oprid before default = " | MY_AET.OPRID);
SetDefaultValues(&staterec);
MessageBox(0, "test", 0, 0, "Oprid after default = " | MY_AET.OPRID);

Note: MessageBox function in application engine peoplecode generates the entry in Message Log and can be viewd in process monitor using Log/Details link.

SQL Step Solution

You can add the SQL Step and use %SelectInit to initialize the State Record.

you can include a SQL Step with following values
%Select Init(State Record fields1, State Record fields2)
select 'x', 'x', 'x' ..... from ps_installation where 1 = 2

This meta-SQL construct is identical to %SELECT with the following exception?if the SELECT returns no rows, %SelectInit reinitializes the buffers. In the case of a %SELECT and no rows are returned, the state record fields retain their previous values.

Monitor App Messaging Errors

PeopleSoft provide an application engine program to monitor the error status in application messages. However it involves more setup to schedule this program. It is important to monitor these messages, as No further messages will be processed, if one of them errors out. Here are 3 simple SQL scripts that can be used to Monitor the error Status for messages

Various Status Codes and their descriptions
0 - Error, 1 - New , 2 - Started, 3 - Working,
4 - Done, 5 - Retry, 6 - Timeout, 7 - Edited, 8 - Canceled
Message Instance Script
select * from PSAPMSGPUBHDR WHERE PUBSTATUS IN (0,6);
Publication Contract Script
select * from PSAPMSGPUBCON WHERE PUBCONSTATUS IN (0,6);
Subscription Contract Script
select * from PSAPMSGSUBCON WHERE SUBCONSTATUS IN (0,6);

Monday, February 20, 2006

Batch file to Check status of multiple PeopleSoft Process Scheduler Servers running on Windows 2000 Server

You can use this batch file to check status of multiple peoplesoft process scheduler servers (Batch server), running on Windows 2000 Server. You need to run this batch file from %PS_HOME%\appserv directory. Preferably create a shortcut on desktop pointed to this file with Start In folder setup to %PS_HOME%\appserv folder. You will also need to create a View prcsserver.txt or Download prcsserver.txt file, which should contain name of process scheduler servers one per line. Place this file in the same folder, where your batch file is located.
Once you run this batch file, it opens a notepad displaying the status.txt file. It also creates a status1.txt file that contains tmadmin Version amd Copyright information. These files are all created under the same folder where batch file is located.

You can also edit the batch file variables to give different file name. They are
  • outfile - Output File that displays the status
  • outfile1 - Output File that contains tmadmin Copyright info
  • filename - List of Process Scheduler Servers

Tuesday, February 14, 2006

Friday, February 10, 2006

Trace Unique PeopleSoft Session

If you want to generate trace for your own PeopleSoft Session (8.x) and not for everybody else, you can append trace=y to the login URL. For e.g. if the login URL is
http://yourwebserver.com/psp/ps/?cmd=login adding &trace=y at the end will show you special trace settings you can enable. The url will look like
http://yourwebserver.com/psp/ps/?cmd=login&trace=y