Search This Blog

Showing posts with label trace. Show all posts
Showing posts with label trace. Show all posts

Tracing COBOL Process

Below are the steps to trace a COBOL process.

Go to PeopleTools > Process Schedule > Process Types and copy the parameter list value, which is:
%%PRCSNAME%%/%%DBTYPE%%/%%DBNAME%%/%%OPRID%%/%%OPRPSWD%%/%%RUNCNTLID%%/%%INSTANCE%%/135/%%DBFLAG%%


Then navigate to the COBOL process which you want to trace and go to the Override Options page.
Select Override for the Parameter List and paste the SAME value you copied from the Process Type page here. Save the page.

** Do not take out anything from the string


 Now run the COBOL process you want to trace. Once the process goes to success you can see the Trace file under the View Log/Trace.


Pace-soft - Peoplesoft Trace file analyzer

PeopleSoft SQL Trace file analyzer. New version of Pace-soft trace both *.trc files and *.AET files.

Easily filter the SQL statements in the trace file.

Extracting the useful information from this file can be a significant hurdle. Loading the file in Pace-Trace, this information is made available to you in a clear format. Dramatically speeds the process toward your eventual solution.

Peoplecode Trace in a File.

Local File &fle;
&fle = GetFile(GetCwd() | "/files/Test.xml", "W", %FilePath_Absolute);
&fle.WriteLine("Hi");
&fle.Close();


Test.xml can Found in...

Web Server: psoft > appserv > DATABASENAME > files > Test.xml

Lokesh Madnavat

Trace AE and COBOL processes



Question: How to trace AE and COBOL processes using the Process Definitions instead of setting on Process Scheduler / App Server Config files.

ANSWER;

For AE, Open the Process Definition under PeopleTools, Process Scheduler. Go to the override tab, and on the Parameter list line select Append from the dropdown, and in the edit box next to it, you can use the desried combination of traces, they all are;
Parameter List Append -TRACE 7 -TOOLSTRACEPC 3596 -TOOLSTRACESQL 31

Save the Defnition and hence forth this program will be traced each time it is run, until this is removed. Using Both the -TOOLSTRACEPC and -TOOLSTRACESQL together should only be done when required, as the output from both go into the same file, making it very large and difficult to read. For normal program tracing using just the;

-TRACE 7 -TOOLSTRACEPC 3596

Give the Application Engine Trace, which traces the SQL in an AE program, and the PeopleSoft Trace, which is the pcode trace.

The above settings have equivelent settings in psprcs.cfg, they are;
TraceAE= -TRACE output goes into Application Engine Trace (.AET) TracePC= -TOOLSTRACEPC output goes into the PeopleTools trace file (.trc) TraceSQL= -TOOLSTRACESQL output ALSO goes into the PeopleTools trace file (.trc)
Again, depending on what the program is doing, most commnoly we'd use the -TRACE and -TOOLSTRACEPC together.

The only time I use the -TOOLSTRACESQL is when we're looking for a problem with the psae program itself.

For COBOL the idea is similar, we won't be appending to the parameter list instead we'll be overriding it. So first step is to open the appropriate Process Type Definition, example;

Process Type defn COBOL NT/Win2000 ORACLE

Copy the whole parameter list line into you mouse clipboard;

%%PRCSNAME%% %%DBTYPE%%/%%DBNAME%%/%%OPRID%%/%%OPRPSWD%%/%%RUNCNTLID%%/%%INSTANCE%%//%%DBFLAG%%

Then open the Process Definition for the particular COBOL Process, go to the Override Tab, and on the Parameter list line, select Override from the drop down. Then in the Parameter Edit box, paste the whole parameter list from the Process Defn we just got;

%%PRCSNAME%% %%DBTYPE%%/%%DBNAME%%/%%OPRID%%/%%OPRPSWD%%/%%RUNCNTLID%%/%%INSTANCE%%//%%DBFLAG%%

Notice at the end of the line after the %%INSTANCE%% and before the %%DBFLAGS%% there are 2 // We need to insert the desired bit map number inbetween the slashes.

Choose the bitmap number you want to use for the trace, and put it between the slashes like so;

%%DBTYPE%%/%%DBNAME%%/%%OPRID%%/%%OPRPSWD%%/%%RUNCNTLID%%/%%INSTANCE%%/255/%%DBFLAG%%

Save the Process Definition and once you launch the COBOL or AE program you can go to the Process Monitor, Details, Parameter List, and see the expanded command line and you'll see your trace value inserted;

Command Line: PSRUN PTPDBTST ORACLE/E840D20P/VP1/%OPRPSWD%/1/475/255/%DBFLAG%

With both the AE and Cobol traces done like this once this is done, everytime the program runs it will be traced. Need to undo all of this setting the override back to None in both Definitions will turn it off.

Tracing


Online Process
Set the following in psappsrv.cfg, or for a single user session in PIA using trace=y 
"31" is the recommended value when tracing with "TraceSQL".
"1984" is the recommended value when tracing with "TracePC". 

Batch Process
Application Engine

"135" is the recommended value when tracing with "TraceAE" 
if peoplecode tracing is needed, please also set 
TraceSQL= 31 
TracePC = 1984 
You can also do this in process definition of Application Engine to affect this for only 1 program. 
Override options : Append : -TRACE 135 -TOOLSTRACESQL 31 -TOOLSTRACEPC 1984 
To see which processes are set with this options, run this sql. 
SELECT PRCSNAME, PARMLIST FROM PS_PRCSDEFN WHERE UPPER(PARMLIST) LIKE '%TRACE%' AND PRCSTYPE = 'Application Engine'; 
To generate Database Level Trace, Use TraceAE=2183. This will create file within the "UDUMP" directory on the database server.
It will contain details of each SQL statement that was executed on the database including its runtime execution plan. You can then use this as a input to tkprof for generating formatted trace report. However this will not capture bind variables. To capture bind variables, following trigger is needed.
CREATE OR REPLACE TRIGGER MYDB.SET_TRACE_POCALC 
BEFORE UPDATE OF RUNSTATUS ON MYDB.PSPRCSRQST 
FOR EACH ROW 
WHEN ( NEW.runstatus = 7 
AND OLD.runstatus != 7 
AND NEW.prcstype = 'Application Engine' 
AND NEW.prcsname = 'PO_PO_CALC' 
BEGIN 
EXECUTE IMMEDIATE 
'ALTER SESSION SET TIMED_STATISTICS = TRUE'; 
EXECUTE IMMEDIATE 
'ALTER SESSION SET MAX_DUMP_FILE_SIZE = UNLIMITED'; 
EXECUTE IMMEDIATE 
'ALTER SESSION SET TRACEFILE_IDENTIFIER = ''POCALC'''; 
EXECUTE IMMEDIATE 
'ALTER SESSION SET EVENTS = ''10046 TRACE NAME CONTEXT FOREVER, LEVEL 12'''; 
END; 

Cobol Process
TraceSQL=128

SQR Process
A database level trigger is the only way for generating SQR trace.
Sample trigger script.
CREATE OR REPLACE TRIGGER MYDB.SET_TRACE_INS6000 
BEFORE UPDATE OF RUNSTATUS ON MYDB.PSPRCSRQST 
FOR EACH ROW 
WHEN ( NEW.runstatus = 7 
AND OLD.runstatus != 7 
AND NEW.prcstype = 'SQR REPORT' 
AND NEW.prcsname = 'INS6000' 
BEGIN 
EXECUTE IMMEDIATE 
'ALTER SESSION SET TIMED_STATISTICS = TRUE';
EXECUTE IMMEDIATE 
'ALTER SESSION SET MAX_DUMP_FILE_SIZE = UNLIMITED';
EXECUTE IMMEDIATE 
'ALTER SESSION SET TRACEFILE_IDENTIFIER = ''INS6000''';
EXECUTE IMMEDIATE 
'ALTER SESSION SET EVENTS = ''10046 TRACE NAME CONTEXT FOREVER, LEVEL 12'''; 
END; 
Once the raw database trace is captured, execute the program "tkprof" with following sort options: 
tkprof <trace_input_file> <rpt_output_file> sys=no explain=<user_id>/<password> sort=exeela,fchela,prscpu,execpu,fchcpu 
For more information, Read peoplesoft resolution 201049233: E-ORACLE:10g Master Performance Solution for Oracle 10g and download the red paper attached to it.