To debug a peoplecode, we can use File write very effectively.
Declare a file variable
Local File &MYFILE;
Add the following Code. replace ketan with your username to uniquely identify your name.
&MYFILE = GetFile("debugketan.txt", "W");
If &MYFILE.IsOpen Then
This file will be created in unix under respective appserver
For e.g. if peoplecode is running on hrdev appserver the file will be created on
The path is also determined by the following environment variables when we do not specify the path for the file name or specify a relative file path
If the code is running on Appserver then following environment variables are used and searched in this order.
If the code is not running on Application Server, then following environment varialbes are used and searched in this order.
The PS_FILEDIR environmental variable is not initialized and set to a path automatically. If you want to use this environmental variable, you must set it yourself.
GetFile(filename, mode [, charset] [, pathtype])
Read mode: opens the file for reading, starting at the beginning.
Write mode: opens the file for writing. Any existing content in the file is discarded.
Append mode: opens the file for writing, starting at the end. Any existing content is retained.
Update mode: opens the file for reading or writing, starting at the end. Any existing content is retained. Use this mode and the GetPosition and SetPosition file class methods to maintain checkpoints of the current read/write position in the file.
Conditional "exist" read mode: opens the file for reading only if it exists, starting at the beginning. If it doesn’t exist, Open has no effect.
Conditional "new" write mode: opens the file for writing, only if it doesn’t already exist. If a file by the same name already exists, Open has no effect.
ASCII or A, UniCode or U, THAI, UTF8. Default is ASCII
Post a Comment